Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.07k stars 78 forks source link

Workaround for npc teleport #582

Closed thokkat closed 2 months ago

thokkat commented 2 months ago

In vanilla Npc_ExchangeRoutine teleports npc's to new routine waypoint if they're offloaded from world. Examples are Greg-Dexter event and ring of water meeting. The idea is to imitate this by resetting far npc's if their routine is exchanged.

Try commented 2 months ago

Hm, thanks for raising this issue, bug unfortunately this solution is too big of a hack, and we should not merge this PR as-is.

You checking for ProcessPolicy::AiNormal - that's find, but destination waypoint might be observable by player. If you check for wayPoint and for npc, it probably wont be a 'fix'.

I was considering to teleport npc forward along his way-path, while whole segment of way-path is not visible. Yet it's hard to reason about path visibility, specially from CPU side

thokkat commented 2 months ago

but destination waypoint might be observable by player.

Yeah I was aware of the concerns you raised in https://github.com/Try/OpenGothic/issues/420. But I mean if this ever happens it's surely out of vanilla render distance and I'd say an ok tradeoff for getting several events working in return.

I was considering to teleport npc forward along his way-path, while whole segment of way-path is not visible.

This sounds even more hacky :D. But as you said above adding a ray between player and waypoint makes workaround only bigger so feel free to close. But I wonder what a solution could be. Only thing I could imagine is script patch where every call is checked and AI_Teleport is added if not visible by player.

Try commented 2 months ago

starting a new issue, to discuss on how implementation may look like: https://github.com/Try/OpenGothic/issues/585