Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: AI creatures  (Read 1204 times)

winner

  • Bay Watcher
    • View Profile
AI creatures
« on: March 04, 2010, 04:00:41 pm »

I'm trying to figure out the basics needed for a group of intelligent creatures in a game world.

They need something to seek and something to avoid.
they need to tell their experiences and deductions to the others. (most important thing)

They need to try to predict the future.
 to do that they need to explore potential realities.

they need some sort of memory of the landscape so they don't get lost
and some sort of memory about individuals and things so they learn from experience.
Possibly they would build up a table of correlations and pay attention to the more highly correlated things.

Right now I'm way too fuzzy on how their brains would work to start coding.  I would like to know your guy's thought on what the minimum mechanisms necessary for intelligent behavior are.
Logged
The great game of Warlocks!

jplur

  • Bay Watcher
    • View Profile
    • http://www.parker-portfolio.com
Re: AI creatures
« Reply #1 on: March 04, 2010, 04:14:13 pm »

Well in our brains we have a virtual simulation of the world running.  So your critters would have their own simplified version of the simulation to help them make choices.  But then, humans have the ability to see things through other peoples perspectives, so in our mental simulations we simulate the simulation of other people.

I suggest you start with something simple, like http://en.wikipedia.org/wiki/Prisoner's_dilemma


Logged
I ended up finding out you can speed up pregnancies by changing the mother to a cat to knock them up and changing back before labor

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: AI creatures
« Reply #2 on: March 04, 2010, 04:33:47 pm »

This thread does not make it clear exactly what you're trying to do, why, and what the problem is.
Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

winner

  • Bay Watcher
    • View Profile
Re: AI creatures
« Reply #3 on: March 04, 2010, 04:50:40 pm »

What I want to do is to watch a simulation of social interactions.  I can't use a rule based approach because all the really interesting interactions don't work that way. 
When I get down to the details of how a mind works it is frighteningly complex to code so I'm asking for help simplifying it down to the core while still keeping all the interesting bits.

You are right. the prisoner's dilemma shows a useful simplification people use, they assume that when confronted with the same choice, most people are going to act exactly the same as them.
Logged
The great game of Warlocks!

jplur

  • Bay Watcher
    • View Profile
    • http://www.parker-portfolio.com
Re: AI creatures
« Reply #4 on: March 04, 2010, 06:12:39 pm »

Yes, I suggested that because it simplifies the output of the AI to two decisions.

Personally, I really doubt any AI that doesn't start from the ground up. I recently wrote a python implementation of boids, and it's very pleasing to see the flocking behavior arise from 3 simple rules. IMHO, trying to simulate a brain is in the realm of science fiction.

Logged
I ended up finding out you can speed up pregnancies by changing the mother to a cat to knock them up and changing back before labor

eerr

  • Bay Watcher
    • View Profile
Re: AI creatures
« Reply #5 on: March 04, 2010, 08:36:41 pm »

Yes, I suggested that because it simplifies the output of the AI to two decisions.

Personally, I really doubt any AI that doesn't start from the ground up. I recently wrote a python implementation of boids, and it's very pleasing to see the flocking behavior arise from 3 simple rules. IMHO, trying to simulate a brain is in the realm of science fiction.


It's the realm of crappy approximation.
Logged

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: AI creatures
« Reply #6 on: March 04, 2010, 10:03:02 pm »

The prisonners dilemma is not a good approach at all.  You can just define matrixes of behaviours and assign variables to each creature so they can behave differently (as in a RPS bot) but you won't accomplish much and it definetly won't be much of a social interaction.

You should start practicing with Finite State Machines. 
http://www.devmaster.net/articles/fsm_intro/
http://en.wikipedia.org/wiki/Finite-state_machine

Create some sort of world variables that will be relevant to your critters.
Create your critters as FSMs (lone first, then give them the abilitiy to interact between each other)

quick example:
World->  Food:  20   Shelter:   20   

Creature->  Energy:  0/10   Strenght:  0/10
Attack another creature  -> (depends on strenght , energy & random factor) if it wins gains +3 energy +1 strenght
Pick Food -> +2 energy. 
Hide in Shelter ->  can't be attacked by hunters or creatures.

Every turn:
Creatures change -1 energy.
Hunters hunt a determined amount of creatures that didnt hide based on (amount of food & random factor) The more food for humans, the less they need to hunt creatures.
Food is created between some values (random min/max)

Once you have some simple model like this one running with creatures taking just random options.  You might look at the tendencies and stuff.  Statystical analysis are cool.  Anyway, once you get to this point, you can start adding characteristics (genes, personalities, whatever) to the creatures so they can base their actions accordingly.

What language are you coding in?

btw, predicting the future involves knowing some factors, calculating some results and acting upon it.  But the more you know, the more complex the calculations will be. 

Remembering things is even harder.  You're better trying all these things first and then, if you manage a nice simulation.  You might want to dwell into that kind of madness.
« Last Edit: March 04, 2010, 10:06:55 pm by Alexhans »
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

MrWiggles

  • Bay Watcher
  • Doubt Everything
    • View Profile
Re: AI creatures
« Reply #7 on: March 04, 2010, 10:31:02 pm »

Well the simplest creature that man made I know of, is the walk man bots.

http://www.beam-online.com/Robots/Galleria_other/walkers.html

They can navigate their environment and can get themselves unstuck.
Logged
Doesn't like running from bears = clearly isn't an Eastern European
I'm Making a Mush! Navitas: City Limits ~ Inspired by Dresden Files and SCP.
http://www.bay12forums.com/smf/index.php?topic=113699.msg3470055#msg3470055
http://www.tf2items.com/id/MisterWigggles666#

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: AI creatures
« Reply #8 on: March 06, 2010, 01:44:27 pm »

There are 2 ways to do this...
The boring way is to do it is to do behavior programming, rules for interaction, ect, ect ect...

The fun way to do it is to read up on the following topics:
http://en.wikipedia.org/wiki/Genetic_algorithm
http://en.wikipedia.org/wiki/Neural_network and/or http://en.wikipedia.org/wiki/Artificial_neural_network

GAs are easy enough to grasp if you have at least a rudimentary level understanding of evolution, neural networks will likely require a decent amount of calculus to fully understand.
Put those together into creature behavior in a game, and you are bound to learn quite a bit and have a good deal of fun doing it.
« Last Edit: March 06, 2010, 01:47:15 pm by alway »
Logged

eerr

  • Bay Watcher
    • View Profile
Re: AI creatures
« Reply #9 on: March 07, 2010, 12:39:50 pm »

Animals, rely on a system of association.
Like pavlov's dog.

Humans upgrade this basic system fantastically but it IS still there, if a bit broken down for a better system.



A number of actions, such an alligator's jaw clamp and death roll, are completely instinctual.

what kind of AI do you want to write?

A simple reactive AI, or a learning AI?
Logged

winner

  • Bay Watcher
    • View Profile
Re: AI creatures
« Reply #10 on: March 07, 2010, 01:51:13 pm »

I was planning on an AI that can learn a little bit because it seems a little less stupid when it meets something it has prior experience with.
speaking of association
In her book "animals in translation" Temple Grandin tells about how her dog got scared by a hot air balloon revving it's flame right over her house.  The dogs fear spread from hot air balloons against a blue sky, to include those orange balls on power lines and even a red fuel cap on a blue gas tank.

The kind of behavior I find interesting is where creature A goes to examine a hill because creature B consistently makes a detour to avoid it.  Or creature B freaks out whenever it sees a squirrel because it saw creature A do the same thing when B first saw a squirrel.  Basically the feedback loops in behavior.
« Last Edit: March 07, 2010, 02:26:39 pm by winner »
Logged
The great game of Warlocks!

Bricks

  • Bay Watcher
  • Because you never need one brick.
    • View Profile
Re: AI creatures
« Reply #11 on: March 07, 2010, 02:24:25 pm »

I think it's tough to create really interesting behavior like that unless you create a really complicated game world, or you are satisfied with more academic results like abstracted systems of association.  Otherwise your critters will adopt ideas that are pretty obvious, like run away if you are too weak to fight.  "Learning" AI in games seems to be more about tweaking the trigger conditions.

Something that always bothered me about neural networks is that they (seemed) to only allow 1:1 association of causes and effects.  I'd like to see a system that promoted chains of logic, which I'm sure neural networks permit in some sort of capacity.  That could simplify the notion of simulating an outside world considerably, since it would allow you to build up hypothetical circumstances and then recursively process the results so you can get a notion of what the ultimate effects could be, given whatever your AI has learned.  Unfortunately I can't think of a compelling game world to frame this in.
Logged
EMPATHY - being able to feel other peoples' stuff.

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: AI creatures
« Reply #12 on: March 07, 2010, 08:59:12 pm »

Something that always bothered me about neural networks is that they (seemed) to only allow 1:1 association of causes and effects.  I'd like to see a system that promoted chains of logic, which I'm sure neural networks permit in some sort of capacity.  That could simplify the notion of simulating an outside world considerably, since it would allow you to build up hypothetical circumstances and then recursively process the results so you can get a notion of what the ultimate effects could be, given whatever your AI has learned.  Unfortunately I can't think of a compelling game world to frame this in.
Either you are only using 1 neuron, or you are doing it wrong. And the point isn't to simulate an outside world, that would use rediculous amounts of CPU time. The purpose is to edit the rules of how it reacts to situations. As the NN is trained, it learns what works and what doesn't. And by learned, I mean it changes the attributes of the network, altering the way it reacts. Aside from the neurons themselves, no data needs to be stored.
Logged

winner

  • Bay Watcher
    • View Profile
Re: AI creatures
« Reply #13 on: March 07, 2010, 10:08:24 pm »

I'm not a big fan of neural nets and evolutionary programs unless there is no other way to do the same thing. 
The reason is that they are so incredibly slow and if you are doing anything interesting it's very hard to ensure that you are actually selecting for what you want that you end up writing twice the code  to get the same result.
Logged
The great game of Warlocks!