Do I need to know how to code to play?
thebotslam is programming for fun, whether you're writing your first loop or your ten-thousandth. Here's how to start if you've never coded.
Start with the tutorial
Click Tutorial in the menu bar. It takes about 20 minutes. You build a machine from parts, then write two short Python programs: a target that sits still, and a hunter that finds it, drives up to it and fires. A panel tells you what to do at each step, and a ring shows you where to click.
The first program you type is just this:
from bot import wait
while True:
wait()
while True: means repeat forever, and wait() means I'm done for now. The game moves in small steps, 20 a second, called ticks. At each wait(), your bot's commands go out to its parts and fresh readings come back. This bot does nothing but wait, which makes it a perfect target.
Pick a language that suits you
Above the editor in Brain code, the League list picks the language. For beginners:
- Python reads almost like English. It's what the tutorial uses.
- Blocks lets you snap blocks together instead of typing. Brain code can also show your blocks as the same program written in Python, so you can see what real code looks like as you go.
Experienced programmers can pick JavaScript, C++, Java, C#, Lua, BASIC or assembly instead.
Learn from working programs
You don't have to start from an empty page. The Start from… list above the editor offers a blank program with every part already set up and an empty loop, and the house bots' programs in the language you've picked. Open one, run it in the Test arena, and change things to see what happens.
Look things up as you go
The Reference under the editor lists everything each of your bot's parts can do. A ✓ under the editor means your program compiles. If it doesn't, Brain code lists each error with its line number: click one to jump to that line.