OOBA

Object Oriented Bot Architecture

Tutorial

The OOBA Directory Structure

ooba/
  java     -- java packages
    edu
      lehigh
        ooba
          bot
          event
          example
          unreal
          util
		

Creating an Explorer Bot for Unreal Tournment

The first step in creating a new bot is to go into the example directory and create a new directory nameing after the new bot. In this example we're creating a bot named Explorer so we'll create a new directory named Explorer under the example directory.

In the Explorer directory we need to create one more new directory named event, where all the event handlers for this new bot will be stored.

Create a new file named Explorer.java in that file we define our main and include in our Explorer class the type of bot we're going to be using. In our case we're using a utBot.

Explorer.java

package edu.lehigh.ooba.example.Explorer;

import edu.lehigh.ooba.bot.Bot;
import edu.lehigh.ooba.example.Explorer.event.*;
import edu.lehigh.ooba.unreal.*;

public class Explorer {

// java -jar   utbots*.jar  for the VIZ client
// edu.isi.gamebots.examples.ExampleVizTool
  public static Bot explore;
// Args:
// 1. host
// 2. port
// any other ideas?
  public static void main(String[] args)
  {
    System.out.println( "Creating New Bot" );
    explore = new utBot();
    if( args.length == 0 ){
          explore.setServerInfo("localhost", 3000);
    }
    else{
          explore.setServerInfo(args[0], Integer.parseInt(args[1]) );
    }
    System.out.println( "Server info set to ip=" + args[0] + "port = " + args[1] );
    explore.setBotName("Explorer");
    explore.setBotTeam(1);
    
    explore.setEventHandler("BEG", new Status() );
    explore.setEventHandler("NFO", new GameStart());
    explore.setEventHandler("RCH", new CheckResult());
    
    System.out.println( "all handlers set" );
    System.out.println( "Opening connection to server" );
    explore.connect();
    System.out.println( "Connection established bot is active" );
    
  }
}