Currently, I am in the process of developing scripts for Bot Land, a real-time strategy game that offers a unique gameplay experience. Rather than controlling units traditionally with a mouse and keyboard, players code their bots using an API to engage in battles against other players' bots. The game allows you to create bots resembling familiar units from SC2 such as blink stalkers, siege tanks, medics, and ultralisks.
The complexity of bot control in Bot Land increases gradually with three levels: default AI, a Scratch-like programming language, and BotLandScript—a reduced set of JavaScript. While coding in BotLandScript is manageable, it has limitations like uploading all code as one single file with global functions across bots, causing inconvenience when dealing with lengthy codes or shared functions among different bots.
To mitigate these challenges and enhance my performance, I structured a TypeScript project on GitHub to provide a common library and codebase for each bot. The directory layout includes:
lib/
bot.land.d.ts
common.ts
BlinkStalker/
BlinkStalker.ts
tsconfig.json
Artillery/
Artillery.ts
tsconfig.json
SmartMelee/
SmartMelee.ts
tsconfig.json
In this structure, 'lib' contains shared code and TypeScript definitions, while each bot has its folder housing the bot code and a 'tsconfig.json' file defining compilation options.
Despite the current setup being functional, certain drawbacks exist, such as redundant boilerplate, complexity in adding new bots, unnecessary bloating of output files, and separate building processes for individual bots.
The challenge lies in finding an optimal solution catering to the following requirements:
- Adding new bots without additional boilerplate
- Utilizing 'import' for common functions to minimize unused code generation
- Maintaining a single file output format required by Bot Land
- Implementing a unified build step for multiple output files per bot
- Optionally integrating the build process with VS Code through tasks automation
While solutions like Grunt and tsc may hold potential, further exploration and expertise are needed to find the most effective approach for streamlining the bot development process in Bot Land.