wherein I learn a bunch of different things.
April 17, 2024
Sims-like agents
I was inspired by some of my favourite open world RPGs (Skyrim, Kingdom Come: Deliverance, to name a couple) to try and create a virtual world of my own, in which the inhabitants, rather than perform scripted routines and animations, can actually react dynamically to their environment, and to each other. In this sort of simulated ecosystem, agents will have needs that must be fulfilled in order to survive, but how they fulfill those needs will change depending on their internal state and the state of their environment.
Let's look at our first agent. Like in The Sims, our agent will have meters that represent some basic needs, whose values will increase over time until they reach a threshold, prompting our agent to perform some action that reduces the value until it is zero.
Each need (sleep, hunger, and thirst) has an associated source object (sleep, food, and water) that the agent interacts with to address the respective need. Right now, those sources are hard coded to their respective needs, but I want to explore the idea of an agent that can learn about its environment. What will the agent do if they don't immediately “know” about a food source?
I'll create a knowledge base data structure that represents an agent's knowledge of the world. It's a list of concepts, with each concept having a reference to a list of concepts via a relationship. I suspect this will blow up in complexity as I go along.
Equipped with this knowledge, our agent can traverse the concepts in its knowledge base to find the object that it is looking for.
In the near future, I'll want to assign weights to each object or concept that is being evaluated (for example, if there are two objects that are food sources, which one do we pick?). This will also almost certainly blow up in complexity, but hopefully I can leverage the knowledge base to multiply the amount of possibilities within a given decision making algorithm, such that a relatively simple algorithm can give rise to a great number of possible actions, in a possibly quasi-emergent, Game of Life sort of way.
I've defined the above concepts and relationships, and defined a zone on the other side of the wall to be our agent's campsite. The agent's not-very-sophisticated search routine simply involves wandering around a certain radius until an object that meets the search criteria (in this case, an object that is a pot of food) enters the agent's field of view.
This isn't very complex yet, but now I have the foundation for what I'll want to explore in future updates.
Until next time.