Can I write my bot's code in my own editor or IDE?
Your bots' code files already live on your own computer, so you can edit them in any editor. The stubs make your editor understand the bot API.
What's in the downloads
Brain code's API tab has a download for each language, and one with them all (thebotslam-stubs.zip):
- Python:
bot.pyi, for VS Code (Pylance) and PyCharm. - JavaScript:
bot.d.tsandjsconfig.json, for VS Code and WebStorm. - Lua: annotations for the Lua extension (LuaLS) in VS Code and other editors.
- C++:
Bot.h, for VS Code, CLion and the Arduino IDE. - Java: the
botpackage's classes, for IntelliJ IDEA, VS Code and Eclipse. - C#:
BotArena.csand a project file, for Visual Studio, Rider and VS Code. - Assembly: every part's include file and the standard library (
std.s,notepad.s). - BASIC: the reference (BASIC has no classes to stub).
Every download has a README.md saying how to set it up, and a REFERENCE.md with the whole API, the same as Brain code's Reference. The Reference's IDE stubs link takes you to the API tab too.
Working this way
- Unzip your language's download and copy your language's stub files into the folder with your bot's code (or follow the README to point your editor at them).
- Write and edit your bot's code in your editor.
- In Brain code, click Open file… and pick your file. In Chrome and Edge, Brain code stays connected to it: save in your editor, switch back to the browser, and Brain code reloads the file by itself (as long as you have no unsaved changes to it in Brain code). In other browsers, open the file again after each change.
- Test it in the Test arena as usual.
Things to know
- Each language in thebotslam is a subset made for a small bot CPU. Code your editor is happy with can still be turned down by the game's compiler; Brain code says why, with the line number.
- The stubs follow the game's current API. Download them again after updates.
- Pair this with GitHub to share code with a group: see How does a group of us build and code a bot team?.