Hate multiple TIDs
Moderator: GZDoom Developers
- Tormentor667
- Posts: 13554
- Joined: Wed Jul 16, 2003 3:52 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Germany
- Contact:
Hate multiple TIDs
This arose out of the following discussion in the editing forum:
http://forum.zdoom.org/viewtopic.php?f=3&t=18450
What I - and others as well - would like to have, is some kind of a feature, that makes it possible that one actor can hate multiple TID'd actors via "Thing_Hate". The problem is right now, that applying a second hate target to an actor, the first one gets overrode.
http://forum.zdoom.org/viewtopic.php?f=3&t=18450
What I - and others as well - would like to have, is some kind of a feature, that makes it possible that one actor can hate multiple TID'd actors via "Thing_Hate". The problem is right now, that applying a second hate target to an actor, the first one gets overrode.
- Cutmanmike
- Posts: 11351
- Joined: Mon Oct 06, 2003 3:41 pm
- Operating System Version (Optional): Windows 10
- Location: United Kingdom
- Contact:
Re: Hate multiple TIDs
Something similar was discussed before I'm sure, but rather species specific friends and foes in DECORATE.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Hate multiple TIDs
Don't expect any results soon. This would be a significant rewrite of the Thing_Hate code.
- Tormentor667
- Posts: 13554
- Joined: Wed Jul 16, 2003 3:52 am
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia (Modern GZDoom)
- Location: Germany
- Contact:
Re: Hate multiple TIDs
But it might happen? 

- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49225
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Hate multiple TIDs
I never said that.
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
Re: Hate multiple TIDs
I'm just about putting money on [No], in fact, that cannot possibly be simple. I think it would involve a bit more than just rewriting Thing_Hate... something about tracking multiple targets or something like that, right?Graf Zahl wrote:I never said that.
Re: Hate multiple TIDs
It wouldn't be tracking multiple targets at the same time, would it?
I see it as having only one target at a time, just like normal, but that it can hate more than one type of thing.
Example:
Demon gets the new Thing_Hate with multiple, and is told to hate a DoomImp, LostSoul, and Cacodemon, all with TID 1, let's say.
Those three enemies are all in the same room with the Demon, so Demon picks one of them as the target. It proceeds to attack that target, and if it should finish, it will then choose a different target, which may be one of the remaining enemies.
Things get more complicated when you decide you do want to override the hating. It is for that reason that I suggest that instead of altering Thing_Hate, a Thing_MultipleHate is created. (Name is up for discussion)
Hate assigned with this new action can be used for multiple hate, so that we can still use normal Thing_Hate to completely override the multiple hate, as necessary.
How possible or likely does that sound?
I see it as having only one target at a time, just like normal, but that it can hate more than one type of thing.
Example:
Demon gets the new Thing_Hate with multiple, and is told to hate a DoomImp, LostSoul, and Cacodemon, all with TID 1, let's say.
Those three enemies are all in the same room with the Demon, so Demon picks one of them as the target. It proceeds to attack that target, and if it should finish, it will then choose a different target, which may be one of the remaining enemies.
Things get more complicated when you decide you do want to override the hating. It is for that reason that I suggest that instead of altering Thing_Hate, a Thing_MultipleHate is created. (Name is up for discussion)
Hate assigned with this new action can be used for multiple hate, so that we can still use normal Thing_Hate to completely override the multiple hate, as necessary.
How possible or likely does that sound?
Re: Hate multiple TIDs
I'm pretty sure PDF is correct here. The implementation of Thing_Hate (or the addition of a new sister function) is not all that would have to change here. Thing_Hate only executes for the space of one tic when called, assigning the hater's their hate targets. However, the TID being hated has to be stored somewhere so that later when the enemy needs to find a new target it knows what TID to look for. Hating multiple TIDs means that that single value now needs to be turned into an array of some kind, and that's a non-trivial change affecting much more than one action special.
Re: Hate multiple TIDs
Maybe something that might be worthwhile is implementing faction groups, instead. I.e. you have multiple groups (including 1, which is the player, and all +FRIENDLY monsters can join it, and in deathmatch games it can be set to hate itself). If needed, a map could have a flag set in MAPINFO in order to enable this system, and without that flag, it wouldn't work.
So, for example... you have a group of ACS functions that set the following faction table: (These are just example group names)
In this example, all factions except NEUTRAL hate everyone else but themselves and NEUTRAL, and NEUTRAL has everyone set to ally so they will not attack nor be attacked by anyone (except a crazy player or careless monster
). During deathmatch, of course, PLAYER would hate itself, to allow players' minions to kill each other and other players. (They'd still be loyal to whoever spawned them, however)
I think it would be a good idea to allow players to be assigned to factions, however, if this idea does get implemented. That would open the way for some team co-op/DM maps that can involve NPC's.
So, for example... you have a group of ACS functions that set the following faction table: (These are just example group names)
Code: Select all
PLAYER MONSTER RACEX NEUTRAL
PLAYER ALLY HATE HATE ALLY
MONSTER HATE ALLY HATE ALLY
RACEX HATE HATE ALLY ALLY
NEUTRAL ALLY ALLY ALLY ALLY

I think it would be a good idea to allow players to be assigned to factions, however, if this idea does get implemented. That would open the way for some team co-op/DM maps that can involve NPC's.

Re: Hate multiple TIDs
That suggestion was already shot down by Graf because it means that every enemy in the level would have to check LOS to every other enemy in the level each time A_Chase is called, which would kill performance.
Re: Hate multiple TIDs
And what if you just happened to stick a +FRIENDLY flag on every single monster? The exact same thing would happen.
I can understand the concern for performance, there, but I am not really sure that it is really warranted. There are multiple ways to curb the performance hit, even if it does occur, including rebuilding and using the REJECT lump if necessary.
Inevitably, performance will always be an issue, but it's usually with the mappers themselves. Draw one too many linedefs or sidedefs and you got one slow map. Too many sprites or particles, same thing. Too many sectors... well, do they REALLY expect us all to upgrade our computers just to play their maps? My point is... even if monsters did constant LOS checks on each other, it's not nearly as much of a performance hit as someone who goes sector happy. In any case, it usually only happens once every 10 tics for inactive monsters, and once every 3 tics for active ones, anyway.
I can understand the concern for performance, there, but I am not really sure that it is really warranted. There are multiple ways to curb the performance hit, even if it does occur, including rebuilding and using the REJECT lump if necessary.
Inevitably, performance will always be an issue, but it's usually with the mappers themselves. Draw one too many linedefs or sidedefs and you got one slow map. Too many sprites or particles, same thing. Too many sectors... well, do they REALLY expect us all to upgrade our computers just to play their maps? My point is... even if monsters did constant LOS checks on each other, it's not nearly as much of a performance hit as someone who goes sector happy. In any case, it usually only happens once every 10 tics for inactive monsters, and once every 3 tics for active ones, anyway.
- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
Re: Hate multiple TIDs
Incorrect. Freindly monsters do not look for enemy monsters. The simply attack enemy monsters, meaning if the player isn't around an inactive friendly monsters, it will just ignore any other monsters.SoulPriestess wrote:And what if you just happened to stick a +FRIENDLY flag on every single monster? The exact same thing would happen.
- Woolie Wool
- Posts: 1713
- Joined: Mon Dec 15, 2003 3:36 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Arch Linux, Windows 11
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Hate multiple TIDs
But don't enemy monsters automatically attack friends and provoke the friends to attack them? I've played TVR!.wad with a mod that replaces the Keens with friendly monsters and most of the enemy monsters are dead and there are friendly monsters running around everywhere when I go through map01 (which has a bunch of keens).
- XutaWoo
- Posts: 4005
- Joined: Sat Dec 30, 2006 4:25 pm
- Location: beautiful hills of those who are friends
- Contact:
Re: Hate multiple TIDs
Nope. They just stay there until they get attacked or they see the player.
Re: Hate multiple TIDs
If you're really sure about that, try playing MAP01 in Ultra-Violence, of DOOM2 with these friendly imps. Just -file this decorate, and turn "am_cheats 3", and watch the automap.XutaWoo wrote:Incorrect. Freindly monsters do not look for enemy monsters. The simply attack enemy monsters, meaning if the player isn't around an inactive friendly monsters, it will just ignore any other monsters.SoulPriestess wrote:And what if you just happened to stick a +FRIENDLY flag on every single monster? The exact same thing would happen.
Code: Select all
ACTOR DoomImpFriend : DoomImp REPLACES DoomImp
{
+FRIENDLY
}
Tested on GZDoom r164.