Home > battle_bots_js

battle_bots_js

Battle_bots_js is a project mainly written in JAVASCRIPT and RUBY, it's free.

For fun and workplace warring

Closer... now the arena spins up, etc..

NEW TODO: write the arena code to update all the objects on each pass move. check for collisions. If collided - mark as 'dead'. if you go off the edge of the screen u r dead.

TODO: Write Arena WebWorker. It takes moves in as events, then postMessages back to the DOM with the new coordinates of all the things on the page. postMessages the visibility updates for each bot postMessages the display state

Write Arena Renderer. catches messages from the arena - takes the data and draws it

Workflow:

[ Bot ] [Arena] [Renderer] start <--- update_map <--- update_positions ---> desired move ---------> update whole display <--- update ---> desired move RECALCULATE ---------> update the whole display

The map can be updated with a message to each bot - so that eventually one could have deformable terrain. It is simply a 1024 x 1024 array of ints. ( 4 MB! :))

BOT API: in: update_map in: update_viewable_data Has a list of features that are visible and current status: health, shield, current power ratings, turret angle, any tanks in the cone of vision. out: desired_action turn turret to angle X (we'll slew until we get there) desired speed (we'll change until we get there) fire laser (fires in current direction) use special power (they have to have some cost for energy)

The idea is simple... Who can write the quickest, most effective AI in the whole office?

The battle field will be a simple rectangular area -- with or without obstacles.

You get a battle bot to configure and then maneuver.

Your AI will be a webworker.

It does a few things:

on startup - it just initializes the game environemtn. then starts an event loop - providing the visible world state to the bot, and getting a command back. The faster a bot can decide what to do - the more commands he can complete. So calculating a ton of stuff is not normally a great idea.

Then it provides to each battle bot an update of the environment THAT THEY CAN SEE.

The battle bot can then take that info - do whatever processing it wants to and then postMessage back the thing that you want to do.

you can do any number of things at each response. you can turn, fire, or try to set your speed to a certain value (m/s)

Firing is simply drawing a line from your tank at your current orientation to infinity - and seeing if it hits the other tank. the more powerful your shot - the wider the beam (and more destructive). accuracy decreases with speed (a delta on the angle you are shooting with).

You have unlimited ammo - but your laser cannon regharges itself at a given rate. The faster you are moving, the slower your cannon recharges. You have a maximum speed, and a maximum rate of accel / decel. so you set the speed, and we'll get as close as we can for you.

Previous:VectorDrawable