Leges Motus Progress: Simple and Fuzzy Logic AIs

Time has gotten away from me once again, and I have not posted a recent update on our progress with Leges Motus’ AI creation. First of all, the most recent code for Leges Motus is now on GitHub (https://github.com/jpfau/legesmotus), instead of SourceForge’s SVN. Secondly, we have been making significant progress on the AI creation.

We started with a very simple, deterministic AI, to test out our ability to make a completely player-less client. This was very easy, due to the design of the re-written client and logic code. The simple AI essentially works as follows:

  1. Find the nearest enemy we can see.
  2. Find out if we can see the enemy gate.
  3. If we are not on the enemy gate and we can see it, turn the gun towards the gate and then jump towards it.
  4. If we can see an unfrozen enemy, turn the gun towards them and fire (with some random inaccuracy).
  5. If we can’t do either of those, jump randomly (with a chance of jumping towards the gate, even if we can’t see it, in hopes of getting closer).

That’s about it.  It’s simple, it looks a bit silly jumping randomly into walls, but it works. It can even win games against human players. But really, it’s just a baseline test.

The Fuzzy Logic AI is more interesting, though still not up to the level we will be trying to reach for our final AI. The system is approximately as follows:

  1. A config file specifies the ranges and edge functions for each fuzzy logic category/bin within that category. Example: dist_to_player.melee is somewhere around 0-64 pixels away, with dist_to_player being the category and melee being the bin.
  2. The categories are loaded, and put into a FuzzyLogic object. A FuzzyEnvironment is passed in each frame with the appropriate values set for each category.
  3. The FuzzyLogic passes the bin values into various Rules, which are constructed in a hierarchical structure (Example: two terminal bin values inside an Or rule inside an AND rule, all in a NOT).
  4. The Rules each output a float value, which is used to determine the importance of various actions or the value of various things. For example, a rule is used to determine which enemy player is most dangerous.
  5. The output actions are similar to the possible output actions of the Simple AI, but decided upon in a much more flexible and interesting way. This makes the AI seem less computer-like and more like it is making informed decisions.

We are also looking into making the FuzzyLogicAI switch weapons as appropriate to the situation. This could be slightly more difficult, since the weapon system was not designed to allow easy external determinations of weapon damage at a specific range, exact effects, etc. We will be considering how best to make these decisions general enough to work with any weapon setup.

Some Fuzzy Logic AIs helping me capture the enemy's gate.

Some Fuzzy Logic AIs helping me capture the enemy's gate.

Unfortunately, the FuzzyLogicAI is still unable to jump in a useful manner (other than randomly) except when it sees an enemy gate. This means that our next step will be pathfinding. We plan to store information about the reachability graph for each map on disk, and to load that into memory when the AI joins. This could have a lot of space/time tradeoff issues to look at, and we will then need to determine the best algorithm (probably A* of some sort) to find the paths through the map once the graph is made.

I’ll keep updates coming as we continue the AI work.


~ by greywhind on March 3, 2011.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: