My goal for this project was to create an interesting and engaging AI behavior that would bring players moments of surprise, fun, and frustration. To achieve this, I wanted to create an AI that reacted to the world.
Use WASD to move camera.
Scroll wheel to zoom in/out.
Use your Cursor and left click to select and place items, to pick up currency.
To create a realistic simulation, I started researching behavioral trees. As I learned more about how behavior trees function and are put together, I realized that due to time constraints, this would not be feasible.
I pivoted to creating a finite state machine, as I am most experience with state machines, allowing me to produce a more viable product. In the transition to a state machine, the concept pivoted to a simulation with more NPC to NPC interactions, and less player influence.
The AI behavior uses a Finite State Machine. To create personality within the behavior, how the AI interacts with the world varies depending on their type.
NPC stays still, while checking what is near, while in this state has the chance to spawn in a structure related to them.
NPCs will default to idle state when unsure what to do.
Chooses a random direction to move to, to keep things interesting.
Allows NPCs to explore their environment, and find intractable objects or other NPCs.
In this state NPCs, recover HP, and recover stamina at a faster rate.
Adds more realism to simulation, and more states for the NPC to choose from when deciding what to do next.
When engaging another NPC, will choose to run away in a random direction, or run towards the aggressor depending on their stats.
Adds more believable behavior to the NPCs, and increases survival chance of weaker elementals.
Damages a target NPC, gains happiness from winning a battle.
Allows a way to decrease the elemental population
Allows NPCs to dynamically interact with the environment, and placed structures.
Different NPCs interact differently with different objects
To create fun, surprising, and maybe even frustrating moments, I coded a system, where all objects interact with each other and NPCs.
When near a campfire a fire types will have its stat values increased for a short time.
Water types are healed when near a pond.
Nature types are able to reproduce faster.
To create fun, surprising, and maybe even frustrating moments, I coded a system, where all objects interact with each other and NPCs.
Spawns embers that burn trees, but can be put out by water type elementals.
Increase growth rate of nearby trees but can be sucked dry by nature types.
Grows faster when near ponds, can be burned down, can be restored when burnt
Players can spawn objects that will influence the development of the spirits. I coded a system that will translate 2D UI inputs into the 3D world.
Players earn currency when Elementals are well kept. I coded a system that will allow players to click on drops and pick them up, players can also focus in on elementals.