Try / OpenGothic

Reimplementation of Gothic 2 Notr
MIT License
1.14k stars 80 forks source link

Full world simulation issues #657

Open Try opened 1 month ago

Try commented 1 month ago

Why full world simulation:

Known issues

Proposed solutions

  1. Suppress _LOOP function for AiFar/AiFar2. Pros: very close to original game, where far npc's are offloaded Cons: wont be able to see routine animations at a distance, such as small-talk and practice_sword. Cons: if mod has side-effect in non-loop part if AI - wont work as intended

  2. Suppress 'side-effects' of _LOOP function Pros: solves immediate problem of earthquakes Cons: hard to implement (need to do deep tracking of context, or check call-stack for *_LOOP) Cons: need to solve cases 1 by one, and it's possible (at least on purpose) to break this solution with any level of indirection

Abendlied commented 1 month ago

You are refering to this as a solution for e.g. the Greg to Dexter example, so I assume _LOOP influences moving NPCs after story triggers. Are escorting activities also impacted by the proposals? If so, a lof things are potentially affected by this change, so I propose to make a list that aims to help understand whether we cover all relevant cases with the proposed solution. I am not aware of anything G2 classic does that is not included in G2 NotR, so I left G2 classic it out. Also, I cannot really well differentiate in G2 which is a spawn/"despawn" (aka killed and stored in caves) of a new NPC version and what is movement of same entity.

Escorting NPCs Gothic 1:

Gothic 2 NotR:

NPCs moving position after story trigger Gothic 1:

Gothic 2 NotR: Khorinis

Jharkendar

VoM

Irdorath

edit 1: formatting

Abendlied commented 1 month ago

Another point would be aggro distance for NPC vs. monster.

In Gothic 1, attacking a swamp shark, the monster will come after me for a long distance until sect camp inhabitants kill it.

In Gothic 2 NotR, transforming to dragon snapper in harbour district and swimming to treasure island, Khorinis inhabitants will come after me even after minutes, swimming all the way to me.

Abendlied commented 1 month ago

Third point: roaming monsters fall off cliffs.

Gothic 1: snappers at Gorn focus quest old castell fall into the river. Gothic 2: snappers at black troll fall into the lake

Probably could indirectly fixed (or severity reduced) by staying inactive. Would require a separate fix though preventing falling off edges entirely.

Try commented 1 month ago

You are refering to this as a solution for e.g. the Greg to Dexter example, so I assume _LOOP influences moving NPCs after story triggers.

No, maybe I was unclear. _LOOP based solutions will prevent unintended side-effects, such as earthquake but wont affer walk-teleport problem (walk-teleport is another issues here: https://github.com/Try/OpenGothic/issues/585)

Another point would be aggro distance for NPC vs. monster.

In opengothic aggro/notify distance is exactly same as in vanilla. Chaise time/distance might diverge in cases, when monster doesn't have any condition in a script to stop chaise.

Example can be ZS_MM_Hunt_Loop: monsters, such as snapper will chaise pray until it offloaded from memory. In Game of opengothic - it's means forever chaise.

Third point: roaming monsters fall off cliffs.

Should be fixed nowdays by changing on how cliff-collision works, but need to test

Abendlied commented 1 month ago

In opengothic aggro/notify distance is exactly same as in vanilla. Chaise time/distance might diverge in cases, when monster doesn't have any condition in a script to stop chaise.

Example can be ZS_MM_Hunt_Loop: monsters, such as snapper will chaise pray until it offloaded from memory. In Game of opengothic - it's means forever chaise.

With your explanation, I can confirm I mean indeed chasing distance, not aggro distance.

Example can be ZS_MM_Hunt_Loop: monsters, such as snapper will chaise pray until it offloaded from memory. In Game of opengothic - it's means forever chaise.

I observed snappers at black troll using ztimer multiplier X. They do roam around and seem to chase, passing over the brindge and beyond until out of sight.

Should be fixed nowdays by changing on how cliff-collision works, but need to test

Was actually not an issue for the snappers, seems cliff-collision works better now.

Abendlied commented 1 month ago

I need to correct myself in both observations.

I observed snappers at black troll using ztimer multiplier X. They do roam around and seem to chase, passing over the brindge and beyond until out of sight.

Not chasing in this case. I suspect it is their animation loop that moves them forward a tiny bit, after a while it accumulates. Directions never change. Either that or some side effect of ztimer multiplier X.

video cliff, 13 sec, 8.1 MiB: Snappers moving at cliff video at black troll, 6 sec, 6.3 MiB: Snappers moving forward at black troll

Was actually not an issue for the snappers, seems cliff-collision works better now.

they do stop at the cliff. However, normal animation movement causes them to fall still.

video coast snapper falling, 4 sec, 2.7 MiB: Falling Snapper

Try commented 1 month ago

For snapper persistent offset from origin seem to be related to animation + ZS_MM_RTN_REST. In the script:


func int ZS_MM_Rtn_Rest_Loop()
{
    ...
    if(self.aivar[AIV_TAPOSITION] == NOTINPOS)
    {
        if(Wld_IsFPAvailable(self,"FP_ROAM"))
        {
            AI_GotoFP(self,"FP_ROAM");
        };
        if(Npc_IsOnFP(self,"FP_ROAM"))
        {
            self.aivar[AIV_TAPOSITION] = ISINPOS;
        };
    }
    ...

Since OpenGothic skips _LOOP, for far away monsters no AI_GotoFP corrections was performed, while animation continued to accumulate offset.