Code for the decision-making algorithm created - The project will be graded on the following criteria:
Entity Generator Class
Finite State Machine Control
Program Run Length ~ 60 seconds
Program Statistics Display
Debugging and Notation
Activity 1: Design and code algorithms to generate and control AI entities.
Create a program that will perform the following using the methods described below.
1. Create an Entity Generator Class - This class should:
a. Create entities to be used in the game
b. Have the ability to handle different types of entities
i. AI Bot Type 1 (i.e. Person)
ii. AI Bot Type 2 (i.e. Car)
c. Create a unique ID for each entity
2. Create an Entity Manager – The Entity Manager should:
a. have the ability to add entities to an entity map;
b. have the ability to remove entities from the entity map;
c. have the ability to obtain a pointer to any entity in the entity map; and
d. be created using a singleton design pattern.
3. The program should have the ability to create more entities during run time.
4. The program should contain a Message Dispatcher that will sort messages based upon dispatch time, and deliver messages to AI entities at the appropriate time.
5. Each entity should have message-handling capabilities – should have the ability to:
a. dispatch messages
b. receive messages
c. send messages
6. AI units should be controlled by a Finite State Machine (FSM).
a. The FSM should have an enter(), execute(), and exit() method for each state.
b. The FSM should incorporate the message handling system developed in the project.
c. A single FSM class should be created along with a State class, which will contain the specifics for each state to be executed in the FSM.
7. AI entities should have the following states.
i. This state should last five seconds.
ii. Upon exit, AI entity should move to Death State.
i. This state should last eight seconds.
ii. Upon entry, a second AI entity should be created and put into the Birth State.
iii. Upon exit of this state, the AI entity should be removed from memory.
8. The program should run for a total of one minute.
9. Upon completion of program, the following statistics should be displayed.
a. Number of AI entities created
b. Amount of AI entities that were deleted
c. Total elapsed run time of program
10. Messaging should be used to tell entity to change state.
a. Upon entering a state, send a message to self to show the amount of time delay that the state uses.
b. Upon dispatch and receiving of message, entity will then update to the appropriate following state.
11. Send output to the screen upon the completion of each state. This output should state:
a. Which entity is talking
b. What the entity has finished doing
c. Where the entity is going
12. The project should be created using a graphical API (DirectX, DarkGDK, etc) and should give visual confirmation of the AI entities moving from states.