DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

An actor checking for other actors
Page 1 of 1
DieHard Wolfers Forum Index -> DieHard Archives View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
This forum is locked: you cannot post, reply to, or edit topics.This topic is locked: you cannot edit posts or make replies.
Author Message
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Fri May 28, 2004 7:43 pm
   Subject: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I was wondering if there's a way to make an actor check for other actors the same way it checks for the player. My goal is to have it so that a guard will react if he sees a dead guard. I've tried a few different things to make CheckSight look for other actors and see if one of them has the flag "FL_DEAD" (a new flag which is set once an actor gets killed.) However, nothing I've tried ever produces the desired effect... the patrolling guard just walks right past the dead body as though nothing was wrong.

Does anyone know what I could add that would make the guard "see" other guards, the way he can "see" the player?
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 903
Location: Seattle
usa.gif

PostPosted: Fri May 28, 2004 8:17 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've always found this odd myself. You kill a guard, then hear a door open, and hide.
(guard's mind)
Hmm hmm hmm... life is great... skeleton here... cage there... got my 4 bullet clip ready... wish the military had assigned me more hit points... oh no! Morton, you old fool! I just mopped that floor! Oh well... hmm hmm hmm... keep walking... you know I wish they'd assigned me to that castle in Spain... I hear the guards there get to pick up those health packs that we litter the floor with... I wish Morton would get on cleaning those up, or at least sticking them in those pushwalls we don't get to push. Oh, there he is again... still dead. Eh, it happens. Still, dammit Morton! All over the floor! And you didn't leave behind your clip so I could walk past it awkwardly and pick it up! Ah, hell, I'll get that guy who looks exactly like me and everyone else to mop up the mess after our elevator is used to go to that next floor where we guard those secret plans...
(you jump out of your corner and knock the SHIT out of him)
Haven't you all felt like that? As for the code aspect of the problem, there are a multitude of cheap ways to get that to work, one not nearly effective enough, and the other way too effective.
The former involves a dead guard dropping an item only a guard can pick up, at which point madenoise = true (he alerts everyone else), and it's pretty cheap and not very effective.
On the other hand, you could make it so that you have a rotting corpse that just keeps yelling: have a dead corpse constantly emit the madenoise signal if you're in its area. This can be a bit awkward, as a deaf guard will completely ignore it, where as another guard may see the deaf body through the walls!
I don't have the source with me, but I'd suggest poking around wl_state.c, and making the guards check the coordinates of dead guards as well as you; you might make a structure containing the coordinates of every dead guard (though it sounds slightly inefficient to me), or you could just go through the entire objlist to see if any coordinates of dead guards are within view.
However you do it, I would suggest making sure the guard makes noise when he notices this; nothing worse than a guard noticing a fallen comrade then marching off to join the poor bastard!

_________________
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 12 Sep 2017

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Fri May 28, 2004 8:18 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Have you tried having it check the map-plane (2) to see if the guard is "dead" ?? ie the dead guard map defines??

From what you've said it seems that it isn't seeing the "FL_DEAD" flag.... but given the statetypes, doesn't the dead item really become just a sprite? From what I read of the code, the FL_DEAD setting stops the sprite from returning to one of the previous statetypes? I could be wrong, but I think using the simple plane check for the dead guard sprite values should do the trick...

Greg
BrotherTank
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Sat May 29, 2004 3:48 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WSJ wrote:
I was wondering if there's a way to make an actor check for other actors the same way it checks for the player. My goal is to have it so that a guard will react if he sees a dead guard. I've tried a few different things to make CheckSight look for other actors and see if one of them has the flag "FL_DEAD" (a new flag which is set once an actor gets killed.) However, nothing I've tried ever produces the desired effect... the patrolling guard just walks right past the dead body as though nothing was wrong.

Does anyone know what I could add that would make the guard "see" other guards, the way he can "see" the player?


::: CODE :::
Pseudo-code:

void CheckForDeadGuy(objtype *actor)
{
  objtype *check;

  for(check=player->next; check; check=check->next)
   if ((check->flags & FL_DEAD) && (CheckLine(actor,check))) ActorSpotsADeadGuy(actor);
}

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Sat May 29, 2004 7:32 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hey, I finally got it to work! Very Happy Thanks, Codetech.

In case you were wondering, this is the routine I used:

::: CODE :::

void CheckActor (objtype *ob)
{
     objtype    *check;
   long      deltax,deltay;


     for(check=player->next; check; check=check->next)
   {
         if ((check->flags & FL_DEAD) && (CheckLine(ob,check)))
      {
         deltax = check->x - ob->x;
         deltay = check->y - ob->y;
      }
   }

   if (deltax > -MINSIGHT && deltax < MINSIGHT
   && deltay > -MINSIGHT && deltay < MINSIGHT)
   {
      AlertEnemy (ob);
      return;
   }

   switch (ob->dir)
   {
   case north:
      if (!(deltay > 0) )
         AlertEnemy (ob);
         break;

   case east:
      if (!(deltax < 0) )
         AlertEnemy (ob);
         break;

   case south:
      if (!(deltay > 0) )
         AlertEnemy (ob);
         break;

   case west:
      if (!(deltax < 0) )
         AlertEnemy (ob);
         break;
   }
}


I had used some of TexZK's new CheckLine code (which I'm guessing Codetech had in mind.) The "CheckActor" routine is used during "T_Stand" and "T_Path" so that the unalerted guard will react if there's a dead guard in sight. However, if the dead guard is lying somewhere behind the unalerted guard, he won't notice.

"AlertEnemy" is another routine I wrote so that a guard could be alerted in more ways, as well as make different sounds once alerted (though I haven't implemented the sounds yet.) I think I'm going to make the guard say stuff like "Was ist los?" or "Mein Gott!" whenever he sees a fallen comrade.

BrotherTank wrote:

Have you tried having it check the map-plane (2) to see if the guard is "dead" ?? ie the dead guard map defines??

From what you've said it seems that it isn't seeing the "FL_DEAD" flag.... but given the statetypes, doesn't the dead item really become just a sprite? From what I read of the code, the FL_DEAD setting stops the sprite from returning to one of the previous statetypes? I could be wrong, but I think using the simple plane check for the dead guard sprite values should do the trick...


The FL_DEAD flag is just a another flag I defined in WL_DEF.H. It doesn't alter the statetypes or anything. It's set in KillActor like this:

::: CODE :::

   gamestate.killcount++;
   ob->flags &= ~FL_SHOOTABLE;
   actorat[ob->tilex][ob->tiley] = NULL;
   ob->flags |= FL_NONMARK|FL_DEAD;


Were you suggesting that I make the guard check for the dead body when he walks over it, similar to the check in MCS's enemy bonus tutorial? I probably could've done that, but I wanted the guard to be able to "see" the dead body from a distance, the same way he's able to "see" the player. If you had something else in mind, though, then I'd be glad to hear your suggestion.
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Sun May 30, 2004 3:48 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That's great news...

Edit: He was ment to see dead guys from a distance. In your code, the CheckLine is not needed because you only check the tile he's in.

Besides it would be stupid if the guard walked past the dead guard not reacting to it. Cheesy Grin

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Sun May 30, 2004 6:52 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Codetech84 wrote:

Edit: He was ment to see dead guys from a distance. In your code, the CheckLine is not needed because you only check the tile he's in.


Well, I tried it without CheckLine, but that made it so the guards could always see the dead guy even if he was behind a wall.
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Tue Jun 01, 2004 2:49 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WSJ wrote:
Codetech84 wrote:

Edit: He was ment to see dead guys from a distance. In your code, the CheckLine is not needed because you only check the tile he's in.


Well, I tried it without CheckLine, but that made it so the guards could always see the dead guy even if he was behind a wall.


Sorry, my bad...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
ZuljinRaynor
DieHard Officer
DieHard Officer


Joined: 17 Jan 2004
Last Visit: 30 Apr 2011

Topics: 19
Posts: 559
Location: New Jersey, USA
usa.gif

PostPosted: Tue Jun 01, 2004 3:08 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Wow! This is excellent. Correct me if I didn't read this but, is it possible for the guard to yell and look for the player and have other guards react (of course to a limit)?
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Tue Jun 01, 2004 4:18 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

ZuljinRaynor wrote:
Wow! This is excellent. Correct me if I didn't read this but, is it possible for the guard to yell and look for the player and have other guards react (of course to a limit)?


Yes, that's the kind of thing I'm working on. Cheesy Grin
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Wed Jun 02, 2004 2:17 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well I've coded something I called "AlertActorsRadius", could be assigned to a gunshot or a rocket explosion or any other sound. It would search the actor and check the distance to the actor that caused it, putting him to alert if needed. This often caused chain reactions.

I could dig it up if you want...

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Wed Jun 02, 2004 5:03 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sure, I'd be interested to see. I coded something similar to this, called "AlertOthers." I used Poet's explosion code as a base... but instead of damaging the actors within a certain radius, it alerts them. I put it in "T_Chase" so that guards who are chasing the player will alert other guards around them. In Wolf3D, I thought it was kind of stupid that one guard might be chasing after the player while the other guards just stand there doing nothing. I mean... wouldn't the guard be shouting to his friends to kill the Allied intruder? Laughing

I was also going to use "AlertOthers" as a replacement for "madenoise," but for some reason, it didn't work very well when the player fired his gun, even though I'd set a wide radius for the firing noise.
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Thu Jun 03, 2004 6:38 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dugtrio17 wrote:
I've always found this odd myself. You kill a guard, then hear a door open, and hide.
(guard's mind)
Hmm hmm hmm... life is great... skeleton here... cage there... got my 4 bullet clip ready... wish the military had assigned me more hit points... oh no! Morton, you old fool! I just mopped that floor! Oh well... hmm hmm hmm... keep walking... you know I wish they'd assigned me to that castle in Spain... I hear the guards there get to pick up those health packs that we litter the floor with... I wish Morton would get on cleaning those up, or at least sticking them in those pushwalls we don't get to push. Oh, there he is again... still dead. Eh, it happens. Still, dammit Morton! All over the floor! And you didn't leave behind your clip so I could walk past it awkwardly and pick it up! Ah, hell, I'll get that guy who looks exactly like me and everyone else to mop up the mess after our elevator is used to go to that next floor where we guard those secret plans...
(you jump out of your corner and knock the SHIT out of him)

*ROFFEL!!!!!* Really great stuff!! I haven't laughed that much for a long time Cheesy Grin
Thanks, man!! Cheesy Grin
The only problem with that story is, that Morton isn't a German name Mr Green

But this feature really sounds cool and effective, though I didn't see a map yet, where a guard would see another dead guard without already being shot, but I guess, I just play way too less wolf games Wink
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Thu Jun 03, 2004 5:12 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ripper wrote:
But this feature really sounds cool and effective, though I didn't see a map yet, where a guard would see another dead guard without already being shot, but I guess, I just play way too less wolf games Wink


I've seen one.... In fact, it's funny that Dugtrio should make a reference to Spear Resurrection in his story, because it was a level in Spear Resurrection that made me think about this! Smile I remember killing a bunch of enemies near the start of the level, leaving the room for a while, then coming back and seeing an officer walking into the room with all the guards I killed. He had his back to me, so he wasn't alerted, but he just kept walking past those dead bodies, like nothing was wrong... Cheesy Grin But that would've been a rare occurrence, I think.

However, in a game where the player has to use "stealth," this kind of thing would happen more often. For example, there are 2 guards walking down a hall, both of them walking in the same direction. The player shoots one of them from behind with a silenced weapon and kills him. Now, if the guard who died was a little ahead of the living guard, wouldn't the live guard notice his buddy dying right in front of him? Even if both guards were walking side-by-side, the live guard would notice his friend dying right next to him.

Another example... there was a bug in Medal of Honor: Allied Assault... if you stealthily kill someone while you're disguised as a German, and then a guard walks into the room, he simply greets you with something like "Hallo!" or "Sieg Heil!" and pays no attention to the dead body right in front of him... Cheesy Grin
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 21 Sep 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Thu Jun 10, 2004 4:58 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

WSJ wrote:
I was also going to use "AlertOthers" as a replacement for "madenoise," but for some reason, it didn't work very well when the player fired his gun, even though I'd set a wide radius for the firing noise.


Remove madenoise variable completely and fix all references. That's how I've done it and it works perfectly. I also made guard shouting attract guards from a certain radius. It was kind of fun to mess around with it.

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Raistlin
DieHard Guard
DieHard Guard


Joined: 22 Apr 2003
Last Visit: 18 Oct 2006

Topics: 24
Posts: 246

blank.gif

PostPosted: Sun Aug 22, 2004 12:03 am
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

So WSJ, whats the finished procedure here?
just the code u posted, or is there something more?

_________________
As I watched him on T.v, somehow it really bothered me...
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 08 May 2017

Topics: 24
Posts: 521

blank.gif

PostPosted: Sun Aug 22, 2004 12:28 pm
   Subject: Re: An actor checking for other actors
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

No, it would require more work, because you have to implement some of TexZK's CheckLine code. Also, my code is different, because I rewrote a bunch of the alerting code in order to get the guards to be alerted in multiple ways and make different reaction noises (unfortunately, I have not yet got it to work 100%). So the code I posted wouldn't normally work unless you'd done a lot of changes already... I just thought that it might give people some ideas.
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.This topic is locked: you cannot edit posts or make replies. Time synchronized with the forum server time
DieHard Wolfers Forum Index -> DieHard Archives View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group