VbRoboCode: How it works

In VbRoboCode, each robot consists of three moving parts: a chassis for moving about the arena; a radar for detecting enemies, and a gun for shooting. Your code controls how these parts are moved and when the gun is fired.

When you run VbRoboCodeStartup.exe, it creates a list of robots to place in the arena. Right now, you have two options for placing a robot into the arena:

  • Hard-code an addition to the list of robots in VbRoboCode.Startup.Init, like this:
    robots.Add(New Landmine)
  • Copy your robot’s dll from your build library to the bin directory of VbRoboCodeStartup project, for example:
    VbRoboCode\VbRoboCodeStartup\bin\Debug

It is safe to copy and execute somebody else’s robot dll, even if you don’t have the source code for review. VbRoboCode executes all of its code in a sandbox with minimal permissions. No access to the disk or registry is allowed; any attempt will cause an exception.

Each robot is composed of a public area that you can control, and a private area that the simulator controls.

After VbRoboCodeStartup handles all the startup tasks, the simulator starts running. Every time the idle event occurs the simulator runs one step. At each step, the following tasks are performed:

  • Every robot’s gun is cooled.
  • Bullets that have gone “out of bounds” are removed.
  • Any completed explosions are removed.
  • Your robot is given a chance to plan its move by executing instructions like “Forward”, “GunTurnRight”, “Fire”, and so on (see Events, Methods, and Properties). This is done via RobotPublic.PlanMove.
  • Any dead robots are removed.
  • Existing bullets are moved.
  • The robots are moved.
  • New bullets are fired.
  • Radar scans are taken.

At each task along the way, events (like OnBulletFired, OnWallHit, OnRobotDied, etc) are generated and (optionally) handled by custom code in your bot.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Facebook
  • Google
  • Reddit
  • StumbleUpon
  • Technorati

Leave a Reply