YSU CSCI 5895 - Assignment 3: Influence Maps

Unformatted text preview:

CSCI 5895: Artificial Intelligence Methods for Game DesignAssignment 3: Influence MapsDue Wednesday, November 9IntroductionYou are to design a set of influence maps for three different types of non-player character “vehicles” that are part of a “tower” game. non-player characters that acts as “guardbots” based on combinations of the steering behaviors that I described in class, and implement those influence maps using a C++-based engine that I have provided.The Game Environment and RulesAs with most “tower” games, the goal of the player is to prevent a series of NPC “vehicles” fromreaching a goal. The player does this by placing different types of “towers” on the board which fire at the vehicles, ultimately destroying them if they do enough damage.In this case, the vehicles (marked C, B, and H) start at far left side of the board and attempt to reach the “goal” (marked G) on the far right side of the board. The different types of towers (marked G, L, and M) fire at them as they pass by. The board itself is 9 x 10 tiles.We will make the following simplifications to the typical tower game:- The board contains exactly 5 towers, all placed in advance (that is, towers will not be added during the game play).- The game consists of a single “wave” of 10 vehicles. A new vehicle (with a type determined at random) enters the board each turn at a random row in the far right column of the board.- Vehicles can occupy the same tile as towers or other vehicles. That is, the towers cannot be used to block vehicles (which would add a major path planning component to the problem).VehiclesThere are three different types of vehicles, which move at different speeds and have different levels of initial “health” levelsCruisersA new vehicle is a cruiser (marked C) with a probability of 50%. Cruisers have an initial health of 7 and move one tile per turn.BattleshipsA new vehicle is a battleship (marked B) with a probability of 25%. Battleships have an initial health of 10 and move one tile per turn.HydrofoilsA new vehicle is a hydrofoil (marked H) with a probability of 25%. Hydrofoils have an initial health of 4 and move two tiles per turn.TowersThere are three different types of towers, which have different ranges, fire rates, and inflict different types of damage. Each time a tower fires, it fires at the closest vehicle to it within its range (if no vehicles are in itsrange, it does not fire), and the health of that vehicles is decremented by the damage it does. There are a couple of exceptions noted below to add some interest.Gun TowersA gun tower (marked G) has the following properties:- Has a range of 2 tiles beyond its location.- Fires every turn.- Does damage of 1 to the vehicle it hits.Laser TowersA laser tower (marked L) has the properties:- Has a range of 3 tiles beyond its location.- Fires every turn.- Does damage of 1 to the vehicle it hits.However, a laser tower cannot damage battleships. Because of this, it instead fires at the closest ship of some other type each turn.Missile TowersA missile tower (marked M) has the properties:- Has a range of 3 tiles beyond its location.- Fires every other turn.- Does damage of 2 to the vehicle it hits.In addition, a missile also does “collateral damage” of 1 to any vehicle adjacent to the vehicle it fires at.For diagnostic purposes, the game also displays which vehicle each tower is currently firing at, and the current health level of that vehicle. For example:Vehicle Movement and Influence MapsThe game contains 3 influence maps (one for each type of vehicle). For diagnostic purposes, these can be displayed during gameplay by entering either c, b, or h at the prompt for the next move. For example, a possible influence map for Cruisers is shown below:These influence maps control the next adjacent tiles that all ships of that type move to – specifically, they move to the adjacent tile with the highest influence value. For example, the cruiser in the second row above will next move left to the tile with influence measure 47, while the one below it will move down to the tile with influence measure 49.Defining Influence MapsYour role in this game is to design and implement code to compute the influence maps for each of the three types of vehicles.The Tower.cpp FileI have provided on the course web page a C++ file containing the game engine. At the bottom of the file is the code that you will need to modify. These methods are:void Cruiser::computeMap(float map[COLS][ROWS], Goal goal, Tower towers[TOWERS], Vehicle vehicles[VEHICLES])void Battleship::computeMap(float map[COLS][ROWS], Goal goal, Tower towers[TOWERS], Vehicle vehicles[VEHICLES])void Hydrofoil::computeMap(float map[COLS][ROWS], Goal goal, Tower towers[TOWERS], Vehicle vehicles[VEHICLES])These methods are called each turn to compute the influence map for cruisers, battleships, and hydrofoils respectively.The Tower, Vehicle, and Goal objectsEach of these methods takes all of the objects on the board as parameters, as all of them may influence a vehicle:- goal: object corresponding to the goal location the vehicles are trying to reach- towers: array of all TOWERS towers (including gun, laser, and missile) - vehicles: array of all VEHICLES vehicles (including cruisers, battleships, and hydrofoils)Each of these objects have methods to get their location of the board:- int getX(): returns the column- int getY(): returns the rowVehicles and towers also have methods to get the type of vehicle or tower: - char getSymbol(): for Vehicles returns either ‘C’, ‘B’, or ‘H’ - char getSymbol(): for Towers returns either ‘G’, ‘L’, or ‘M’Finally, if you want to know whether a vehicle is actually on the board or not, you can use - int isMoving(): returns 1 if the vhicle is on the board, 0 otherwise.You can also use the constants defined at the top of the file in your code to directly use some of the relevant tower properties in you code:#define GUN_RANGE 2#define GUN_DAMAGE 1#define LASER_RANGE 3#define LASER_DAMAGE 1#define MISSILE_RANGE 3#define MISSILE_DAMAGE 2#define MISSILE_RATE 2I have also provided a very useful support method that computes the distance between two tiles (x1, y1) and (x2, y2), which you will need if you are basing influences on distances:float distance(int x1, int y1,


View Full Document

YSU CSCI 5895 - Assignment 3: Influence Maps

Documents in this Course
Load more
Download Assignment 3: Influence Maps
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assignment 3: Influence Maps and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment 3: Influence Maps 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?