Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
cubasy

Smarter enemy AI?

Recommended Posts

So I'm programming some zombie monsters with Decorate, they simply just walk up to the player and melee attack if close enough. However, the AI for the enemy just, well, sucks. I've got two sets of spiral stairs that meet up (see the image,) but the monsters won't walk up the stairs when you stand at the top, instead, they just group together in between the two sets of stairs (again, see image.) It's really a pain, because I'm programming a Nazi Zombies mod, and the zombies won't come after the player (because of the stairs.)



If anyone has a script for smarter AI, I could really use it right now. (by the way, maxstepheight for the zombies is set to 32.)

Share this post


Link to post

Make the screenshot smaller, I don't think people like stretched pages.

As for making the AI smarter, I don't think that is exactly possible. You might however be able to 'lead' them to the stairs with Block Monster line-defs. That's really the only way.

Share this post


Link to post
PRIMEVAL said:

You might however be able to 'lead' them to the stairs with Block Monster line-defs. That's really the only way.


This. If you use sharp "V" shaped monster block lines you can heard them towards the stairs.

Share this post


Link to post
PRIMEVAL said:

Make the screenshot smaller, I don't think people like stretched pages.

As for making the AI smarter, I don't think that is exactly possible. You might however be able to 'lead' them to the stairs with Block Monster line-defs. That's really the only way.


Resized the image, sorry 'bout that.
Hmm, the zombies in Doom of the Dead seem to walk up stairs, I'm gonna try to copy some of its code and see what it'll do.

Share this post


Link to post

The way to have the most control over monster behavior is to just erase all its decorate stuff so its just a dumb non moving rock. Then do whatever you want with ACS instead. But that's 'advanced' I guess and you'd have to tell it exactly what to do on each frame and do collision checking/etc.
Otherwise:
http://zdoom.org/wiki/Thing_SetGoal
and maybe search 'patrol' or something, been awhile since I used this stuff.

Share this post


Link to post
DeathevokatioN said:

This. If you use sharp "V" shaped monster block lines you can heard them towards the stairs.

The only problem with this is that the players will be able to camp outside of the monster block lines so the zombies won't get them.
Anyways I'm examining some code from another WAD that might help me out.

Share this post


Link to post

you could try useing A_wander and A_Chase together so they randomly walk a certain direction for a few seconds then chase after the player. This might allow them to get away from certain walls and hopefully walk more towards the player.

the only true way to make monsters truely persuit players is with pathing, which is present in modern games it basically makes a line from the monster and draws it towards the player but the path line cant move through path blockers so it has to go around. Thus it allows monsters to move through mazes n such to get to the play and not get stuck on walls.

basically doom monsters only move towards their target in a line and if there is a wall there then they will just keep running into the wall to get to the player.

doom just doesnt support modern pathing, however you can make monsters follow a path, im sure you can make lines that make it so monsters that cross it have to walk down a certain path rather than just going in a straight line to attack the player.

Share this post


Link to post
cubasy said:

The only problem with this is that the players will be able to camp outside of the monster block lines so the zombies won't get them.
Anyways I'm examining some code from another WAD that might help me out.


To get around this problem, assuming you are mapping for a higher level source port like ZDoom, is to use ACS to turn monster blocking lines 'on' and 'off'

You need three parallel linedefs to do this. The middle one is the block monster linedef, and you give it a lineid of, say 100.

The linedef on one side of that centre linedef triggers a script that executes the command "Line_SetBlocking (lineid, setflags, clearflags)"

So in this case, you would set thT linedef to execute Line_SetBlocking(100, 2, 0); which turns on the "block monsters only" flag and the linedef on the other side of the middle one to execute "Line_SetBlocking (100, 0, 2); which will clear the block monster flag.

refer here

It is a bit of a hacky solution, but I have used it here and there to funnel monsters depending on where the player is at a given moment.

Share this post


Link to post

As other people have suggested, funneling your monsters where you want them is your best bet. Be careful with 'block monster only' lines, as this will also prevent floating monsters from reaching you.

An alternative to 'block monster' lines is a small but deep (>24 units) split in the floor. You cover the gap by a fake floor texture (eg by Boom 242 property) so it won't be noticed. Walking monsters are unable to cross it, while floating monsters still can.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×