Software requirement
In order to get Special Forces up and running, you will need to do the following:
- Get and install a C# Editor. I recommend Visual C# 2008.
- Get and install XNA Game Studio 3.1.
Both can be found at http://creators.xna.com/en-US/downloads
Get Start
Once Visual C# and XNA have been installed, open the project labeled ShooterProject inside the TDS AI folder. You should be able to run the game once it is open (make sure shooter project is selected as the active project if it is not). To start a BotOnly game:
- 1) Start the game (simply run the project)
- 2) Press Space or Enter to advance past Title Screen
- 3) Use the Arrow Keys to navigate to Style of Match (Down twice or up once)
- 4) Use the Arrow Keys to change the Style to "Bots Only" (Right four times or left once)
- 5) Press Enter or Space to advance to next screen
- 6) Select Bots to play
- To select a Bot, Choose a team by pressing left or right (moving the controller image to either side of the screen ) and a BotType by pressing up or down.
- Press Enter to confirm Bot selection, Press Backspace to undo a bot selection.
- Eight Bots must be accounted for before a game will start, if you want to play a game with less than eight bots, choose Empty as the BotType and leave the controller image in the middle of the screen.
- 7) Once all Bots have teams and types selected, press enter to start the match
- 8) The game will run until a team has 25 points
- 9) When game is over, a black screen with stats will show up, press enter to return to main menu
Create a Bot
- 1) Make a new class in the SharedContent class that extends the AI class
- 2) Use BasicBot as a guide as to which methods need to be overwritten and how to do that in C
- 3) Edit the following in the AI.cs file
- Add the name of your bot (Whatever you want to show up on the menu screen) to BotNames located in the AIHelper class in AI.cs
- At the same index as you added in BotNames, add a variable to the Bots enum which represents your created bot
- Add a new case to the function CreateBot in AIHelper which returns an instance of your bot, use the case for BasicBot as a guide
- 4) Make sure to follow all of the guidelines presented in the comments at the top of the AI class
- By default, all BasicBot are Infantry at the very beginning. But you can create to constructor to change this behavior.
About C#
- Useful shortcut:
- F12: Go to definition
- Shift+F12: Displays a list of all references for the symbol selected.
- Ctrl+J: List Members
- You may want to download a shortcut reference here: Visual C# 2008 Keybinding Reference Poster
Detect other robots
- All characters have global visibility. One robot is invisible only if it has a invisible pickup effect.
- AI.numCharacters()
- Returns the number of Characters in the game
- Use AI.getCharacterOrientation(int i) and AI.getCharacterPosition(int i) to get the orientation and position information.
- If the character is currently Invisible it returns the Vector2(-1,-1) which is not located anywhere on the map
- AI.isCharacterFiring(int i)
- Returns true if the character has fired within the past turn.
- You may use it to estimate the path of a projectile.
Detect Obstacle
Detailed example can be found in BasicBot.cs. The following methods give you the ability to detect any obstacle in the map.
- AI.numObstacles()
- Returns the number of obstacles in the game
- AI.getObstacleCircleBounds(int i)
- Returns the bounds of an obstacle if the obstacle is a Circle. If the object is not a circle, this returns null.
- AI.getObstacleRectBounds(int i)
- Returns the bounds of an obstacle if the obstacle is a Rectangle. Will return a Rectangle of dimensions = 0, pos = 0 if the object is not a rectangle.
Move and Orientation
- The movement of your robot is independent of its orientation.
- AI.setNextMove(Vector2 move);
- Vector2 move is just an orientation indicator. You actually movement is depend on this value and speed of your robot (which you cannot control).
- You can control your facing orientation by set a new value to the field variable Orientation.
- Example: this.Orientation = (float)Math.Atan2((des.Y - Position.Y), (des.X - Position.X));
Fire
- You bot can use Fire() method, which is inherited from Character class, to fire bullets. This method do not take parameters. If the weapon has cooled down, this method fires a bullet or a list of bullets in the direction that the player is facing, with a variance of accuracy.
Damage
- No friend damage for any kind of bullet.
- Normal damage: hit only the closest object
- Pierce: bullets pierce some walls and one shot may kill several robot.
- Explosion: will equally apply to every robot within that range. In this game, only Rocketeer has explosion damage of 100 points.
Pickup and its Effects
- A pickup is an object on the game field that when a player collides with it, bestows a status effect on the player for a short period of time(10 seconds).
- Effect Types: "Slow", “Fast”, "Inversion", "Invisible", "Invincible“
- You probably want to avoid "Slow" and "Inversion" pickup.
- Spawn a pickup every 15 seconds.
Characters
- There are six different Characters: Pyro, Sniper, Melee, Infantry, Scout, Rocketeer
- You can find all following information from Globals.cs
Health
Damages
FireRates
NumBullets each time
Damage per second
Explosions
Pierce
ProjectileSizes
BulletSpeed
MaxRange
MovementSpeed
Infantry
100
10
0.08
1
125
0
TRUE
1
1500
500
6
Rocketeer
100
0
2
1
0
radius:250
damage:100FALSE
30
625
4000
6
Melee
125
100
1
1
100
0
FALSE
15
1500
30
12
Pyro
125
1
0.005
5
1000
0
FALSE
5
525
200
7
Scout
75
25
1
5
125
0
FALSE
1
2500
300
10
Sniper
100
75
1
1
75
0
TRUE
1
3000
5000
4