NPC walk-teleport mislignment
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.
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 :)
Played gothic long time ago, and what to ask what is the results of this behavior? Quests non-completable?
@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.
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.
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).
@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.
[...] 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
- not in field of view of the player (could be a distance, even if not tidiest option)
- 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)
- 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