BASICS

Welcome to my (Austin Barton's, not Kevin Hertzberg's) tutorial on how to program a robot for Robowar. If you have any questions that are unanswered on my Robowar page please go to the HELP section.


Creating A Robot
Here are the instructions to create a robot:

  • Open Robowar
  • Select File > New
  • Type in a name for your robot
  • Select the directory you wish to save the robot in
  • Click Save

    You have your robot now for the programming. To program this robot you must open the drafting board which is located under VIEW. The typing area is basically the heart of your robot. Except now it is empty. Everytime you make a change to your robot remember to compile it or it won't notice. Compile is found under VIEW.


    Labels
    To create a robot you must have labels. There is no way around not using them. Labels are used to jump to different parts of the program. To define a label it must always be followed by a colon (:) and when directing the program to a label ommit the colon. When using a label make sure you use a name that Robowar doesn't use and usually something to help you remember what that label is for. Here are bad label names:

  • Fire:
  • Jump:
  • 4356:

    The first two, Robowar reserves. The last one leaves no clue as to where it will take us. But if thats how you want to do it, go for it. Now for good label names:

  • GoingUp:
  • ISeeRobot:
  • SoloMode:

    A few pointers. You can't use the same label name twice in a program. However you can jump to a label as much as you want. Labels can't be over...I believe 20 characters long.


    If & IFG Statement, Return, & Jump
    The IF & IFG statements are absolutely neccesary if you are to ever program a "good" robot. There are used basically to check two or more numbers. Here is the setup of a IF or IFG statement.

    Number1 Number2 Operator Label IF or IFG

    And some examples:

  • 5 3 > YesItIs If
  • x y = LetsKillEm Ifg
  • range radar ! DieDieDie If

    If the statement is true then it goes to the desired label if not it continues on with the program. So on the first example we have IF 5 > 3 GOTO YesItIs That is true so the program would go to the label YesItIs. The second one, IF X = Y THEN GOTO LetsKillEm On this one we don't know what x or y equals but variables can be used. On the third one ! stands for does not equal.

    Now to know the difference between IF and IFG. When jumping to a label from an IF statement it leaves an address so that later on we can go back to where it came from. And with an IFG statement it leaves no address so later in the future we couldn't go back to where it came from. That may sound confusing but the example robots should help you figure it out. When using an IF statement to return back we simply use a command called Return. With IFG we would use the Jump command. Here are two example robots using all we have learned:

    Example Bot Using If....Open Example Bot Using Ifg....Open
    Main:
    5 3 > YesItIs If
    Main jump

    YesItIs:
    #5 is apperently over 3
    return

    Main:
    5 3 > YesItIs Ifg
    Main jump

    YesItIs:
    #5 is apperently over 3
    Main jump

    These two robots do virtually nothing. Both loop meaning they keep running the code between Main and Main jump checking if 5 is over 3. When it is it goes to YesItIs. The # is used to put remarks in. These are usually to help you remember something or to comment. Don't worry we'll make a robot that will battle soon enough.


    Plus, Minus, Divide, and Multiply (+ - / *)
    These are plus, minus, divide, and multiply. When doing math in robowar it is slightly different from what we know. For example this is how we do math:

  • 1 + 3
  • 4 - 2
  • 100 / 10
  • 6 * 6

    In Robowar this is how it is done:

  • 1 3 +
  • 4 2 -
  • 100 10 /
  • 6 6 *

    In all these examples numbers are used. However variables can be used. If you would like here is a list of available variables and their uses.


    Fire & Missile
    Fire and Missile are both used to shoot. There are three different types of bullets for the Fire command.

  • Explosive
  • Normal
  • Rubber

    To choose which type of bullet to use you must pick this in the hardware store. This is located under VIEW. When using Fire or Missile this is the format in the way to do so:

    variable fire' sto
    variable missile' sto

    Examples:

  • 1 fire' sto
  • 15 missile' sto
  • energy bullet' sto

    Your robot has an amount of energy. This energy is used by moving, using shields, or firing. On the first example one unit of energy is used to fire a bullet. If you have Explosive bullets the amount of energy used is multiplyed by two for the amount of damage it will deal. Normal bullets are as the energy used and rubber is half the amount of energy. Missiles always do twice the energy consumed but move at a much slower speed. On the third example all of your robots current energy will be used to fire a bullet. The bullet is used when you have explosive bullets. When using this, instead of firing an explosive bullet you'll fire a normal bullet. This is used when a robot is close to the robot it is firing upon. With bullet there is no chance of being within the blast radius.

    I believe now you should have learned enough information to create a robot that can do something.


    Basic Robot....Open
    Main:
    range 0 > ShootEm if
    aim 5 + aim' sto
    Main jump

    ShootEm:
    10 fire' sto
    return


    If there are certain variables such as aim or range you don't understand check out
    variables. It lists the variables and their uses.

    Now that you have made your first robot, its time to look at the hardware store. There are different types of robots based on the points used in the hardware store. For now we'll be using 9 points which is considered a Mortal robot. Here you can pick different weapons, damage, shields, energy, and speed. Here are two robots, both have the same code, but each have different hardware settings. Take a look at each and try battling them against each other.

    Open Bot 1 vs. Bot 2 Open

    Remeber both have the same code and the same amount of points but notice how much better one can kill the other. Hardware settings can make a world of difference on a robot. You should notice that Bot 2 wins everytime. So when creating a robot its best to use your hardware points wisely. I would suggest before you go on reading to try creating a few robots knowing what you should now know.

  • A robot that fires different amounts of power based on its energy.
  • Try create a fast missile swarming bot.
  • Your own that can beat all of them!

    You've made those bots above? If you haven't I suggest doing so because now we're moving into something that really make your bot move. Have problems making the bots above? Open em! Energy Based Bot or Missile Swarmer.


    Speedx & Speedy
    Ready to make a bot move? You can do that using speedx and speedy. Speedx is the speedx your robot is going on the x axis. And speedy is of course the speed your robot is going on the y axis. For your information the arena is 300 x 300 pixels. Need a
    diagram of this? You set your speeds the same way you would to fire a missile or bullet.

    variable speedx' sto
    variable speedy' sto

    You can check your area in the arena with a simple IF or IFG statement. A few things about the two speeds:

  • Once a speed is set it will stay that way until changed.
  • The maximum speed in any direction (Up, Down, Left, or Right) is 20.
  • To move it cost 2 times the speed. So a sitting bot that changes to 4 speedy would cost 8 energy. And if that same bot then changed to -4 speedy it would cost 16 energy.

    Here is an example of a simple robot which goes up and down while still firing. I've decided you don't need to see my code anymore. But if you have real bad problems you can open this bot. Having problems killing those moving bots? Go to my shot leading part of my tutorial. This here ends the basics of Robowar. Want to make a better bot? A bot able to think quicker? Able use your own icons and sounds for your robot? Read the Next section of the Robowar tutorial.


    If you find an error in this site or have a suggestion please Email Me.