Tuesday, March 19, 2013

Beginner's guide to 'RTanque' Part:1

This guide covers how to make a very basic tank bot with 'RTanque'.

 (1) Making a basic 'RTanque' tank bot.

First and foremost go to https://github.com/awilliams/RTanque and clone the repo or, Adam has a Quick Start to get you started, which works well and is quick to set up.
The code below is how to make a basic 'RTanque' tank bot, that basically does 3 things:
(1) Shoots,
(2) Adjustable speed,
(3) Circles,will not get stuck against walls.
self.command.fire(0.25) can be adjusted from 0.25 to 5 to change your rate of fire, with the small the number the less frequent, but more damaging and high velocity shot or just set it to MAX_FIRE_POWER to make sure your bot only fires the hardest punching shot.
command.speed = can be adjusted with a number like -5 or 5, or just set it to  MAX_BOT_SPEED to make sure your bot is giving you all she's got.
command.heading = sensor.heading + 0.01 . if you decrease the 0.01 you will decrease the tightness of the circle.
class BasicBot < RTanque::Bot::Brain
 Getting Started With 'RTanque' Part:1 of 4

class BasicBot < RTanque::Bot::Brain
  NAME = 'basic_bot'
  include RTanque::Bot::BrainHelper
  def tick!
    ## main logic goes here
    # use self.sensors to detect things
    # use self.command to control tank
    # self.arena contains the dimensions of the arena
  def make_circles
  command.speed = MAX_BOT_SPEED # takes a value between -5 to 5 
  command.heading = sensors.heading + 0.01
This is an extremely basic, easy guide to making an 'RTanque' tank bot, however as the series goes along the final tank bot we'll be showing you how to make will be a force to be reckoned with. The tank is fittingly called "invincible". This is Part 1 of a 4 part series on 'RTanque' tank bot making. Cody Kemp @codesterkemp and myself Joshua Kemp @joshuakemp1 will be joint authors during this series.