'Thinking' AI

This forum is currently in read-only mode.
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hey, im making a kind of 'wildlife' game thats topdown and u watch the creatures do there thing. Im currently have them set to a bullet behaviour like in the ghost shooter tutorial. I wont them to have a kind of 'chance' code were they might keep going or they might decide to stop and sleep, so far ive got a eat thing going on with the Line of Sight behaviour but thats about as real as they get.

    Any suggestions, thanks.

  • i think you should use the RST behavior instead of the bullet one and for the chance code you can use the random command and you should also create function witch is going to tell the behavior of your A.I. and use random time interval to make them do something

    like;

    pick a random "creature"

    if not "sleeping"

    if not "eating"

    every random(10000)+5000 set the private variable of it to random(3)

    then

    if 0 then call function "sleep"

    if 1 then call function "go"

    if 2 then call function "eat"

    and create your function like

    sleep;

    wait 20 000 ms

    then call the function "go"

    eat;

    move toward food.x.y

    wait 5000 ms

    than call "go"

    go;

    move toward random(640) random(480) "if your layer is 640,480)

    something along those line ...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • i think you should use the RST behavior instead of the bullet one and for the chance code you can use the random command and you should also create function witch is going to tell the behavior of your A.I. and use random time interval to make them do something

    like;

    pick a random "creature"

    if not "sleeping"

    if not "eating"

    every random(10000)+5000 set the private variable of it to random(3)

    then

    if 0 then call function "sleep"

    if 1 then call function "go"

    if 2 then call function "eat"

    and create your function like

    sleep;

    wait 20 000 ms

    then call the function "go"

    eat;

    move toward food.x.y

    wait 5000 ms

    than call "go"

    go;

    move toward random(640) random(480) "if your layer is 640,480)

    something along those line ...

    Thanks that worked fine, took awhile to adapt to my existing LoS detection and hunger variable but its worked out just fine,

    Thanks a lot.

  • I have also been working on something very similar-- a sort of virtual terrarium-- yes? I personally have just been using custom movement behavior and creating boxes that I can set to invisible of varying sizes that are always set to the x and y of each creature to mimic line of sight-- I find it more useful for actually seeing at what point a creature will flea or attack--

    To actually get it to seem like the creatures are "thinking" I recommend using private variables-- hundreds if you need to-- variables for how hungry they are, how much energy they have before they need to sleep, how safe they feel-- just for everything, and then make them behave based on what that variable is!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)