A JavaScript programming game: you code the robot, it fights on its own
In Tanklang you write the "brain" of a tank in JavaScript and it battles on its own, in real time, against other players' robots. It is free, runs in the browser and needs no install.
Click buttons, change speed and shot power, and watch the code change instantly.
How it works
- Write the robot
A code editor in the browser, with autocomplete. First-time coders start with the no-code builder and then tweak the generated code.
- It fights on its own
Your robot enters duels, team battles and automatic battles against other players, even while you are away. Every battle becomes a replay.
- Improve and climb
Watch the replay, adjust your strategy and climb the ELO ladder. The campaign has bosses only good code can beat.
A real robot in a few lines
This robot drives in a circle, sweeps its radar until it finds the enemy, locks its aim on it and fires. It is the same code as the test arena on the home page.
const SPEED = 5; // 0 to 8
const TURN = 4; // degrees per tick
const POWER = 2; // shot power
let me;
const shortest = (a) => ((a % 360) + 540) % 360 - 180;
function run(snapshot) {
me = snapshot.self;
setSpeed(SPEED);
turnBody(TURN);
turnRadar(45);
}
function onScannedRobot(event) {
const enemy = me.heading + event.bearing;
turnRadar(shortest(enemy - me.radarHeading));
turnGun(shortest(enemy - me.gunHeading));
fire(POWER);
}
What you learn by playing
- Programming logic: conditions, loops and decisions at every moment of the battle.
- Variables and constants: speed, turn rate and shot power become numbers you tune.
- Functions and events: the robot reacts when it sees the enemy, gets hit or bumps into a wall.
- Hands-on geometry: angles, heading and distance to aim at a moving target.
- Object-oriented programming: structure your robot with objects and classes and keep state between ticks.
- Debugging: the replay shows every event of the battle so you can see what went wrong.
Who it is for
A concrete reason to write code: watching your own robot win.
A logic or educational robotics class where students code and compete, with nothing to install.
Strategy, algorithms and optimization in plain JavaScript, with a ladder and tournaments.
The same idea of programmed robot battles, now online, in the browser and in JavaScript.
Tanklang and Robocode
Robocode is the classic robot battle game programmed in Java. Tanklang is inspired by it, with differences: it runs right in the browser, robots are written in JavaScript, battles happen online against other people's robots, and there is an ELO ladder, a campaign with bosses and team battles. Tanklang is not affiliated with the Robocode project.
What is in the game
- 1-vs-1 duels and team battles up to 4 vs 4
- A campaign with stages and bosses
- Per-robot ELO ladder with tiers
- Automatic battles: your robot plays even when you are away
- Official and player-made tournaments
- Parts you earn by playing (never sold) and cosmetic-only skins
- No-code builder and AI code generation
- 6 languages: Portuguese, English, Spanish, Japanese, Chinese and Korean
Frequently asked questions
Is Tanklang free?
Yes. Playing, building robots, battling, joining tournaments and climbing the ladder are free. There is an optional Premium Pass with cosmetics and convenience, and it never makes a robot stronger in battle.
Do I need to know how to code?
No. You can start with the no-code builder or the test arena on the home page and change the code little by little.
Which programming language does it use?
JavaScript, the language of the web. The code runs isolated on the server, with the same rules for everyone.
Is it like Robocode?
It is inspired by it: programmed robot tanks that fight on their own. The difference is that Tanklang is online, in the browser and in JavaScript, with a ladder, a campaign and team battles.
Can it be used in programming or robotics classes?
Yes. Students code in the browser with nothing to install and can compete in a tournament created by the teacher.
What is the minimum age?
13. Accounts for ages 13 to 15 need a parent or guardian's permission, and purchases by anyone under 18 are always paid by the guardian.
Does it work on phones?
Yes, in the browser on a phone, tablet or computer. For writing code comfortably, a computer is better.
Your first robot takes 1 minute
Try the arena now, no sign-up. If you like the robot you built, it becomes the first robot on your account.
Try the arena now (no sign-up)