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

NPC walk-teleport mislignment #585

Open
Try opened this issue Feb 24, 2024 · 7 comments
Open

NPC walk-teleport mislignment #585

Try opened this issue Feb 24, 2024 · 7 comments
Labels
invalid This doesn't seem right

Comments

@Try
Copy link
Owner

Try commented Feb 24, 2024

In vanilla npc's do have 2 type of execution:

  • close to player
  • outside of player vision

When outside of player vision, npc doesn't walk thru way-path, but teleports from point-to-point instead.

At this point OpenGothic doesn't do 'outside' part, evaluation whole world as 'closeup' case. Evaluation whole world as 'closeup' has a correctness downside, if game-script relies(often times non-intentionally) on teleport mechanics.

Known cases (NotR):

  • Examples are Greg-Dexter event
  • Ring of water meeting.

Need to: design solution on how OpenGothic can incorporate same behavior as in vanilla, either equivalent one.
One issue here is unlimited draw-range - teleport might be observable to player
Visibility culling is done in CS, and engine has no information on what is visible on CPU-side.

@hwnde
Copy link
Contributor

hwnde commented Feb 28, 2024

My 2 cents: implement a logic closer to how vanilla works: do a teleport if the npc is outside a certain radius of the player, regardless of direct visibility. The source or destination theoretically might be observable by the player but I'm not sure it will be actually visible in practice. Would need a playtest to confirm.

Bonus: do a teleport animation. In case of mages it would even make sense :)

@hellozyemlya
Copy link

Played gothic long time ago, and what to ask what is the results of this behavior? Quests non-completable?

@Try
Copy link
Owner Author

Try commented Mar 30, 2024

@hellozyemlya

Quests non-completable?

As mention in description: at least 2 quests are not same. In ring of water meeting, the ring members should appear in tavern shortly after quest starts. In OG they wont appear fast, instead they will literally walk to place.

@Try Try added the invalid This doesn't seem right label May 11, 2024
@CReimer
Copy link
Contributor

CReimer commented May 19, 2024

Couldn't an extremely simple solution be used here? Is there anything against a cone shape in the viewing direction + FOV? Everything inside this cone shape is “inside” everything outside is “outside”. If both the source and the target of the NPC are “outside”, teleportation takes place. Otherwise the NPC goes from waypoint to waypoint. You could then repeat the check at each waypoint or perhaps even in between.

It's certainly more complicated to implement than I'm imagining, but sometimes a simple look at things helps to find a good solution.

@Abendlied
Copy link

An active cone/radius/waypoint implementation is different to the implemented base principle, full map life simulation. I think in the long run we have to think about it as there are multiple things that rely on teleporting.

What I noticed is that sleeping allows teleportation. In the Gothic 1 Chapter 4 scenario, Diego, Milten and Skorpio are at their destination points after sleeping. Dirty dirty fix could be an automated sleep until next day after certain chapter changes, e.g. G1ch4.
I can imagine that this would also beneficial for G2ch3 (eye of innos).

@dreimer1986
Copy link

@Abendlied, of course it helps because by sleeping you reset the whole world's NPC locations to where they should be right now.
This is no solution you can do on the Ring of Water quest though. You stand there and the other members should almost immediately show up and come through different entrances to the tavern. Thus you need a useful way to decide when you will do a teleport. Otherwise things will break badly.

Another such example (Gothic I though) Diego and Milten at the end of Chapter 4 when the Old camp closes the gate and goes haywire. If they don't teleport there you will not find em as they are blocked from leaving the old camp. At the start of the quest to go to the fire mages (at the other end of the map aka invisible to us) the gate is closed by script and the friends are outside to warn you. This way there won't be any warning at all as they will rub their cheeks at the closed gates from inside ^^ Full map life simulation is good and fine, but you cannot change a basic mechainc the game depends on and expect no breaking. So there has to be some solution.

Dunno if vegetation can be added as sight blockers as the leaves at least tend to be a bit special, but hills and stuff should be less of a problem.

@Abendlied
Copy link

Abendlied commented May 24, 2024

[...] sleeping you reset the whole world's NPC locations [...] is no solution you can do on the Ring of Water quest though.

@dreimer1986 I agree, let's discard that sleeping or time forwarding idea entirely.

some kind of walking/time acceleration would probably result in problems such as encounters with enemies

  • in G2 that could be seekers or monsters that stand in the walking path
  • in G1 that would for example be Skorpio being attacked by guards once he leaves the camp in chapter 4

So if I read the overall situation correctly, we want teleports to happen but we need to identify reasonable conditions for it.
Those conditions needs to meet requirements such as

  1. not in field of view of the player (could be a distance, even if not tidiest option)
  2. should not happen for daily routines (going from bench to fire etc.), only if distance to waypoint is reasonably long (could be a distance/ray or a traveltime, either absolute or relative to theoretic player traveltime to waypoint from current position)
  3. should not happen if NPC escorts you or is a follower

I could imagine we can do it via distance.
teleport if
distance to player > threshold
&
distance to target waypoint > waypoint threshold
&
NPC not in following / escort mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

6 participants