Next article: What Every Programmer Should Know
Previous article: Bug Reversal
Tags: bolo games
A couple of articles back, I wrote an article about Bolo, and briefly mentioned an OS X version called nuBolo. Those of you who have tried it have no doubt noticed how authentic it is. You may also have noticed that it's lacking Bolo's Brains (AI plugins) support. I'm working on a module to add Brains support to nuBolo, and I've reached the stage where I thought I'd make a post about it.As a programmer, brains are one of the most interesting things about Bolo. The Bolo world is relatively simple, but with complicated emergent properties (as discussed in the previous article). This means that interfacing a program with it is easy, but it's still challenging to get it to do something intelligent. In addition, Bolo is a real-time game, making it all the more interesting to real-time programming weenies such as myself.
A huge number of brains were written for Bolo. There were normal bots that tried to play like a human such as Indy, aIndy, and Ladmo, bogs which allowed human control over the tank but helped that human play better, and specialized brains that did things like record quicktime movies of the game. I never wrote anything that I released, but I did make a modification of Indy so it could play a specialized type of game called Tix Tox Pillbox, and I worked on a game recorder that was never finished. The idea of being able to write a brain on OS X with comparatively huge CPU speeds and things like preemptive threads is very appealing to me.
The existence of borgs is one of the reasons nuBolo doesn't support brains. There were some pretty nasty borgs back in the day that tried to hide their existence to provide the player with a hidden advantage, and some that just outright cheated by fiddling with Bolo's private variables.
I came up with a design that helps to eliminate those concerns, nuBolo's author accepted it, and now I'm actually implementing it. The major change in architecture is to move everything brain-related into an external brains server. This server will run as a separate application, and all of the brains will be loaded into it. nuBolo will send game data over mach ports, which will then be handed over to brain plugins. The commands generated by brain plugins will be sent back to nuBolo over mach ports, and then executed in nuBolo. Mach ports are reasonably lightweight, and this separation means that a brains plugin can't touch nuBolo's private variables*.
Another big change is that substantially less data will be provided to the brains. Bolo provides more data to brains than it actually provides to human players, even when its "brains advantage" checkbox is turned off. This helps make brains smarter, but it makes it trivial to cheat by simply writing a borg that reports this extra data to the human, and does nothing else. nuBolo will provide almost exactly the same data to the brains as it does to a human player, eliminating this problem**.
Currently the code is still in the relatively early stages. The code that will eventually be in nuBolo is working and reasonably complete. The server is implemented enough to talk to nuBolo and send data back and forth, but there's currently no plugin interface. I think the communications code was the hardest part, and that's basically done now, so the rest ought to be straightforward.
Stay tuned for more.
* Yes, I know there are lots of other ways to get code and data into a process you don't own, so there's no need to remind me.
** The main exception is that brains get the entire viewable area around the tank without needing to scroll. Since a brain could scroll fast enough to simulate this anyway, it makes no real difference, and substantially simplifies brain programming.
Comments RSS feed for this page
Add your thoughts, post a comment:
Spam and off-topic posts will be deleted without notice. Culprits may be publicly humiliated at my sole discretion.