AI and Machine Learning

posted in Moosehunt
Published June 29, 2017
Advertisement

So -  the last couple of weeks I have been working on building a framework for some AI.

In a game like the one I'm building, this is rather important. I estimate 40% of my time is gonna go into the AI.  What I want is a hunting game, where the AI learns from the players behaviour. This is actually what is gonna make the game fun to play.  This will require some learning from the creatures that the player hunt and some collective intelligence per species.  Since I am not going to spend oceans of Time creating dialogue, tons of cut-scenes and an epic story-line and multiple levels (I can't make something interesting enough to make it worth the time - I need more man-power for that), what I can do, is create some interesting AI and the feeling of being an actual hunter, that has to depend on analysis of the animals and experimentation on where to attack from.     SO.. To make it as generic as possible, I mediated everything, using as many interfaces a possible for the system.  You can see the general system here in the UML diagram. I customized it for Unity so that it is required to add all the scripts to GameObjects in the game world.   This gives a better overview, but requires some setup - not that bothersome. 

If you add some simple Game Objects and some colors, it could look like this in Unity3D: 

 

 

 

 

 

Now, this system works beautifully. The abstraction of the Animation Controller and Movement Controller assumes some standard stuff that applies for all creatures. For example that they all can move, have eating-, sleeping and drinking animations, and have a PathFinder script attached somewhere in the hierarchy.  It's very generic and easy to customize.  At some point I'll upload a video of the flocking behavior and general behavior of this creature.  For now, I'm gonna concentrate on finishing the Player model, creating a partitioned terrain for everything to exist in. Finally and equally important, I have to design a learning system for all the creatures. This will be integrated into the Brain of all the creatures, but I might separate the  collective intelligence between the species. 

It's taking shape, but I still have a lot of modelling to do, generating terrain and modelling/generating trees and vegetation. 


Thanks for reading,
Alpha-

UML AI.jpg

2 likes 4 comments

Comments

leith

I'd be glad to share my insight and experience with neural networked AI, including purely genetic / adaptive AI (which require no formal training data in order to improve themselves), but you know what? For most games, FSM are adequate, behaviour trees are awesome, you don't really need to get too carried away, and if you do, you can always add a bit more script.

June 30, 2017 11:12 AM
AlphaSilverback
1 hour ago, leith said:

I'd be glad to share my insight and experience with neural networked AI, including purely genetic / adaptive AI (which require no formal training data in order to improve themselves), but you know what? For most games, FSM are adequate, behaviour trees are awesome, you don't really need to get too carried away, and if you do, you can always add a bit more script.

Wauw. Thanks. That's so nice of you. Neural networking is definitely the I'd like to go if this was intended to be just for scientific research. But since I am going to release it, I don't have the luxury of assuming multicore parallel hardware. 

I'm actually doing some research in evolution using neural networks/neural evolution and a custom real-time engine, written using directX and a custom physics engine. Very exciting stuff trying to emulate the real world and evolution of simple organisms, but it takes SO MUCH POWER. Real machine learning is not on the table. It's gonna be a simple model that can add states, actions and transition to the statemachine, correcting actions depending on whether the creature lives or dies when the player attacks. This makes the hunting dynamic. As soon as the player has assumed a hunting method that works, the creatures will adapt quickly after. This is of course still just hypothetical, since I've only just finished designing. 

 

I'd love to hear if you have specific ideas on how this could be implemented. I have some suggestions and models that I'm discussing with me and myself what would work best, but I'd like a fresh thought. I always enjoy fresh thoughts. 

Thanks for getting at me ? 

June 30, 2017 01:07 PM
Awoken

This hunting game idea of yours sounds awesome.  I too am going to be incorporating strong elements of AI into the game I'm making.  Some of the concepts you've drafted up are similar such as the hierarchy of needs, though I don't think I'll be including many learned AI elements.  I'm looking forward to hearing about your project.  Are you coalescing the data into something which can be interpreted? or which is accessible to you the developer?  I'm just imaging that you might have an AI with runaway parts that don't serve your intentions, but this is all speculation. 

July 02, 2017 07:32 PM
AlphaSilverback
On 7/2/2017 at 9:32 PM, Awoken said:

This hunting game idea of yours sounds awesome.  I too am going to be incorporating strong elements of AI into the game I'm making.  Some of the concepts you've drafted up are similar such as the hierarchy of needs, though I don't think I'll be including many learned AI elements.  I'm looking forward to hearing about your project.  Are you coalescing the data into something which can be interpreted? or which is accessible to you the developer?  I'm just imaging that you might have an AI with runaway parts that don't serve your intentions, but this is all speculation. 

Hi Awoken..  That's a very good question! Obviously it would make sense to output the generated behaviour patterns to a readable scheme or diagram, although this is not very easy. So far I have some algorithms to save the generated data, for what the creatures have learned, into file so that I can open them later. I'm still experimenting with the learning algorithms, trying to simplify the algorithm as much as possible. So I currently review some of the generated data in a simple graph viewer. For now that is okay, but it would be unreadable for anyone who didn't know the algorithm, and that's not ideal.   It's a work in progress. ;)

So far I want to make this pretty much as a Neural Network that can create new nodes from some simple parameters.  This neural network is saved as an xml-file whenever a generation survives better than the previous iteration. I have made a simple viewer for this format so I can keep track of what is working and what is not. This is still just experimental. A learning session would take  some time and hopefully produce some very interesting behaviour for the different creatures depending on their ability to move. I plan to take a generation that is half way to expert and make the players start with some AI that has the potential for learning when playing on console or PC, and then maybe make the player choose a difficulty when playing on and Android unit. 

I hope this is an answer to the degree of order I have on this. 

July 03, 2017 12:28 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement