Jump to content
Mr. Green Gaming

BotBattle - Coding project


Mayco

Recommended Posts

Posted

Currently used AI: Sample AI - Mayco

Original thread at Facepunch

BotBattle Website

BotBattle - AI Coding Project

Basically, the goal of BotBattle is to code the AI for your bot, and letting battle against other bots. Just to end up on #1 in the leaderboards, or just to show off your coding skills.

I thought it'd be fun to make this a simple coding project everyone at Left 4 Green can help with, seeing how simple the code is.

These are the rules:

  • Only I have access to the account for now. This is to prevent people from "updating" the AI with crappy code. If you want access too, contact me and I'll think about it. I'll check if the code is valid first, and if it is, I'll update the bot.
  • Try not to remove other people's valid entries. You can make them better if you want to.
  • Post "Locked" when you start working on the AI, and "Unlocked" + the AI + a changelog when you're done.
  • Use CODE tags when you post your AI.

I think that's everything for now!

Example script (currently used):


name: GreenBot;
version: 0.01;

chassis: green;
wheel: green;
turret: green;

startai;

label: main;

if: this_ammo = 0;
goto: find ammo;
end if;

if: this_health < 50;
goto: find health;
end if;

goto: attack;

goto: main;

label: find ammo;

if: ammo_dir > 8;
turn: left;
goto: find ammo;
else;
if: ammo_dir < - 8;
turn: right;
goto: find ammo;
end if;
end if;

move: forward;

goto: main;

label: find health;

if: health_dir > 8;
turn: left;
goto: find health;
else;
if: health_dir < - 8;
turn: right;
goto: find health;
end if;
end if;

move: forward;

goto: main;

label: attack;

if: enemy_dist > 192;

if: enemy_dir > 8;
turn: left;
goto: attack;
else;
if: enemy_dir < - 8;
turn: right;
goto: attack;
end if;
end if;

move: forward;

goto: attack;

end if;

if: this_turretang < enemy_dir - 4;

turnturret: left;

else;

if: this_turretang > enemy_dir + 4;
turnturret: right;
else;
shoot;
end if;

end if;

goto: main;

The code can be edited with notepad or pretty much any .txt editor. Save it as a .txt file!

Documentation for the coding language can be found here.

Good luck!

Posted

I worked a little on this last week, just after the thread came on FP. Pretty fun. Wasn't very motivated to go on though.

Also, spamming the move: forward command will make your bot go faster.

Posted

I have "released" my own bot (FailBot) into the wild. Nothing special, just the example script with some minor tweaks. It's not very bad though, it won 15 and lost 21 fights so far.

Posted

I don't like the syntax.

Can't expect a single programmer to make a professional interpreter. It's quite an achievement still.

I don't see a problem. Adding Lua support to a C++ project is like a hour work.

Posted

I think his main goal was to keep the code simple. And this way it is. It's not hard to learn at all, unlike LUA. LUA might be pretty easy to learn too, just not as easy as this, because this code is VERY basic (goto, turn, this_ammo etc).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...