Search Unity

Animal AI

Discussion in 'Game Design' started by Pangea, Feb 10, 2015.

  1. Pangea


    Jun 14, 2013
    With Jurassic World in tow, I kinda feel inspired to do a dinosaur-based horror game as my first legitimate project. Of course, when it comes to AI, I've noticed that most games typically depict animals in general has being aggressive, harmless, or chill unless provoked. The reason for bringing this up is technically, animals of all kinds (dinosaurs probably count) are unpredictable, and in confrontation, nobody knows what to expect from them 2 seconds from now. Has anyone else ever thought about this when working on games based with animals?
  2. DanSuperGP


    Apr 7, 2013
    I've been thinking about dinosaur AI for years. One of those dream games I'll probably never make but I designed years ago is a competitive/cooperative multiplayer steampunk time travel dinosaur hunting competition.

    It seems like AI for dinosaurs would be different by breed. For instance, your average herbivore would probably be pretty ambivalent until spooked, and then probably stampede away, or charge... depending on the perceived threat and situation.

    Big carnivores would probably be fairly straight forward, charge in and eat things... not much need for stealth...

    Pack hunters would use hit and run, and coordinated tactics through vocalizations...

    and so on.
  3. Pangea


    Jun 14, 2013
    Yeah, I get what you're saying.

    I was curious about this because A, I wanna know how complex it is, and B, I'd like a bit of input in the event I decide to go ahead and add something like Triceratops or Ankylosaurus.

    Basically, not many know this, but in truth, large herbivores are dangerous and territorial themselves, especially those from Africa, which have been recorded attacking each other. My main reason for bringing this up is because I'm not sure if people will like the idea due the way The Stomping Land (before the dev vanished off the face of the earth) tried to implement this. Basically, people were annoyed by how herbivores kept on killing them without provocation. Although, what I had in mind doesn't really involve having them act like heat-seeking missiles.
  4. ostrich160


    Feb 28, 2012
    They're only unpredictable first hand. All animals do is react to various different conditions, many of which are hard to notice first hand. So not just what the event is, but the time of day, the size of the herd, the other animals in sight. Its easy to forget how different animals are to humans, they only posses very basic emotions, and they're triggered by their survival instincts (which can be boiled down to fight or flight).

    So for your AI to work best, dont just have it react to a situation, have it react to all the different components of a situation. I cant name them all, Im not a biologist, but do a bit of research.

    Or, if you want to be lazy, like I sometimes want to be with my AI, just stick a random number generator on them, that generates a number, say, between 1 and 5. If the situation generates a 1, they run, 2 they back off, 3 they fight, you get the idea.
    Ryiah likes this.
  5. Jaqal


    Jul 3, 2014
    AI is such a complex subject but for my physical project I am trying to keep things pretty realistic.

    For starters all of the animals in my game are on schedules linked to the day night cycle. They all have a den/area where they sleep at night unless nocturnal. In which case it's just backwards. Upon awaking they choose from a few different water sources which they hang around for a few game hours. They then make their way to one of a few different feeding/hunting areas for the rest of the day. These are all just simple waypoints setup independent to each map which they access when the game starts.

    On to the more specific interactions. All of my AI has two very important parameters that determine their interactions with other AI or the player. The first is for size and is a simple public int from 1-5. Secondly a danger level from 1-10. For this I take the size and add 1 point for being a carnivore, being angry, protecting something, etc. I take 1 point for being hurt etc. So say I have a size 3 carnivore that is angry, they would have a danger level of 5. So if they spot another carnivore that is within a certain range and has a higher danger level they will move away. If it is lower and they are hungry they will chase and attack. The AI uses these two parameters as well as hunger, a separate reproducing system for population control, etc.

    It's a little deeper than that I can't give away all my secrets but you can see the point. So far this system works extremely well for my AI allowing me to easily add many types of interactions between the AI and player as well as setting up really specific environments in game.
  6. Genkidevelopment


    Jan 2, 2015
    Err, I'll take your word for that then!!! :D

    You could create a list of actions the animals are capable of doing, being as specific (or not!) as you like... The animals can then draw from the list of actions relevant to their type. Trigger the actions randomly, with a balance of gameplay situation and individual preferred actions etc... Maybe Make the actions last for a while so they aren't all being called every frame etc...

    You could even implement the actions into a breed List/array, to see what is 'going down' and make others of the same breed more likely to join in... You could have a 'interaction' trait making some animals loners others groupers etc... Eccentricity... likelihood to action 'outside of the box!'... This could be really fun... Think of a bee, placid... but get one or two angry and BAMM! They all want a piece, stoke the nest and oh boy!!! Same with a group of relatively harmless dinosaurs maybe!

    Sounds like this would be a fun project. Good luck