Jump to content
  • Advertisement
  • entries
    5
  • comments
    11
  • views
    1346

AI and Machine Learning

AlphaSilverback

2311 views

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




4 Comments


Recommended Comments

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.

Share this comment


Link to comment
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 🔥 

Share this comment


Link to comment

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. 

Share this comment


Link to comment
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. 

Edited by AlphaSilverback

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By GreenGodDiary
      Sup dudes and dudettes!
      I'm in the process of implementing an animation state machine and am currently making a 2D blendspace state for it.
      I think I've figured out how to blend the different clips together given an [x,y] coordinate but I have one problem I'm not sure how to solve; matching the different blended clips' animation speed.

      Say you have your run-o-the-mill twin-stick character locomotion blendspace, where max Y, zero X means running straight forward, and max Y, max X (in either direction) means running at an angle (thus blending run_forward with run_strafe).
      In this case the animations' speed probably match, so there's no worry. However, say I'm halfway up Y, meaning I'm "jogging", in the sense I'm halfway between walk_forward and run_forward, and my X is at some arbitrary point.
      How would I blend these animations together so that their speeds match? Would it be as simple as 'lerping' the animation speed of the walk towards the speed of the run and scaling the speeds of all the clips to match this speed?

      Sorry if the question is poorly written.
       
    • By Jreal
      How could I animate a model that has been created from high-fidelity scans with blend shape-based facial rigs?
      Should I find a set of Unity|Unreal plug-ins and packages (middleware, libraries, tools, etc...) that separately do speech synthesis, lip sync, cheek movement, eye rolling, etc...?
      I know this is a broad question, but I would appreciate some pointers to help me understand how I can create verbal & non-verbal behaviors in such a model when I open it in Unity|Unreal in order to create a primitive virtual human.
    • By FlyX
      Hey Gamedev.net Community!
      I am working on a mobile builder game that's already running for 8 years.
      In its early days, the game had a nice content progression until level 30(current max level is 140). With content progression, I mean at what level items unlock in the build menu. However, over the last ~4 years, the previous developer decided to unlock all the content between lvl 1 and level 30 (reasoning that the new content should be available for all players). This results in 1200 ~available items at level 1 and ~3300 items at level 30. Overwhelming players at the start and missing any content progression after level 30(can be reached within a few weeks, while a big part of the community is playing since multiple years).
      But how should this be addressed in a running game with a considerable user base across all levels?
      Internally we have a passionate discussion between moving existing items to later levels(and risking to anger existing players) or just adding new content to later levels(don't address the too much choice issue at the start)
      Since we are kinda stuck in the discussion, it would be nice to hear some external input
      Thanks!
    • By Septopus
      Well, here goes.  I'm currently developing a game whose core economy is based on an approximation/simulation of the actual periodic table of elements(the first 92 or so).  Essentially the player is using a future technology(future setting) to mine pure elemental resources from the planet without harming the ecosystem/terrain.  Think Star Trek type tech.
      The game is multi-player online(not online yet, still in lab), design goals are aiming for MMO.
      I'm currently at the problem of Currency.
      My design parameters are such:
      At Server Start, the game will have a fixed amount of each of the 1-92 elemental resources distributed in global resource deposits that are recoverable using the tech available to the players.  Resources amounts will be balanced so they meet the requirements of the games crafting system/etc. as well as attempting to match a rough approximation of a feasibly naturally occurring system. These fixed resources and the things they get turned into are to be the entirety of the "Matter" that is required for input(trade goods, crafting ingredients,etc.) in game play activities. All Crafted Items can be converted back into useful elemental matter through Recovery processes. Lost matter(Recovery is not always 100%) will develop new resource deposits, or add to old ones that have not been discovered yet. Discovered Resource deposits must be exhaustible. The problem arises when I begin conceptualizing a market system, and most specifically an Auction system. 
      I come to the conundrum..  How do I setup a starting bid amount or even a bidding system without a specific currency?
      Do I choose a specific element, say grams of Gold, as THE currency?
      Do I generate some code that tells the players that they have items in their inventory that are worth more than the current bid of 20kg of Iron, according to the current market conditions on the trading platform?
      Do I do both of these things?
      Do I need a more abstract form of currency to make it more (but less) tangible to the players?
      (not my favorite, but) Dollars, Coins, Gems?  Something totally abstract that cannot be mined or crafted?
       
      I'm trying to attack this conundrum from a "how would a player like it to work?" perspective..  But I'm stalled a bit.  Any insights/experiences/thoughts would be appreciated.
       
      Thanks in advance!
    • By menyo
      I really like to add AI to my game in the form of behavior trees and have been reading about them. The primary thing I am "stuck" with is how to pass data. Some articles mention a blackboard that should be passed down the tree nodes so they can set fields on it, but this means for each leave task that needs some form of data the blackboard gets a field. I imagine a lot of leave leave tasks and some need many fields to set on this blackboard and this deviates from my perception of clean and scalable code. Are there other ways to handle this?
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!