Doom monster
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Newfangled Doom > Doom 3 General > Some vanilla Doom code found in Doom 3
 
Author
All times are GMT. The time now is 18:31. Post New Thread    Post A Reply
Quasar
Moderator


Posts: 6175
Registered: 08-00


We're not sure if it survived all the way through the entire id Tech engine chain or if it has come and gone a few times, but:

http://pastie.org/8122797

This function is a direct modification, comments and variable names preserved, of a portion of the DOOM source, a function originally named P_NewChaseDir, and is the core of the DOOM AI "wandering" behavior - try a direct path; if that's blocked, try a non-reversal direction; if that's blocked, maybe turn around and move the other way.

We need to trace this back and see if it's really been in there the whole time ;)

EDIT: I give you the full history of the code. Interestingly, though not surprisingly, it does drop out of the tree in Quake 3, as that game had no single player mission and thus no need for ordinary AI.
http://eternity.mancubus.net/text/p...dir_history.txt

Last edited by Quasar on 07-11-13 at 01:55

Old Post 07-11-13 00:21 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
printz
CRAZY DUMB ZEALOT


Posts: 8910
Registered: 06-06


It's even in Wolfenstein 3d, in three variants even: pastebin.com/ASBNvLfm (wl_state.c)

__________________
Automatic Wolfenstein - Version 1.0 - also on Android

Last edited by printz on 07-11-13 at 09:31

Old Post 07-11-13 07:48 #
printz is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
MFG38
Member


Posts: 515
Registered: 05-13


Interesting.

__________________
I am mad. I am Finnish. I am a gamer. But I don't know where the number 38 came from.

Old Post 07-11-13 09:31 #
MFG38 is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
printz
CRAZY DUMB ZEALOT


Posts: 8910
Registered: 06-06


Might explain why monster AI still is shitty and has barely evolved. Are the Rage monsters equally bad?

__________________
Automatic Wolfenstein - Version 1.0 - also on Android

Old Post 07-11-13 09:39 #
printz is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
kb1
Member


Posts: 460
Registered: 11-06


Holy crap - what a nice find! So much for "he starts with a blank code window for each game"...

Old Post 07-11-13 23:18 #
kb1 is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
Gez
Why don't I have a custom title by now?!


Posts: 11557
Registered: 07-07


This is not part of the rendering engine.

Old Post 07-12-13 08:59 #
Gez is online now Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
Springy
Senior Member


Posts: 1370
Registered: 09-12


Great find Quasar! I've not played Rage so I'm not sure what the monster behavior is like but this is certainly an interesting find.

Old Post 07-12-13 12:14 #
Springy is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit || Quote
Quasar
Moderator


Posts: 6175
Registered: 08-00



kb1 said:
Holy crap - what a nice find! So much for "he starts with a blank code window for each game"...

It's never been true, not even for Quake and its supposed total engine rewrite. It's pretty clear that what happened was that Carmack took the DOOM source code directory, made a copy of it, and then started pruning game-specific crap til he was left with a minimal framework and some utilities. This is how wad.c and zone.c (the latter in particular) are intact, and some other file names and such still remain the same even though the contents may be radically different. Other code may have been brought back in after having been cleared out, such as this scrap of the AI, when it became clear later that the same approach with some minor modifications would work in the new game.

DOOM itself, though you could hardly say it is based on Wolfenstein, did grow out of what I describe as a "cloud" of transitional engines - see Shadowcaster and RoTT in particular - which were largely still based on it, the former having colormap distance fading and DOOM-like sky drawing; the latter using an alpha form of DOOM's patches, DOOM's wad files, and DOOM's memory allocator. I have little doubt that the "code cloud" started life in the same way, as a direct copy of the Wolf source which was quickly cleared of everything but basic utilities and then rebuilt back up.

My question at this point would be if Wolf started as a copy of Catacomb 3D, and Catacomb 3D as a copy of Hovertank 3D :P

Old Post 07-12-13 16:23 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
Quasar
Moderator


Posts: 6175
Registered: 08-00


I have to bump this thread because, thanks to Blzut 3, we've discovered this code is also in the Catacomb games and in Hovertank.

Here's the Pascal version of it that appears in Catacomb:
https://github.com/FlatRockSoft/Cat..._PLAY.PAS#L1009

And the version that is in Hovertank 3D:
https://github.com/FlatRockSoft/Hov...HOVACTS.C#L1341

If you check out IDASM.ASM in Hovertank, you will also find the same random number table used by the Doom engine, and the zone memory system seems to be based loosely on a cleanup for 32-bit of the MEMMGR.C file.

So, Doom 3 has code from the earliest id games :)

Old Post 06-05-14 12:58 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
doomgargoyle
Banned


Posts: 498
Registered: 12-13


Hovertank needs a remake! :)

Old Post 06-05-14 15:31 #
doomgargoyle is offline Profile || Blog || PM || Email || Search || Add Buddy IP || Edit || Quote
FireFish
Forum Regular


Posts: 670
Registered: 04-13


This would not be hard to believe as doom 3 its AI feels simplistic while playing, even though it is never easy to figure out an AI while programming.

I wish i had recorded this, but in my last doom 3 play session i severely confused the doom 3 AI beyond to funny to watch.

I was in a room where there is a Pipe hanging down to the floor with behind that a desk on which you can jump in a way you are blocked in movement except one angle to get of the desk. When i was standing there two zombies came out of a doorway in their 'to dead' to walk animations and when they could see me they just started twirling around standing still on one leg because the AI could not figure out how to get to me.

They where rotating like a carnival attraction around a fixed axle without moving from the spot, and they kept doing that until i left that location.

Old Post 06-05-14 16:50 #
FireFish is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
Quasar
Moderator


Posts: 6175
Registered: 08-00



FireFish said:
...because the AI could not figure out how to get to me.

They where rotating like a carnival attraction around a fixed axle without moving from the spot, and they kept doing that until i left that location.


Yeah. The AAS stuff doesn't always degrade gracefully in the presence of completely unanticipated architectural features. If you get into an area with no AAS links at all (not just ones the monster doesn't think it can fit into) the monster will go completely dormant, which if you ask me isn't very realistic either. As soon as you re-enter an area with an AAS link to the one the monster is in, it suddenly starts running back to find you.

Old Post 06-05-14 20:54 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
FireFish
Forum Regular


Posts: 670
Registered: 04-13


A late continuation :
One thing i have noticed is that burning zombies, or unarmed ones seem to be the easiest to force into funny AI based behaviours.

funny burning zombie ;
There is an area where a burning zombie walks out of small maintenance corridor into a hallway. In that hallway there is a medium sized crate.
I jumped on top of that crate (dont ask me why) and the burning zombie just started strolling the hallway... turns around... strolls again... and it repeated that until i killed it while on the box, it kept ignoring me even when hit.

And in that same play session i experienced similar things with other melee zombies.

Old Post 06-08-14 03:34 #
FireFish is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
Megamur
Senior Member


Posts: 1400
Registered: 02-11



Quasar said:
If you get into an area with no AAS links at all (not just ones the monster doesn't think it can fit into) the monster will go completely dormant, which if you ask me isn't very realistic either. As soon as you re-enter an area with an AAS link to the one the monster is in, it suddenly starts running back to find you.

I always kind of liked that: If you can't reach your opponent, retreat and lure them back to you.

But wow, that's amazing that some ancient Id code (heck, proto-Id, really) worked its way all the way up to one of the biggest technical marvels in PC gaming of the dawn of the new millennium.

Old Post 06-08-14 23:50 #
Megamur is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
printz
CRAZY DUMB ZEALOT


Posts: 8910
Registered: 06-06


Does Rage look like it has that too?

__________________
Automatic Wolfenstein - Version 1.0 - also on Android

Old Post 06-08-14 23:58 #
printz is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
Solid Snake
Member


Posts: 412
Registered: 06-09



kb1 said:
Holy crap - what a nice find! So much for "he starts with a blank code window for each game"...


He may still start with a blank code window he just puts this code in the same as other games, dosen't mean he copied it.

Old Post 06-09-14 13:28 #
Solid Snake is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
Quasar
Moderator


Posts: 6175
Registered: 08-00



Solid Snake said:


He may still start with a blank code window he just puts this code in the same as other games, dosen't mean he copied it.


That's true, and for his renderers he has definitely always started with a "blank window". But when it comes time to marry that new renderer with a game engine, the way it was gone about seems to have been to always keep whatever could be useful from the previous iterations, and rewrite it progressively if necessary. The MEMMGR file is a good example, as you couldn't use that code as-is in a 32-bit program, yet, it was still obviously the basis for Doom's z_zone system after a heavy rewrite.

Old Post 06-09-14 13:44 #
Quasar is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy IP || Edit || Quote
DoomGater
Junior Member


Posts: 173
Registered: 08-04


OF COURSE does Carmack start with an empty code window. The he moves his curser to the file menu and clicks 'open' ....

Old Post 07-22-14 14:47 #
DoomGater is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
Caffeine Freak
black and shiny


Posts: 748
Registered: 05-10



Quasar said:

Yeah. The AAS stuff doesn't always degrade gracefully in the presence of completely unanticipated architectural features. If you get into an area with no AAS links at all (not just ones the monster doesn't think it can fit into) the monster will go completely dormant, which if you ask me isn't very realistic either. As soon as you re-enter an area with an AAS link to the one the monster is in, it suddenly starts running back to find you.



As someone who's been working with id Tech 4 for over 5 years, I can say that this type of situation is more a fault of the level design than the AI code. The AI doesn't work on the basis of AAS links, (what you're describing is more along the lines of the node-based system the CryEngine uses) it works by analyzing and calculating map geometry and clip brushes and subsequently finding paths and 'reachables', both during map compilation and in real-time.

If you think of a blind man feeling his way along all the brush geometry (not models or patches, the AAS ignores those), and then recording everything he touches, that's similar to what the AAS does when you BSP a map. The more polygons and vertices there are, the more the AAS has to calculate. This is where the job of the level designer comes in. He should be familiar with the capabilities of each monster, where they can fit in and what the overhead height limits are for each one. The level designer performs collision mapping, which optimizes the AAS by making sure, for instance, that it doesn't make calculations for the space under a table when the monster can't even go down there.

So in short, level designers have to keep in mind the limitations of each monster, and also all the possible ways a combat scenario could play out. That's part of their job. In the instance of a crate the player can jump onto where a zombie can't, the level designer could either create a small series of monster clip brush steps that the zombie could use to step up, or just make sure the crate isn't wide enough to where the zombie can't reach him from the ground.

So yeah, when you see something like what FireFish described, that's more than likely faulty level design, not faulty programming.

Last edited by Caffeine Freak on 07-28-14 at 04:31

Old Post 07-22-14 23:10 #
Caffeine Freak is offline Profile || Blog || PM || Search || Add Buddy IP || Edit || Quote
Maes
I like big butts!


Posts: 12877
Registered: 07-06


Talk about not fixing what ain't broken...

Old Post 07-25-14 11:34 #
Maes is offline Profile || Blog || PM || Homepage || Search || Add Buddy IP || Edit || Quote
All times are GMT. The time now is 18:31. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Newfangled Doom > Doom 3 General > Some vanilla Doom code found in Doom 3

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.