[ODE] OT: virtual creatures in games

david@csworkbench.com david at csworkbench.com
Wed Mar 26 17:13:01 2003


Ohhhh, now I see.... you basically want to build a sub-culture of evolved
creatures in your game (It sounds like a MMOG... right?).  Man this game
is going to rock!  (at least for us AI/ALife folks anyway).  So, any
chance it'll be open source??? :)  You could implement player memory as a
sensor that maps the closest player's id to a numerical value, and a
separate brain I/O that would output values between say -0.01 an 0.01,
that get added to the closest player's value in the player map.  "Smart"
creatures should be able to use that as a "goodness" value, or even evolve
several memories that can give them a better idea of whether this
particular person is going to help or keep them from achieving their
current goal.  You might want to implement a method that players can
"feed" the creatures (or kill/hit them), to give the creatures more of a
reason to either go looking for food from the humans ("act cute") or
attempt to become aggressive and protect the hive.  In long running games,
it might even become quite a challenge (and an added bit of gameplay that
you didn't even plan for) to take out the "queen" if such a social
structure were to evolve.  You may even end up evolving better bosses than
the ones you coded, if you give them enough power.  If you design your
fitness test just right, and keep separate zones in the world from sharing
genes too much (probably also good for processing power and memory
requirements) then you should have a large variety of both loners,
predator packs, and highly structured social groups of creatures.

You'll probably get the best evolutionary paths if there is one or more
resources that are in limited supply, that all creatures need to survive
(surviving creatures produce offspring with their hopefully smarter genes,
others die before they have a chance).  At least one of these needed
resources should also be needed by the players if you want to encourage
player/creature interaction.  In it's simplest form, you could just have
one resource, which acts as a creature's food, but just happens to be the
currency used by the humans.... should make for some interesting
exchanges.

If you spread the control of creatures out to the clients in the zone, it
won't make hardly any difference at all to the player's performance, but
will save your server tons (i.e. you have 100 players online, each could
simulate 10 creatures, or you could simulate 1000 on the server....).  Of
course, you could vary this dynamically depending on the power of a given
computer (i.e. framerate drops below 20 fps, send creatures back to the
server until it rises back above it.  framerate goes over 40, add
creatures to this computer until it drops back to it).  You might even
consider making the amount of time it takes to "step" the creature a
factor in it's fitness function, so creatures that evaluate faster are
more likely to evolve. But this might have the undesired effect of
limiting possible intelligence.

Ok, I'll quit rambling and get back to work on the iterative solver.... If
you want a contributor or even just a beta tester, let me know.

David

>
>> I don't think you necessarily want to evolve the locomotion of the
>> "creatures" in your world, but rather, you want to evolve the state
>> machine itself that determines what their next move will be.
>
> Actually, I do - the fun thing is the unpredictable movement, which
> greatly contributes to the character of a creature.  Imagine randomised
> alien creatures (ie. they can be bizarre), that move in physically
> correct, but suprising ways - that's what I'm excited about.
>
>> Most paramount is a fitness function.  Since it doesn't sound like
>> your game is primarily hostile, amount of time it remains alive may
>> not be a great factor.  Perhaps if your creatures were in competition
>> with people for the same thing, you could have some really interesting
>> behaviors evolve.  Not knowing much more about your game, I can only
>> assume that there is a challenge to the humans other than these
>> creatures alone.
>
> The creatures aren't the main challenge - it's more about exploration of
> an interesting, vibrant world (although if a bunch of people-hostile
> creatures gang up on you, I guess that counts as a challenge : ).
>
>>  More
>> than likely, your fitness function will be a weighted sum of many
>> factors, and you could even use a larger genetic algorithm to optimize
>> these weights for the number of man-hours people spent in your game :)
>
> Cool, I'll have research those.
>
>> ... (I would
>> suggest a genetic program over a neural network, as each node is more
>> expressive, i.e. more intelligence for less calculation).
>
> That's the kind of info I was after, thanks.  It's easy to find links on
> self-learning AI, but most of it is research/education based, and it's
> hard to evaluate what is appropriate/feasible for game use and what
> isn't.
>
>> On the other hand, if your game isn't combat oriented (or the
>> creatures aren't involved in the combat very often) then another goal
>> will have to be given to creatures.  i.e. a genetic algorithm without
>> a goal will probably get really good at.... doing nothing.  If you're
>> just looking for different behavior out of each creature, pure
>> randomization may be all you need.  You could still use a neural
>> network or function tree as your medium, just not worry about gene
>> pools and selection/crossover/mutation methods.
>
> I want the creatures to primarily live their own lifes.  Food,
> pro-creation, territorialism, the usual basic drives : ).  Player
> interaction is something I would like them to decide for themselves,
> based on their current characters and/or experience with players.
> Basically I'm trying to get away from hard-coding as much as possible,
> to keep each excursion into a newly seeded world totally unpredictable.
>
>> I eventually hope to create a distributed world on the internet that
>> may or may not have any human interaction, where the creatures evolve
>> in an environment where they are competing for a limited supply of
>> energy.  I'll include stuff like inter-creature communication and the
>> ability to decide (through genetically determined parameters) how much
>> of your energy you spend on moving, sensing, even thinking (bigger
>> brains cost more energy). It should be interesting to see if creatures
>> evolve into cultures of separate brains and brawns, or if it turns
>> into an everyone for himself kind of world.
>
> Yes, that's exactly the kind of thing I'm after, though I will
> compromise on the more ambitious stuff if it turns out too much of a
> resource drain.
>
>>  But I've got to have a fast physics engine first to
>> simulate worlds of the size and scope I hope to acheive :)
>
> That's why your iterative solver is so cool Dave - without it things
> like destructible buildings and virtual creatures just aren't feasible
> for a real-time game.  It'll be interesting to see how much it can
> handle.
>
>> I've got a
>> simple Function tree style brain class lying around somewhere if you'd
>> like to take a look at it
>
> I'll do some research on the various methods first, but I may get back
> to you, thanks.
> --
> gl