Download presentation
Presentation is loading. Please wait.
Published byDennis Warren Modified over 8 years ago
1
AI and Game Programming Unreal Tournament Project
2
Introduction UT is a FPS The competition Domination mode Domination points Teams of 3 bots First team to 100 points wins
3
Getting Started Installation: UT standalone server GameBots ActiveTcl TclViz JBuilder Foundation Javabots JRE v1.5.0_05 Misc.
4
Running an Experiment 1. Start the server 2. Start the vis. tool 3. Start Javabot
5
Creating a Bot Copy your BotTemplate.java to the directory: C:/…/jbproject/javabot/src/edu/lu Change the file name to.java Start JBuilder Foundation Open the Javabot project (javabot.ipx) Select the package edu.lu If.java does not appear, refresh the project Edit the template Rebuild the project
6
UT Basics All units are absolute UT units – no bearing to real world units Bot’s collision cylinder: 39 units tall with a radius of 17 units Full rotation: 65535 Radians: (UT_Rotation_Amt / 65535) * 2π Locations and Orientations x,y,z pitch, yaw, roll up and down, side to side, cartwheel
7
Server Messages Format: MSG_TYP {ATTRIB_TYP ATTRIB_VAL} {…} Ex. DOM {Id 1} {Location 23,43,13} {Controller 1} Attribute values returned as strings 2 Types of Messages Synchronous Asynchronous
8
Server Messages cont. Synchronous Messages: Sent in batches at regular intervals First message is type BEG, last is type END Constitute one atomic game state Ex. Visual updates, bot status reports Asynchronous Messages: Single messages, generated as events occur Cannot arrive during sync. message block Ex. Took damage, picked up a weapon
9
Client Commands Use same format as server messages Commands have persistent effects Ex. Start shooting, keep shooting until a stop shooting command is sent
10
Programming 2 Tasks, 2 Threads Message handling FSM Message Handling – two functions receivedSyncMessage() receivedAsyncMessage() FSM – one function runner.run()
11
Programming cont. Multithreaded: One thread handles messages One thread handles the FSM (runner) May need to use semaphores (synchronized) to avoid race conditions and such protected Object stateLock = new Object(); someMethod() { … synchronized (stateLock) { // shared variable manipulation }
12
Programming cont. Handling messages: Message m; String type, value; type = m.getType(); switch(type) {…} value = m.getProperty(PROP_ID);
13
Programming cont. Most commands can be sent with existing function calls (ie. runTo(x,y,z) Manually sending commands: Properties props; props.setProperty(ATTRIB_TYP,ATTRIB_VAL); client.sendMessage(MSG_TYP, props);
14
Random helpful info. edu.isi.gamebots.client.GamebotConstants, contains definitions of all the constants for MSG_TYP, and ATTRIB_TYP Use log() to print to the Javabot text area Note: change enableLog to false before submitting your final bot (or manually delete all your log() calls)
15
Server Adminstration You can set server settings and monitor your server through a web browser. After starting the server open a browser and connect to: 127.0.0.1:8888/Administer Username: Admin Password: Admin
16
Random helpful info. Sync. message blocks contain DOM messages Contain the coordinates of a domination pt. Tells who controls the domination pt. Use getPath(x,y,z) to get directions to a DOM pt. IMPORTANT: must tell the javabot client about your bot! Open edu.isi.gamebots.client.BotRunnerApp Locate the knownBots data structure Add the full name of your bot to the array
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.