Introduction - makingthematrix/gailibrary GitHub Wiki
Main ideas
The first step - and I will be tremendously happy if I achieve only that - is to provide a small library with all the most important tools used to code Artificial Intelligence in computer games. That is, roughly:
- data models
- graphs for map representation (but they also can be used as state diagrams and decision trees)
- operations on sets
- path finding
The library should also simplify the way programmers write logic for non-player characters (NPCs) and the way data is modeled should make it easy to run functions in parallel.
To achieve that I want to utilize an idea I learned about during my university years: cellular automata. Cellular automata are computational models striving to simulate complex systems of our world (ecosystems, macro-economical processes, demographics, city traffic, etc.) by using small, discrete units, interacting with each other. These units are called cells. Each cell consists of data and references to the neighboring cells. In each computational iteration a function updates the cell’s data, using only the current data of the given cell and data of its neighbors. The theory says that with a big enough number of small enough cells, and a big enough number of iterations, we are able to simulate processes far more complex than what we programmed. We call it emergent behaviour and another theory – mine – is that we can use the same pattern to make decisions for non-player characters in shooter and strategy games, as well as realistically simulate the environment in games like SimCity.
Whoa. I know. That’s a lot. Actually, I don’t have much free time, so by necessity this project has to be small and tackle only the most important issues in Game AI - the ones I mentioned above. I have some more ideas in my mind, and some of them I will write about later in this document, but now I want to focus on delivering a simple, usable crate. Then I would really like to get some feedback from you all, fix bugs, and code some utility methods. I imagine a big number of functions used for decision making would be generic enough that I could write a catalogue of them, or their builders, so GAI users will not have to reinvent the wheel. Only after that I will think about expanding GAI with new features.
Some remarks
- In this document I’m going to use words „parallel” and „concurrent” as synonyms. I’m aware of subtle differences between them, but for all practical reasons they don’t matter much.
- Also, I’m going to use interchangeably terms „agents” and „the player and non-player characters”, simply because the former is shorter.
- Please take note that English is not my native language, so there will be some errors in the text. I will edit the article a few times after publishing it anyway, and hopefully I will be able to fix my mistakes during these edits.
- The pseudocode used in the text is something in-between Scala and Rust.