DoomZ – A DayZ remake in the Gzdoom and Zandronum Doom Engines

DoomZ Forums Developers Coding Creature AI

This topic contains 8 replies, has 1 voice, and was last updated by  Superpomme 2 years, 7 months ago.

  • Author
    Posts
  • #242

    Superpomme
    Keymaster

    Am working on some creature ai. Previously I did the cows, which are terrible. They just have the scared flag, so they charge away from you at full speed whenever they see you. They at least need to zigzag a bit, and stop running after a certain distance.

    The rats have a constant check which despawns them when they get far enough away, so I could look at using something similar to make them run when they get near etc

  • #243

    Superpomme
    Keymaster

    A_wander – this “Makes the actor wander around aimlessly, as used by Strife’s peasants. An actor will not play active sounds, attack players, or attack any other target when calling this function, unlike A_Chase. A_Wander does nothing when the actor calling it has the STANDSTILL flag set.” http://zdoom.org/wiki/A_Wander

  • #244

    Superpomme
    Keymaster

    A_turretlook looks for players or other attackable actors in the game. This function is similar to A_Look but it only reacts to sound http://zdoom.org/wiki/A_TurretLook

    A_LookEx http://zdoom.org/wiki/A_LookEx his is a customizable version of A_Look, allowing for enemies which can only see or hear a target under given conditions
    ^ this one looks like it would be really useful. we can set a max distance etc

    A_Look2 http://zdoom.org/wiki/A_Look2 Looks for players or other attackable actors in the game. This function is similar to A_Look but it only reacts to sound. Just seeing the player will not wake up a monster using this.

    A_Look http://zdoom.org/wiki/A_Look Looks for players or other attackable actors in the game. If it finds a target, it enters its “See” state.

    A_FaceTracer http://zdoom.org/wiki/A_FaceTracer Changes the calling actor’s angle to face its current tracer. The tracer field can be set by spawning with A_SpawnItemEx.

    A_FaceTarget http://zdoom.org/wiki/A_FaceTarget Changes the calling actor’s angle to face its current target. The target field can be set by spawning with A_SpawnItemEx.

    A_ExtChase http://zdoom.org/wiki/A_ExtChase – it seems like this might only work for missiles.

    A_Die http://zdoom.org/wiki/A_Die – Kills the calling actor if it is not already dead. – I really like this, it gives an example of a creature which, when it takes enough damage, wanders around and then dies. You could do something similar with an animal. If a deer etc gets shot, it could succumb over time – could run away whilst getting slower and bleeding out (spawn blood each tic)

    A_ClearTarget http://zdoom.org/wiki/A_ClearTarget – Makes the calling actor forget about its target, sound target, and last target. You can call this before jumping back to a monster’s idle states to make a monster “give up” trying to chase after its target after a while (for ex. if it’s too far away), after which it will resume searching for targets or doing whatever else is specified in its spawn state. – perfect. This needs to be added to the zombies to stop them from chasing you indefinitely! This will stop them from mobbing you. but is that a good thing if they do? maybe a couple of types

    A_ClearSoundTarget https://doomz.co.uk/forums/reply/244/edit/ Clears the sound target for all actors in this actor’s sector. Anything not actively chasing a target will be unalerted by this. -this does the whole area. not sure when that would be useful

    A_ClearLastHeard http://zdoom.org/wiki/A_ClearLastHeard not sure if this will be useful, but it clears the last sound without losing target

    A_Chase https://doomz.co.uk/forums/reply/244/edit/ This one is going to be the main one for the zombies. it looks very configurable

    Note that because A_Chase and its variant have the capacity to put the actor into an attack state, they should not be used during the first tic of one of those states, as it may result in infinite recursion, which will usually manifest itself in ZDoom as a crash.

    A_Burst http://zdoom.org/wiki/A_Burst “Spawns a random numbers of actors of type classname, positions them all around the calling actor, and then destroys the calling actor, removing it instantly from the game” – could this be used to make a blood explosion when they are killed?

    A_AlertMonsters http://zdoom.org/wiki/A_AlertMonsters – used on a gun this could be used to set a max distance that the weaponswill be heard from

    A_DamageSelf http://zdoom.org/wiki/A_DamageSelf
    http://zdoom.org/wiki/Category:Decorate_Monster_AI_functions this could be used with a negative value so that zombies and dogs heal when they kill stuff. it looks like this can be used to damage the player that picks it up, rather than it damaging the item
    This has an example of a custom inventory that it would be worth me studying

    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
    • This reply was modified 2 years, 7 months ago by  Superpomme.
  • #245

    Superpomme
    Keymaster

    oh wow:

    Missile:
    SKUL C 10 bright A_FaceTarget
    SKUL D 4 bright A_SkullAttack
    SKUL CD 4 bright
    goto Missile+1

    Didn’t know you could do that with the missile+1. that would have made some of these way easier

  • #252

    Superpomme
    Keymaster

    http://zdoom.org/wiki/Actor_states#Anonymous_Functions this is new to me, and needs further reading. Looks like you can do some really useful stuff

  • #256

    Superpomme
    Keymaster

    Ok, currently my idea is, taking a deer as an example, the following:

    By default it stands for rand(x,x)
    it then has two radiuses around it – a small one, and a larger one.
    using an actor inventory, track a value of ‘scared’.
    If scared = 0, only worry about sounds inside the large circle, and people in the smaller one. set scared to 1
    if scared = 1 run from players in the larger radius.
    if not seen in larger radius, after x, scared = 0.

  • #257

    Superpomme
    Keymaster

    Cool, I think I have the working code now – this is the snippet that handles the creature ai

    Spawn:
    // POSS A 1 A_Look
    // POSS A 20 A_Look
    POSS A 1
    POSS A 20 A_LookEx (0, 0, 250, 250, 0, “See”)

    POSS AABBCCDD 5 A_Wander
    Loop
    See:

    POSS G 3 A_SetSpeed( 12)
    Goto Runaway

    Runaway:
    POSS AABBCCDD 2 A_Wander
    POSS A 0 A_LookEx (0, 0, 250, 250, 360, “evenfaster”)
    POSS A 0 A_LookEx (0, 0, 700, 700, 360, “Runaway”)
    POSS a 0 A_SetSpeed( 8)
    Goto worried

    evenfaster:
    POSS a 0 A_SetSpeed( 20)
    goto Runaway

    worried:
    POSS A 0 A_LookEx (0, 0, 499, 499, 360, “See”)
    POSS AABBCCDD 5 A_Wander
    Loop

    Pain:
    POSS G 3
    POSS G 3 A_Pain

    Goto evenfaster

    runs away if you get near enough (in its cone of vision) or make sound
    then it runs away
    while its running, if you get really close to it it runs even faster
    same if you shoot it
    then at a set distance it goes back to wandering

  • #258

    Superpomme
    Keymaster

    This should work for the cows and the deer and be changed for the rabbits and chickens etc.

  • #259

    Superpomme
    Keymaster

    Had a look to see if I can find any free models to use, so I’ll have a play with these at some point and see if they are posable etc http://www.turbosquid.com/3d-models/real-time-animals-pack-3d-model/243576

    animals

You must be logged in to reply to this topic.