Improved Monster AI Ideas

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Re: Improved Monster AI Ideas

Postby Retraux Squid » Sun Feb 26, 2017 12:54 pm

It would probably go, code-wise, something like this:
>Monster shoots out invisible tracers in all directions to give them an idea of the environment around them.
> They choose the longest direction (which would lead them out of cover), and strafe until they have line of sight to you.
> Once they establish LOS they shoot a few bursts, then strafe in the direction they just came from to get back into cover.
User avatar
Retraux Squid
Joined: 13 Aug 2016
Location: E1M1

Re: Improved Monster AI Ideas

Postby Kaminsky » Sun Feb 26, 2017 2:28 pm

I know that in a game like Counter-Strike Source, bots were able to explore maps and use its surroundings to their advantage with the help of a separate navigation (.nav) file that was part of a map. It could tell the bots the traversable areas of map, potential places of cover (crates, pillars, small ledges, other doodads) were around the map and hazardous areas to avoid.

I think a similar concept could be done for ZDoom where maps can be analyzed when they are first loaded and the lines/sectors/things can all be collected and used to create vantage points that monsters will have knowledge of and can make good use of. These points can vary from being areas to ambush targets, take cover or avoid completely.
Joined: 12 Dec 2016

Re: Improved Monster AI Ideas

Postby Caligari87 » Sun Feb 26, 2017 3:58 pm

The problem with solutions such as this is that there's no way for the computer to pre-determine what would be a "vantage point" or "cover" (at least not without significantly powerful algorithms). It works in games like FEAR because that kind of thing is tightly controlled and pre-determined by the level designers, and they have highly complex pathing and decision-making structures to support it.

A more feasible solution for Doom would be to have monsters "think" about possible paths and locations in an organic fashion by using wandering versions of themselves. Say a zombieman, for example, has itself, and several "imaginary" zombiemen that wander randomly around it in a relatively close radius while trying to maintain line of sight with the real zombie (or being dropped when they break LOS and spawn a new one). They report if they have broken or gained line-of-sight to the player's last known (not real) position (itself marked by an "imaginary" player). They could also stop on health or ammo when they encounter it, if the zombie takes advantage of such things. The real zombie can then have a decision tree for which of these imaginary zombies it walks toward, depending on health, nearby friendlies, ammo, etc. A more "intelligent" enemy would have more imaginary versions of itself it can work with.

Another mitigating factor is that most enemies in Doom are not fast or strong enough in comparison to the player for any of this to make any difference. The player won't notice any additional subtly in most of the monsters unless they're significantly stronger or faster. For 90% of cases it's enough to set "afraid" on the monster when certain health ratios or range checks are met.

User avatar
I'm just here for the community
User Accounts Assistant
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: Improved Monster AI Ideas

Postby Ravick » Mon Feb 27, 2017 12:25 am

Nash wrote:(...)
Let's say, if a group of shotgunguys is chasing you, the ones in the end of the mobwill avoid firing until there is no more shotgunguys in front of them

ZScript can already do this; what you'd do is fire a small cone of LineAttack or AimLineAttack (use a for loop) and for each trace, make sure the received LineTarget isn't of its own kind (using the "is" operator). If a trace hits its own kind, it's considered a fail. If even 1 trace fails, consider the attack has failed and abort the attack. If all traces do not fail, proceed with the attack. It's actually much shorter in code than it is to type this, haha.

Humm... Could I do that using ACS and DECORATE? Or maybe only DECORATE? (Please note that I'm not a ZScript hater, it is just totally new for me for now, and I'd like to try with languages I'm used to for now. And I'm planning to implement it in already DECORATE based actors.)

I've seem in the wiki: "Note that AAPTR_GET_LINETARGET is identified as AAPTR_LINETARGET in DECORATE."

But I could not find how to take this date from the LineAttack. Is it possible without ZScrit?

ALso, I can't find AimLineAttack documentation. Is it restrict to ZScript?


Thanks in advanced!
User avatar
Do what thou wilt, since you don't bug the hell out of me!
Joined: 22 Aug 2010
Location: Tubarão, Brasil

Re: Improved Monster AI Ideas

Postby Octavia Packlestock » Mon May 31, 2021 7:13 am

Some cool monster functions for ai are the avoidmelee flag, where a monster will back up if an enemey is too close, frightend flag where it will run away but still shoot at you a bit, and changing it's a_chase to a_fastchase, will cause it to randomly strafe left and right, which makes them really hard to hit with missiles.
Octavia Packlestock

Re: Improved Monster AI Ideas

Postby Matt » Thu Jun 03, 2021 3:30 pm

Interesting to bump this now that ZScript is a vastly more mature tech than it was last time anyone posted here.

...and I still can't imagine anything better than Retraux Squid's raycasting, at least not without a serious risk of bogging down the entire system the instant you try to play anything more complex than the original Doom maps on medium.
User avatar
Putting the XD into *xdeath since 2007
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia


Return to General

Who is online

Users browsing this forum: doomg1337fuck, DOOMPiter and 3 guests