top of page

Finite State Machine Demo

  • itzvnodm
  • Oct 24, 2014
  • 2 min read

1. Created a square grid at least 20x20 nodes in size. a. Randomly (or via the mouse) marked some of the nodes as "impassable". b. Allowed each grid node to have a variable cost, randomly assigned (or via the mouse), 3 variations. Regular tiles cost 1, forest tiles cost 5, water tiles cost 10. c. Visualize the grid, including costs. 2. Added the following dynamic game objects to the map: a. Keys: red, blue, and green key pickups. i. Each key is *always* available to be picked up. ii. On pickup, it should be removed from the map, and added to the AI's (virtual) inventory. b. Doors: red, blue, and green doors. i. The door make the grid node it lies upon impassible when closed, and passible when open. ii. The AI can only enter the grid node containing the door if it holds the key with the same color. iii. The door visually change to an "open" state only *after* the AI enters the containing grid node. c. Treasure: A final pickup. i. The treasure can only be obtained if available else tries to open any available door after key pickup. 3. Created a single game entity with an AI that performs it's logic via a Finite State Machine (FSM) a. The FSM attempts to collect the treasure. (Collect keys -> Open doors -> Collect Treasure) b. The entity pathfinding performs "seek"-like steering for the intermediate nodes along the path, and "arrival"-like steering for the goal node. c. The visualization of the AI itself is to print the FSM's current state. (text)

The demo has two states,

  • Collect state, state about collecting treasure

  • Seek state, state about path finding for each goal.

AI (Car) starts to find a key then finds its respective door to unlock it. So on until it finds an open path to treasure.


 
 
 

Comments


Recent Posts
Archive
Search By Tags
bottom of page