The days of writting bots like banbot or cookiebot had long passed, and I had a large lobby project to pull code from. Having separated out the core components of my lobby into a separate library, I sought to create a bot as an example. This bot would be fully Object Oriented and show how easy to write it was. All in all the bot took 20 minutes to write build and test.

iBot had a central class holding everything together that everything had a reference to. There is a message routing class CCore, and 3 modules that the central class creates and registers to it. These 3 classes CBasicBotCommands CMegaHalBot and CInitializer implement the bots logic.

CInitializer creates the other 2 modules, connects to the server using the SDK, and logs in. CBasicBotCommands implements a minimal command set allowing the bot to be commanded to leave and join channels, as well as disconnect and shutdown. CMegaHalBot contains an instance of JMegaHal, a chat implementation consisting of a 4th order markov chain based AI. Details on the JMegaHal library.

Leave a Reply

Your email address will not be published. Required fields are marked *