Monsters reloading weapons - questions

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Monsters reloading weapons - questions

Post by Player701 »

While working on an improvement of my old weapon mod, I encountered this problem, and I thought it would be best to see what other people think about it.

The problem is related to monsters reloading weapons. In my mod, zombies wield modified weapons which mostly correspond to the new weapons from the player's arsenal (the exception being their strength, which is unchanged, as the new monsters still use their native attack codepointers). Since the weapons feature reloading, zombies should be able to reload them too, so I implemented this ability in the original mod. Now I'm trying to improve the mod a bit, and recently I've got to the monster-weapon-reloading stuff. Now I'm thinking of how to solve the following things:

1. When zombies reload their weapons, they stand still. In fact, I couldn't have done it otherwise - calling A_Wander just for walking around didn't seem a good idea. But the real problem is that during the reload process monsters will always keep facing the same direction. This doesn't look realistic. I was thinking of adding A_FaceTarget calls to zombies' reloading states. If I really should do it, what should be the frequency of calls to A_FaceTarget? Because calling it every 1 tic doesn't look too realistic either (already tried it and decided to revert to the old behavior).

2. The new shotgun, which replaces the old Doom one, is reloaded shell by shell. Of course, zombies also reload it the same way. However, the duration of a full reload cycle is very long (8 shells to be loaded), and the shotgun guy, like other zombies, also doesn't move when he reloads his shotgun. What is really bad, is that he doesn't have any chance to retaliate against the player while in this long-lasting state. Unlike the 1st problem, which is purely aesthetic, this one is gameplay-related and cannot be solved easily. I came up with three possible solutions but I don't know how to tweak them to achieve what I want - each one has its own drawbacks.

So here are the possible solutions:

2.1. One of the possible solutions is to perform a sight check at the end of each shell-loading iteration. If the player is in sight, the zombie jumps to the Missile state and attacks. Then he jumps back and continues reloading. The biggest downside to this approach is that the shooting rate of the zombie severely increases when he enters his reloading state and the player is in sight. This is bad news for the player, and for the gameplay balance.

2.2. Another possible solution is to send the zombie to his See state at the end of each iteration, from where he can chase the player as normal and jump to the Missile state to attack the player. At the end of each iteration of the See state, if the reloading hasn't been done yet (which can be checked with an additional variable / dummy inventory item), the zombie jumps back to reloading state and performs another shell-loading iteration. This approach will increase the duration of the reloading cycle, which is also not good. However, if there are no better approaches, this one at least seems better than 2.1.

2.3. And the last approach I thought of, is making the zombie to reload his weapon partially. For example, after depleting ammo, the zombie will load 2 shells, then chase the player as usual. After some seconds of chasing (or if the ammo is depleted again), he will load additional 2 shells. This is essentially a more sophisticated version of 2.2., which suffers from the same drawback (increased reload duration).

And finally, if all else fails, there's always a fallback solution - abandon the whole idea and remove all these states from the monsters' DECORATE definitions. But this solution is of course not preferred :P

Some may think that the issues described above are too minor for the complex approaches I'm trying to take to solve them. Well, the first one is. However, the second one is essential as it directly relates to gameplay. Considering that zombies (especially shotgun-armed ones) are one of the most common enemies in Doom, it is rather important not to make them too weak or too strong. So I'm open to further suggestions - any help will be appreciated :)
User avatar
Ethril
Posts: 2677
Joined: Sun Nov 16, 2008 2:59 am
Location: with you in the dark

Re: Monsters reloading weapons - questions

Post by Ethril »

2.3 looks optimal to me; That's basically what a player would do if they only had a shotgun and needed to reload mid-combat.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Monsters reloading weapons - questions

Post by Player701 »

Hmm, I've just thought of another possible solution. The idea is not to reload only when ammo is depleted, but anytime when it's possible. "Possibility" should at least imply that the player is not in sight, so at the end of each shell-loading iteration, a sight check is performed. Sight checks should also be performed at the end of an iteration of the See state - if the player is not in sight and the reloading is not done yet (less than 8 shells in barrel), jump to yet another reloading iteration. The downside here is obvious - this approach will make zombies perform reloading too frequently and mostly load only 1-2 shells at a time. Some additional logic is needed to reduce the frequency, maybe some sort of a counter variable or something like this.
User avatar
Ravick
Posts: 2051
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Re: Monsters reloading weapons - questions

Post by Ravick »

Well, in my mod I have the same problems. But it was easier for me because of my zombie concept: zombies are dumb.

My zombies are spawned with a random ammo quantity of 0 up to the max capacity of the weapon they are using. If this number reaches zero, the next attack will be just a "click" sound. Each click has a chance to send the zombie to its reload state. Once there, if the zombie has a weapon that is reloaded in a one-by-one manner, the zombie will act like you zombies: stand and reload. However, player can still attack them, and they still may enter their pain state. So, if player shoots a zombie that has reloaded two shells and it survives the attack, it will "pain" and go back chasing the player with its only two shells.

My zombie concept is more like 'undead guys with weapons' then 'corrupted combatants', so it does not look so strange in my mod. They're attacks are also more dangerous then the original codepointers, so it also serves as a balance issue.

Anyway, for a 'corrupted combatants' concept, I guess I'd make then reload just 1-3 shells and go back chasing the target if its in sight, and then make they perform a complete reload when the target is not.
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Monsters reloading weapons - questions

Post by Player701 »

Ravick wrote:Anyway, for a 'corrupted combatants' concept, I guess I'd make then reload just 1-3 shells and go back chasing the target if its in sight, and then make they perform a complete reload when the target is not.
This looks like a more sophisticated version of solution 2.3, I think I'll implement it. Now there's only the A_FaceTarget problem...

As for the zombies being dumb: I think they're definitely dumb, but not dumb enough to just stand and reload continuously while looking at the player :P
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Monsters reloading weapons - questions

Post by Matt »

Ethril wrote:2.3 looks optimal to me; That's basically what a player would do if they only had a shotgun and needed to reload mid-combat.
This. The "reload when possible" is also a good thing to add.

My own approach has been to have the zombie run away from the player before reloading. This often leaves their back to the player, which has the added advantage of hiding the fact that I don't actually have a reload animation.

I know when I'm stuck in a reload sequence I'm more concerned with avoiding the baddies than facing them, so unless your zeds are walking backwards or sideways towards cover while facing the player the A_FaceTarget calls by themselves won't make stopping to reload look more natural.
User avatar
hitmanx
Posts: 429
Joined: Sat Dec 18, 2004 4:58 am

Re: Monsters reloading weapons - questions

Post by hitmanx »

Was gonna say the same as Vaecrius

Maybe have them flee and reload after a check sight and no player is found, maybe he can enter an idle state or something and then wake when spotted by the player

So bassically he hides, reloads and waits to ambush the player
Naitguolf
Posts: 502
Joined: Wed Mar 17, 2004 6:16 pm
Location: London
Contact:

Re: Monsters reloading weapons - questions

Post by Naitguolf »

Reading all of this... do you mind to improve the rest of enemies? Like monster firing not where player is, but predicting when he will be?
User avatar
Player701
 
 
Posts: 1710
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Monsters reloading weapons - questions

Post by Player701 »

Naitguolf wrote:Reading all of this... do you mind to improve the rest of enemies? Like monster firing not where player is, but predicting when he will be?
No, I don't plan to improve enemy AI. The only thing I want is to add weapon reloading to zombies without impacting the gameplay too much.
Locked

Return to “Editing (Archive)”