Is there any competent Zombie AI?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • The flocking object is great. IIRC SolarB did an extension-less version of it somewhere, which you could potentially modify to include obstacle avoidance (if it doesn't have it already)

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • This was recently released, and might be of use: Please login to see this link. EDIT: seems broken at the moment - maybe wait till they update it

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

    Edited once, last by Volnaiskra (February 28, 2020 at 3:12 AM).

  • Would it be feasible to use something similar to boids to handle zombie groups? Only without the flock "cohesion" effect?

    There's a video here about the concept with info in the description: Please login to see this link.

    And I believe there is a fusion extension called "Flocking" that implements this here (not sure about obstacle avoidance): Please login to see this link.


    That is really cool. It does seem like it does use obstacle avoidance also? At least in the example file they seem to move around that big Bubble? Please login to see this link.


    The flocking object is great. IIRC SolarB did an extension-less version of it somewhere, which you could potentially modify to include obstacle avoidance (if it doesn't have it already)

    Do you have idea where I could find it? I do like to use as little extensions as possible. About that ISO project on the store, it looks very interesting, but how is it broken?

    Steam games: Please login to see this link.

  • I played around a little bit in the flocking example, but it seems to me like the obstacle avoidance is calculated as a radious around a sphere ?
    I tried to change the bubble to a couple of blocks to see how it would handle walls etc and decrese the radius, but they seem they "slip though" the blocks. Not sure if I am using it wrongly ?

  • About that ISO project on the store, it looks very interesting, but how is it broken?

    Currently, once you click out of the intro frame, it just ends. There are a bunch of frames that have "do not include at buildtime" checked. When you check them (or run them individually) then you can see other parts of the MFA. But it's poorly commented so it's hard (for me at least) to figure out which frames are supposed to be included, and where to start (let alone how it actually works).

    I mentioned it on the Patreon page and they said they were fixing it. Though to be honest even once the frames run correctly it will probably still be too poorly commented for most beginner/intermediate users to get much out of it, IMO.

    Please login to see this link.
    My Fusion Tools: Please login to see this link. | Please login to see this link. | Please login to see this link.

  • That flocking example is interesting (and aenever is right about the obstacles btw).
    The problem is that while the fish / zombies will avoid walking *through* obstacles, there's nothing to make them try to find a way *around* the obstacle instead. They certainly wouldn't have a hope of walking around a concave obstacle.

    I modified my previous example to make it so that zombies repel other nearby zombies. It's only a lazy and buggy example, but I think the concept has promise.

    Please login to see this link.

    Ideally, I'd probably try to simplify it all a bit using a bunch of 2d unit vectors - get a vector from the zombie to the player; get a vector to the zombie from each nearby zombie; get a vector perpendicular to the direction of travel if about to hit a wall (either left or right, depending on which detector is overlapping the wall) - then multiply them by various coefficients, and add them all together to get a new vector which is in the direction of travel. And then use a fastloop movement just to make absolutely certain that zombies don't end up waking through walls if something goes wrong.

  • That flocking example is interesting (and aenever is right about the obstacles btw).
    The problem is that while the fish / zombies will avoid walking *through* obstacles, there's nothing to make them try to find a way *around* the obstacle instead. They certainly wouldn't have a hope of walking around a concave obstacle.

    I modified my previous example to make it so that zombies repel other nearby zombies. It's only a lazy and buggy example, but I think the concept has promise.

    Please login to see this link.

    Ideally, I'd probably try to simplify it all a bit using a bunch of 2d unit vectors - get a vector from the zombie to the player; get a vector to the zombie from each nearby zombie; get a vector perpendicular to the direction of travel if about to hit a wall (either left or right, depending on which detector is overlapping the wall) - then multiply them by various coefficients, and add them all together to get a new vector which is in the direction of travel. And then use a fastloop movement just to make absolutely certain that zombies don't end up waking through walls if something goes wrong.

    That actually works quite nice with the repel of other zombies! It might work even better in a straight iso view where Zombies can overlap each other a bit without it looking too strange?

    I have actually decided that I want to do a straight on ISO view. I tried to modify the example to make the zombies from this angle, but how it is working now they rotate like from top down. Is it possible to have them still move at the player but without adjusting their angle visually?

  • Use an alterable value called MoveAngle_ or similar and replace every instance of the Zombie's actual angle in the code. Then you could select your iso animation directions using MoveAngle_/11.25 so the zombies look in the direction they're moving.

    Keep in mind that a circle will probably make the movement look best, so consider leaving the zombie's collision as a circle without changing how the code works, and adding the graphic as a sprite pinned to it.

    Best person at writing incomprehensible posts. Edits are a regularity.

    Edited once, last by casleziro (March 3, 2020 at 1:36 PM).

  • here's what i meant:

    Ah nice thanks! :)

    This is starting to become a really solid example of zombie AI I think and a huge help! Is it possible you, MuddyMole or someone else could put in some comments in the events of what the events do? I want to study this and learn it so I can work from all this later and know what is actually going as I have never done these kinds of movements or events before and need to really try to learn it inside out.

    The only obvious thing I see missing now is a good way to adjust the "layering" of the zombies on the fly so that the ones that have the greatest Y cordinate are in front of the ones with the lesser Y cordinate. What would be the best method to do this? Should the layer object be used for it, or is that unnecessary?

    I guess it could be done with just running a constant fastloop for every Y cordinate from top to bottom and then if it finds a zombie at that Y cordinate it puts it in the front, but that sounds really slow for performance and not an optimal method?

    Steam games: Please login to see this link.

    Edited once, last by Outcast (March 3, 2020 at 2:19 PM).

  • Please login to see this link.

    To be honest, there's a LOT that could be changed to make it smoother and less buggy, but it was really just to demonstrate the basic idea.
    And yes, the layer object is your best bet for sorting, even though it's not great.

    Thank you! :)

    I noticed though that the Layer object is in the frame now but there is no event on it?

    What sort of things could be adjusted to make it smoother and less buggy and are they hard to do if I learn how all this works?

    Steam games: Please login to see this link.

  • Oh, I never meant to leave that extension there (was just checking something).
    Well, it's really more a lot of ideas that could be tried - some of which might help; some of which might make it worse...

    For example, I've been experimenting a bit with collision-detection between circles and map tiles (stored in an array), using maths rather than any built-in method. It's pretty maths-heavy, but the nice thing about it, is that you can find the precise point at which they collide, which could be useful in various ways. For example, you could easily get the surface normal, to make the zombie turn the right way to avoid walls (or for making objects bounce realistically off walls). You could also take the distance into account when prioritising zombie behaviours - so if a zombie is very close to a wall, avoiding the wall will be its top priority; if it's a little further away, avoiding the wall and avoiding other zombies will have equal priority; if it's very far away, avoiding zombies and moving towards the player will be top priorities.

    As I said before, I'd try to create vectors representing various "forces" that determine where a zombie moves, and then multiply them by their priority rating, before adding them all up to get a final movement vector.
    eg.
    - CurrentMovementVector
    - VectorTowardsPlayer
    - VectorAwayFromZombie (one vector for each nearby zombie)
    - VectorToAvoidWall

    That part should be relatively easy as long as you have a reasonable grasp of vectors (eg. know what a unit vector is, how to find the length of a vector, how to multiply a vector by a scalar, etc).

  • Ok thanks! , I have actually never heard of movement vectors as far as I know. Do you have any pointers on where to start learning about it? Examples or tutorials etc?

    As for the Layer Object, would just an always event that sort by Decreasing Y do it? It works, but not sure if there is a better way to do it?

    Steam games: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!