Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy Templars survive in orc graveyard #115

Merged
merged 2 commits into from Apr 3, 2021
Merged

Dummy Templars survive in orc graveyard #115

merged 2 commits into from Apr 3, 2021

Conversation

szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

Describe the bug
When the player is fast enough, he can kill the orcs near the dummy Templars before the orcs kill the Templars. Then the dummy Templars just stand there doing nothing.

Expected behavior
The dummy Templars in the orc graveyard are now already dead when the player enters the graveyard.

Additional context
My suggestion would be to kill the dummy Templars when the player first enters the orc graveyard.

Screenshot
ScreenShot_2021_2_12_21_37_49

@AmProsius AmProsius added the validation: validated label Feb 12, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Feb 12, 2021

Yes that's quite an issue. I'd find it sad actually if they'd be dead from the start I remember my first time playing and it was such a rush hearing the fighting and the thrill of trying to make it in time (and actually failing). I wonder if there is a better way. Maybe they could still automatically die, but triggered by something else, e.g. the orcs dropping below a certain threshold of HP or the player coming too close (although that would not include ranged combat). Any suggestions?

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Feb 12, 2021

They could die if the player is like 10 m away from their waypoint. Then the player would still see them, but if they don't die by the orcs, they would still be dead if the players passes them. The only downside would be that they could drop dead on sight without a reason for the player.

@szapp
Copy link
Collaborator

@szapp szapp commented Feb 12, 2021

The only downside would be that they could drop dead on sight without a reason for the player.

Yes, I think that could be quite ugly, if there are no orcs left by then. The death could be triggered by line of sight. As soon as the hero (not the player in this case!) sees a templar their HP could drop to a certain value. Then they would die on the next hit. This still doesn't exclude the possibility that they could survive, but makes it smaller

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Feb 12, 2021

As soon as the hero (not the player in this case!) sees a templar their HP could drop to a certain value. Then they would die on the next hit. This still doesn't exclude the possibility that they could survive, but makes it smaller

The Templars already die with one hit from the orcs, even with full HP. The problem is that at one point the orcs may attack Baal Lukor first before they attack the dummy Templars so the Templars don't even get hit. That was the case when I made the screenshot above. These Templars would have to die somehow nonetheless.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Feb 13, 2021

Another possible solution would be to kill the remaining dummy Templars when Baal Lukor initiates the dialog with the player. Then the player will have seen some Templars fighting already and the rest can be killed in the background.

@szapp
Copy link
Collaborator

@szapp szapp commented Feb 13, 2021

I guess it might just be the best to kill them right away, as you initially suggested. Anything else seems even more fragile or might end up looking weird. Although, of course there will be less fighting going on and it does not feels so "realistic".

I think we can give it some more thoughts. Maybe we will find a both satisfying and robust solution.

@szapp
Copy link
Collaborator

@szapp szapp commented Feb 20, 2021

How about, we have Baal Lukor ignore the orcs and be ignored by the orcs until the player gets close. This way the orcs should focus on the templars and finish them off in time.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Feb 20, 2021

How about, we have Baal Lukor ignore the orcs and be ignored by the orcs until the player gets close. This way the orcs should focus on the templars and finish them off in time.

That's a good idea. Additionally, the Templars should also attack the orcs (but deal no damage), because right now they just stand around doing nothing and waiting for the orcs to kill them.

@szapp
Copy link
Collaborator

@szapp szapp commented Feb 20, 2021

[R]ight now they just stand around doing nothing and waiting for the orcs to kill them.

Yeah so their state/daily routine is deliberately to just sit and wait, as the name and description implies:

//////////////////////////////////////////////////////////////////////////
// ZS_SittingDuck
// ==============
// Der NSC steht bei diesem Tagesablauf-Zustand FEST auf seinem WP
// und reagiert auf nichts. Wird verwendet, damit der NSC beim
// herannahen des Spielers von einem nahen Monster sofort mit einem
// getötet werden kann.
//////////////////////////////////////////////////////////////////////////
func void ZS_SittingDuck ()

If Baal Lukor is ignored and also ignores them, the orcs should quickly kill off the templars (as originally intended). There might not be the need to modify the templar’s state. I’d also like to avoid it, because with making them more perceptive and active the chance of them surviving is actually higher, i.e. running to a different orc or run somewhere entirely different where they survive.

I will first take Baal Lukor out of the equation and then we can check how reliable it is.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Feb 20, 2021

I see your point.

I will first take Baal Lukor out of the equation and then we can check how reliable it is.

I agree. The tests will show if that already fixes the issue.

@szapp
Copy link
Collaborator

@szapp szapp commented Feb 20, 2021

Yes that sounds good.

In Gothic 2 there is an easy way to have an NPC igore and be ignored that is not available in the Gothic 1 scripts. I will have to think of a way to do it.

Having Baal Lukor ignore the orcs should be straight forward, by overwriting his state to turn him into a vegetable until the player has line of sight. To make the transition smooth, I’d have him draw his weapon from the start.

For making the orcs ignore Baal Lukor, on the other hand, I don’t have an elegant idea yet.

I will have a look at the orientation of the waypoints: Maybe the orcs are already aligned towards the templars and will only spot them on first sight. NPCs generally don’t change their targets once they attack (only if they are attacked by someone else). So they would finish off the templars before “realizing” there is also Baal Lukor, who will then only fight back once the player approaches.

These are just thoughts and notes, until I have the time to try it out in practice.

@szapp szapp self-assigned this Mar 19, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Mar 30, 2021

@AmProsius, Am I correct in the assumption, that #78 promotes the occurrences of this issue here? If that’s correct, should we prioritize this issue for v1.1.0?

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Mar 30, 2021

@AmProsius, Am I correct in the assumption, that #78 promotes the occurrences of this issue here? If that’s correct, should we prioritize this issue for v1.1.0?

I have to check that. I think the Templar dummies are not affected by that fix.

@szapp
Copy link
Collaborator

@szapp szapp commented Mar 30, 2021

Okay. I somehow had this impression, because Baal Lukor will now start to attack before being attacked. Thanks for checking!

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Mar 31, 2021

Okay. I somehow had this impression, because Baal Lukor will now start to attack before being attacked. Thanks for checking!

I double checked: The dummy Templars don't engage. But since Baal Lukor now attacks the orcs (and vice versa), the dummy Templars from the screenshot above almost always survive, so this fix is sill very important.

@AmProsius AmProsius added this to the v1.1.0 milestone Mar 31, 2021
@AmProsius AmProsius added this to To Do in v1.1.0 via automation Mar 31, 2021
@szapp szapp added this to Unsorted in Fix templates Mar 31, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Mar 31, 2021

Thanks for checking!

My current idea would be to intercept the ZS_SittingDuck NPC state. If the NPC in question is one of our templars, I will check their visibility on the users screen (that will be a nice challenge). As soon as the NPC is visible, they will be killed off. If everything works as I imagine, this would have perfect timing such that the player will see them collapse and die.

Note to myself:
Have a look at how zCBspLeaf::AddVobsToRenderListOutdoor(void) 0x51BBA0 determines the visibility of a VOB.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 1, 2021

My current idea would be to intercept the ZS_SittingDuck NPC state. If the NPC in question is one of our templars, I will check their visibility on the users screen (that will be a nice challenge). As soon as the NPC is visible, they will be killed off. If everything works as I imagine, this would have perfect timing such that the player will see them collapse and die.

That sounds like a very smooth solution!

@szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

I implemented the necessary checks in 47ea4d1. I will try to implement the proposed fix.

@szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

I experimented a bit with it and it looks very clumsy:

  • the orcs are not reacting fast enough such that the templars visibly fall without being involved in a fight
  • the templars just fall flat where they stand and that looks very dumb

I expected the orcs already engaging the templars in a fight when the player comes close, but that's not the case. This approach does not look promising, and spawning the templars dead seems like the better option in comparison.

I just tried some other things like having the templars detect their nearest enemy and sending a damage perception to them. That causes the orcs to immediately attack and kill them. Additionally I have the templars draw their weapon and run towards that very enemy. That looks very natural for the first two single templars. Unfortunately, the two templars in the cave with Baal Lukor don't detect "their" orcs but the ones further up towards the player (possibly because the orcs closer to them spawn just slightly later). As a result they are rushing out the cave towards the player and stand around while the orcs attack the player. So that's even weirder.

I don't want to go too far off, because it is becoming harder to not break a mod's changes. I will brainstorm some other ideas.

@szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

I think I now found a good compromise:

The sitting ducks are still sitting ducks: The do not perform any action. Every 100 milliseconds they iterate over all(!) enemies in their proximity and sent out damage perceptions. That means the enemy thinks they received damage from that templar. Even if the player or Baal Lukor interferes, the orcs will kill the templars first, because the perception is sent continuously. The orcs will always switch to attack the templars, as their most recent attacker. If no enemy was found, this process is repeated until the player comes too close (25 meters). In that case the sitting duck "commits suicide".

I tried this a few times and I am happy to say that all templars were killed. For some of them I could even hear the death cry and could just see how they died. That's the best case scenario. In the worst case, the templars will just be dead when the player arrives. Which is good, too.

There is still one thing to consider: Should we add this functionality for the sitting-duck AI state in general? I first thought of checking if the NPC in question is one of the selected templars. In that case, however, the fix would not work if the templars were exchanged, renamed or more were added.
My suggestion would be to somehow verify that the sitting-duck AI state function is largely unaltered and then add this fix in general. What is your impression @AmProsius? I can push the scripts as I have them so far, for you to play around with it if you like.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 1, 2021

Should we add this functionality for the sitting-duck AI state in general?

Before answering this, I'd like to know where this behavior is also used besides the orc graveyard. It might have unforeseen side effects. If we can verify that the altered behavior doesn't change anything story related, I'm happy to go with your proposed solution.

This is a draft. A test and documentation is still missing.

Refs #115
@szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

Yes, it shouldn't. That "sitting duck" AI-state is some comments in the code describing, that is exclusively used for NPCs to be killed of (I quoted that comment a few posts above). Therefore, the changes are only beneficial in all cases.

Nevertheless, this AI state is only used for the templars in the grave yard, plus one outside.

@szapp
Copy link
Collaborator

@szapp szapp commented Apr 1, 2021

I committed the changes so far, if you want to try it out. Unfortunately, I didn't write a test yet, but entering the orc graveyard (irrespective of the story progression suffices).

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 1, 2021

Perfect, go ahead then.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 1, 2021

Fun fact: This is the painting "Sitting Duck" by Bedard that might have influenced the state:

3A80E87C-00B6-4DC0-9DDA-573ABE18F9D6

I have a copy of that painting in my living room.

@szapp szapp added compatibility: difficult impl: modify/analyze script func type: session fix labels Apr 1, 2021
@szapp szapp moved this from To Do to In Progress in v1.1.0 Apr 1, 2021
@szapp szapp marked this pull request as draft Apr 1, 2021
@szapp szapp moved this from Unsorted to NPC state in Fix templates Apr 1, 2021
@szapp szapp removed their assignment Apr 1, 2021
@szapp szapp marked this pull request as ready for review Apr 1, 2021
@szapp szapp requested a review from AmProsius Apr 1, 2021
Copy link
Owner

@AmProsius AmProsius left a comment

Really cool fix! I enjoyed running through the orc graveyard and seeing the orcs kill the templars. It's way more immersive than my proposed solution.

@AmProsius AmProsius merged commit b59c481 into master Apr 3, 2021
v1.1.0 automation moved this from In Progress to Done Apr 3, 2021
@AmProsius AmProsius deleted the bug115 branch Apr 3, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Apr 4, 2021

Some notes that apparently were filtered by Github:

What about "bleeding" as in health degeneration + blood pfx effect?

and

That "sitting duck" AI-state is some comments in the code describing, that is exclusively used for NPCs to be killed of (I quoted that comment a few posts above). Therefore, the changes are only beneficial in all cases.

A mod author could have used the state without having read the comments. Killing all "sitting duck" characters in all mods semms risky to me.

(Copied from here)

It seems unlikely to me for anyone to use the AI state at all, even less so for a different purpose. The sitting ducks really react to nothing at all. They have no perceptions and wouldn’t even react to the player talking to them. That they are waiting to be killed is even in the name of the AI state. That’s my justification to killing off any NPC in that state if the player comes to close.
Nonetheless, I am all for being rather on the safe side instead of making assumptions. So, thanks for the feedback! I guess we could add checks to only alter the AI state for the NPC we specify (the handful templars) as initially planned. If a mod modifies/exchanges or adds more of them, that’s on the mod developer.

Regarding the blood effect, I don’t understand the question/comment. Could you elaborate, please?

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 4, 2021

Regarding the blood effect, I don’t understand the question/comment. Could you elaborate, please?

I think he meant something like the effect when the player character gets hit by an arrow/bolt. I wouldn't include that though, I'm happy with the current solution.

The concerns regarding the use of the "Sitting Duck" AI state in mods are reasonable, so I'd like to add checks for the inserted templars. On the other hand, this fix wouldn't apply to additional templars that could be added by a mod then. I'm still in favor of the additional checks though.

szapp added a commit that referenced this issue Apr 12, 2021
szapp added a commit that referenced this issue Apr 12, 2021
szapp added a commit that referenced this issue Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility: difficult impl: modify/analyze script func type: session fix validation: validated
Projects
Fix templates
Modify NPC state
v1.1.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants