Page 1 of 3

Shades of doom

Posted: Fri Oct 31, 2003 3:03 am
by Sphagne
My current project "Elidor" is not progressing well, you know why? because I am an RPG game fan and "Morrowind" and "Pirates of the Caribbean" are taking the little time I can spare for my computer hobbies.

But also because I want to make Elidor an RPG doom mod a bit like "DeusEx" and let the players advance their skills and stats during the game, and one of the skills that I want to give the players to work on, is stealth, and I have found a way to script it into the levels, by the help of ThingHate and a few other tricks, but while thinking about a new and better AI for doom monsters, which I posted in this thread, I found a better way to incorporate stealth into doom levels, this time not by ACS scripts but by changing the game logic a bit, and this fact has stopped my process in Elidor totally.

Thats right, because scripting stealth into the levels takes a lot of time and effort and while there was no other way to do it, I thought it worth while, but now I think that it is a waste of time, and would change the levels a lot, so if/when the "Actor Sight calculation" find it's way into the ZDoom engine, I would have to revamp my levels totally to remove the scripted stealth system from my levels and use the engine based one.

The trick to add an engine based stealth feature to the game is to change the actor code when we calculate the actor sight and target position to decide if the actor would see the target and would wake up by it's sight.

I have not looked into the code, but currently there is a function which takes the actor and target positions and looks at the level geometry to decide if the target in the view port of the actor to decide if the actor can see the target, well we can add a new calculation at the end of it to decide if there is enough light for actor to see the target, i.e. is the target is not hidden in a dark place.

In the old thread I had testes a lot of different formulas and had come out with a formula which I think is good for the purpose and here it is:

dMax = (L*L*S*V)/dFactor

dMax = Maximum visible distance
L = Target sector light value
S = Actor sight power
V = Target visiblity factor
dFactor = Global distance factor

And I think that a distance factor of 360000 if an optimum value for it.

We should have two new properties for our actors Sight-power and Visiblity, and their default value for any actor could be 100, but these values could be changed via Dehacked for the entire race of the actors and via ACS for particular actors, so that we could have specialized actors like short sighted ones of special troops with night vision headsets.

Whenever an actor sees a target, after calculating if the target is in the view of the actor, the engine can calculate this formula, taking the actor sight power, and target visiblity factor, and the light intensity of the sector that contains the target, and a global distance factor, to see if the target is within the maximum visible distance of the actor, so if the result is negative then the actor would not see the target, exactly like when the target is behind a closed door, so the actor would ignore the target.

Randy, would you implement this feature inside ZDoom, please, pretty please? :D because I think that it is a good addition to the game and would start a new flow of stealth based levels in which the players should stick to dark corners or maybe turn the room lights off and so on.

We can have a new MAPINFO command to let the level designers to turn this feature on, for their levels, so that the older levels would not be affected by it, and maybe we could have an option in the game options menu to turn it on for all the levels, so that we could try the older levels with this feature turned on.

And I think that we may change some current items and features behaviours while this feature is turned on, for instance:

Blur Sphere may halve the visiblity of the player while it is working and also the blurred monsters would have half of the visiblity defined for their race.

Stealth monsters should have visibility of zero when they are hidden. This applies to the hexen swamp monster as well.

When the actor's sprites are full bright (shooting frames) then their visibility should be double their normal visibility. This also applies to etire frames of lost souls and projectiles.

When actors are moving, then their visiblity should increase depending on their movement speed, we may also decrease their sight power a bit as well.

When an actor is shot by another actor, it should ignore the sight calculation formula totally and should become instantly aware of the target.

Please think about it Randy, and if you don't have the time to work on it, please assign another person to work on it, because I think that it would become a good feature for your ZDoom port.

I think if/when you implement it into ZDoom, from then on lots of the level designers would add stealth to their list of design decision parameters, and would use it in their levels.

Posted: Fri Oct 31, 2003 3:15 am
by Sphagne
I forgot to add, the MAPINFO entry can be like this:

EnableActorSightCalculation [Distance-Factor]

Which would let the level designers tweak the default Distance-Factor.

Re: Shades of doom

Posted: Fri Oct 31, 2003 3:18 am
by HotWax
You seem to be pretty smart and have thought all this through and have a pretty solid plan of what you want done already. Have you considered making a source modification yourself and releasing the source code along with your custom mod for others to use? Don't get me wrong, you have some great ideas, but IMHO ZDoom was never meant to incorporate such non-standard features into its core executable. Support for better graphics, or a few features that don't significantly alter Doom, fine. Enhanced scripting, whatever. But what you're asking is for ZDoom to specifically support a specific method of enhancing the AI (in this case to allow for a player stealth factor) and I see that as belonging to a completely separate mod based on ZDoom, but not inherently part of ZDoom.

If you can work out the scripting, you probably have the talent to figure out how to modify ZDoom's source to implement these changes yourself. And once you're done, you *might* even convince Randy to add them in, heh.

Posted: Fri Oct 31, 2003 3:32 am
by Sphagne
Sadly I dont program in C and I have a plan to switch to C programming, but it will take some time.

Posted: Fri Oct 31, 2003 4:27 am
by Chris
You know, I think this would be something good to put into ZDoom. This time I don't agree with HotWax's asessment that this shouldn't be put into the main game because if something like that was "against the rules", ZDoom wouldn't have adopted the better monster AI that was presented first in, I think, DOSDoom. In fact, if there's enough work on it, you could add a "MonsterDifficulty" or "MonsterAIType" option. I think it'd be best if such a thing was controlled in MAPINFO, as it's easy enough to make it affect the whole game with two simple lines:

Code: Select all

defaultmap
MonsterDifficulty 2  # Plus additional args as required for the prefered type
You could also add a monster sight attribute to Dehacked which could also influence how well it can see, which can also be changed with an APROP_ ACS setting. Higher values can even add night vision, or heat vision, capabilities to monsters with better aim, while lower values make them go blind and aim worse at farther distances.

Posted: Fri Oct 31, 2003 4:34 am
by Sphagne
No need for night vision and heat vision to be different from keener sights, just adding the sight power would result in the monsters seeing into the darkness, better than others.

As for if a feature is good enough to be added to the engine, I thing that ThingHate was suggested by someone that I dont remember now, and water line teleport and true 3d elevators like dike3d were suggested by yours truely, not original but both implemented and good features.

So I thought I could try it again to see if I can make the Doom guy a bit more cautious.

Posted: Fri Oct 31, 2003 4:47 am
by Chris
No need for night vision and heat vision to be different from keener sights, just adding the sight power would result in the monsters seeing into the darkness, better than others.
That's what I meant. ;) I also see now that you already mentioned it.. I just want to add/explicitly state that the S(Monster Sight) calculation can, so to speak, overflow the math, so it can see better than normal(no, I don't mean overflow the integer as in a programing sense.. that would be bad). The math would also affect when a monster decides to attack too, not just wake up.

Posted: Fri Oct 31, 2003 5:24 am
by HotWax
Sphagne wrote:As for if a feature is good enough to be added to the engine, I thing that ThingHate was suggested by someone that I dont remember now, and water line teleport and true 3d elevators like dike3d were suggested by yours truely, not original but both implemented and good features.

So I thought I could try it again to see if I can make the Doom guy a bit more cautious.
ThingHate is an extension of something that already existed in Doom. Even in Vanilla Doom, every enemy had a current target, assuming it was awake. Usually it was the player, but if another enemy damaged it, it might switch its target to the new one. Once an enemy's target has died, code is executed to determine the next target and so on. The ThingHate scripts simply allow the designer to directly interface and influence commands that were for all intents and purposes already there. It also allowed for more control during cutscenes, etc, a logical extension of what ZDoom could already do with cameras, etc etc.

The water line teleport was a natural extension of the deep water added by Boom. Since Doom's creation, water has been no different from any other floor except for being animated. Heretic enhanced it with splash graphics and sounds and the visual sinking of the sprite "into" the floor, Boom enhanced that further with fake floors that could simulate being underwater, and Randy enhanced it even further by allowing the special teleports, enabling the designer to create the room-over-room illusion using the quite convenient deep water effect that prevents seeing both rooms at once. The room-over-room stuff has been a desired addition to Doom since day 1. In fact Boom also added specials (silent, angle-preserving teleport) designed precisely for the purpose of accomplishing that illusion.

3D elevators are a natural extension of allowing sectors to execute multiple movements at the same time. Doom allowed a sector's ceiling to move, and it's floor to move, but not at the same time. Boom extended the movements to allow the designer to do just about anything, and allowed for a sector to execute multiple actions at the same time, including moving both floor and ceiling. The "realistic elevator effect" is simply an extension of this to make it convenient for a designer to be able to move both floor and ceiling at the same rate in the same direction without needing multiple specials triggering to do it.

My point is, all of these features are a natural extension of what was already there. Monster AI in Doom is almost an oxymoron.. There really is none. Monster wakes, monster walks towards target, if monster can see target, monster shoots. Certain codepointers were built in to affect the way in which they follow this simple script, but overall monsters act on very very basic code. What you want is to implement a very specific system allowing the monsters to interact with light levels and the player's "stealth level", something that wouldn't be desirable in stock Doom levels or most PWADs, something that is very specific to a certain method of play. In my very humble opinion, it simply isn't something that needs to be shoved into the base code.

That's all I'm really trying to say, and I of course don't expect everyone to agree with the way I think.

On the subject of C, keep in mind that ACS is based around C. If you're any good at that, as you must be to implement such a complex stealth system, then I think you'll find it easier than you expect to jump into the ZDoom source code and start fiddling.

Posted: Fri Oct 31, 2003 6:52 am
by Lexus Alyus
Deus EX, interesting game... Been playing it a lot recently, I got to Hong Kong. Man, that sword Rocks big time :-D. I just hatew the slow re-loads, the slow firing and the slow movement (wanted to run from a guard, the room was likea mile long, I didn't even get a centimeter befoe I was blown to pieces...). But then, the game is totally differant from doom, if you go in playing it like it was doom then your not gonna get past the training missions :-D. I like it, but I also like fast paced arcade action, now that's cool! :-D.

I think this AI idea would be good thiung to incorparate, it would be nice to see a doom level with stealth espianage action and all that. I was always thinking, as regards to footstep sounds, maybe the monsters can hear them when you run, so it wakes em up, but not when you walk, loads a games have incorperated that idea since Half life. Secondly you'd have to styay a way from water areas, as that would attract the monsters (the splashes). One simple way to make this sort of thing would work, but mean that you can't allow the monsters to see you a t all, asnd they would automatically continue tyo hunt yoiu down which would kinda ruin the effect. Not only do we need this sight thing, we also need a thing tha makes thew monsters give upo looking for you if they see you. In Deus Ex if you are just glimpsed at the guard will get suspiciouse and check out the area, if you then move quietly away while the guard is searching for you, he will just walk away and say "oh, it was nothing". How cool is that!? If a monster sees you in doom it makes ity it's life time ambition to follow you, we need to get over that part first, that way, if the monster edoes see you, it can chase after you, but if it losses sight of you for a few minutes it then goes into search mode, then it will return to it's original path node or something. Kinda like Metal Gear Solid (great game :-D). Also, this would require us to make the monsters stronger and the player weaker, otherwise you could just go all AWOL and just kill everything, thus resorting back to dooms original mode of play thus spoling the effect...

I reckon this shoud be an editor option, so it's there, but you must incorperate iot yoursalfe, maybe make it a script command, like "SetMonsterSight" and "SightTime" (Where monster sight is a variation of what Sephnage first said and Sight time is how long the monster hunts the player before it returns back to guard or idle mode). Also, by just changing the monster sight sound to something like "stop there!" or "Intruder" and making the idele sound a random thing like "man, this shift sucks" or "This is gonna be another long day" you wouldn't have to incorperate anything else. Plus, you could set a script that is activated when the monster sees you, so this could trigger an alarm so this whole army teleports in to try and hunt you down (then when the monser goes back toidle the army dissapear). This way you would constantly be trying to avoid the mosnters gaze. I think this option is far better than making it hard coded into the Zdfoom code; it's a nice thing for editors, plus it doesn't interfere with dooms mode of play. Plus if you combine it with the thing hate you can have allies and really develop the story... it leaves it in the creators hands and gives us another potential tool to harm ourselves with :-).

:twisted:

Posted: Fri Oct 31, 2003 11:04 am
by Ultraviolet
Sphagne: You make the most interesting typos, like "testes" and "dike3d." Heh.

Posted: Fri Oct 31, 2003 11:44 am
by Sphagne
To ultraviolet: heh :wink:

To lexus Alyus: Good ideas there, and if you have the patience and read the thread that I have linked at the begining of this post, throughout, you will find out that I had suggested a method in which the monters would locate the place that you were last seen and would try to reach there, then after they reached there and did not see you, they would find a Report node in the AI net and would report a failure in their last mission (investigate of the intruder) and return to their last mission. In that node we could play a sound of "ah nothing" or so, also in their idle tasks we can add the sound emmitions that you mentioned.

Although implementint the actual AI net would require lots of work... :wink:

To HotWax: Each has a right to have an opinion on the matters, do you play vanilla doom nowadays?

P.S. this feature is not such a hard task to add compaired to my previous threads, and as it would be a purely optional design decision, then it would not be a problem for the designers that would not want this feature, and its addition would be a great help for the likes of me which reqire this feature for our mods, and also would add a new style of level design for the designers in between.

Posted: Fri Oct 31, 2003 1:36 pm
by HotWax
Lexus Alyus wrote:I think this AI idea would be good thiung to incorparate, it would be nice to see a doom level with stealth espianage action and all that. I was always thinking, as regards to footstep sounds, maybe the monsters can hear them when you run, so it wakes em up, but not when you walk, loads a games have incorperated that idea since Half life. Secondly you'd have to styay a way from water areas, as that would attract the monsters (the splashes). One simple way to make this sort of thing would work, but mean that you can't allow the monsters to see you a t all, asnd they would automatically continue tyo hunt yoiu down which would kinda ruin the effect. Not only do we need this sight thing, we also need a thing tha makes thew monsters give upo looking for you if they see you. In Deus Ex if you are just glimpsed at the guard will get suspiciouse and check out the area, if you then move quietly away while the guard is searching for you, he will just walk away and say "oh, it was nothing". How cool is that!? If a monster sees you in doom it makes ity it's life time ambition to follow you, we need to get over that part first, that way, if the monster edoes see you, it can chase after you, but if it losses sight of you for a few minutes it then goes into search mode, then it will return to it's original path node or something. Kinda like Metal Gear Solid (great game :-D). Also, this would require us to make the monsters stronger and the player weaker, otherwise you could just go all AWOL and just kill everything, thus resorting back to dooms original mode of play thus spoling the effect...
So basically you're saying that this change would require other changes that when all complete would completely change the nature of Doom.

Does anybody else think he's proving my point for me?

Posted: Fri Oct 31, 2003 2:09 pm
by Sphagne
My point is that with ZDoom we can make levels that would feel and look exactly like Doom 1 levels and we can make totally different things, ask Cyb if you like, and this new addition would add a new era for the level designers. I think that you do not like ACS and the opportunities that it have given us, hmm?

I was adding this stealth feature by ACS but I thought that by adding it to the engine, we can let the level designers to have it just by adding a line in the MAPINFO, not like me by doing double the total work required for a level design just to add it in my levels.

Chris, thanx for your support, :-) what is the new AI thingy you wrote about in your first post?

Posted: Fri Oct 31, 2003 2:20 pm
by Graf Zahl
Enhancing something is always a good thing, as long as the original functionality is not destroyed.

I do think, however that this is again going too far because it's a massive non-trivial amount of work and there are really more important things to do first.
Before even thinking about altering the AI there should be something there that helps better customizing the game with its current gameplay features.
Thinking about AI enhancements before even a shred of DoomScript has been released is utterly pointless IMHO.

Posted: Fri Oct 31, 2003 2:39 pm
by Chris
Just a new AI option-selector. Either you could make a difficulty scale(greater numbers make enemies tougher), or an AI-style selector, so 0 would be normal AI, 1 would be the enhanced AI, 2 would be enhanced AI with the extra sight checking, ect. So:
defaultmap
MonsterAIType 2 4096
would basically select the enhanced AI with enhanced sight calculations, with a global view distance of 4096(at 100% sight, no monster can see farther than 4,096). The monsters could, however, have their sight value put higher than 100%, so they could see better in the dark, and see farther away than that.