Hive is a programming game inspired by Nodewar, the Google AI Challenges, and Code Combat. It's intended work as both a stimulating AI competition and a fun environment for new coders. Hive is best when played against friends!
Hive also draws inspiration from social insects. "Superorganisms" are remarkable examples of distributed intelligence and pose unique AI challenges. Emergent colony behavior from simple individual rules is one of the most rewarding aspects of this project.
One of the primary goals of this project was to create an easy to use and friendly programming environment for people of all skill levels to play. This meant avoiding as much accidental complexity as possible. The model of having a program run for each ant individually meant that each ant must yield control of the thread to the main program constantly, necessitating an asynchronous coding architecture.
Instead, we use a code transformation which compiles the user's code into a large state machine which can be suspended and resumed at critical points in the program's execution. This allows for the program to be written with a traditional imperative control flow, making functions like
move('left') suspend the subroutine, and allow the rest of the program to execute.
Originally, we used a library called Aether, created by the people at CodeCombat to sandbox and allow easier debugging of the code their users enter. Unfortunately, this library has a severe limitation that functions cannot be defined locally, due to the model which it uses for the translation into a state machine. Because of this, we wrote our own library using regenerator to create a state machine which allows us to transparently use functions, while still having the easy to use imperative code flow.
Some other challenges included wrestling with unexpected library limitations and keeping architecture sane across a large codebase with four active contributors learning new skills.
What's next for Hive
We hope to foster an active online community through socially oriented features such as a ladder/leaderboard, discussion forum, open source AI collaboration, and friendly tournaments. We can't wait to see how people move their Ants!