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

Full world simulation issues #657

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

Full world simulation issues #657

Try opened this issue Jul 24, 2024 · 7 comments

Comments

@Try
Copy link
Owner

Try commented Jul 24, 2024

Why full world simulation:

  • Goes very well along limitless view distance, resulting in better game experience
  • Gives us a reason to say that npc runtime doesn't degradate over time (good for testing)
  • and just cool overall

Known issues

  • Earthquake (this issue)
    • Essentially any other global call from script, akin to WLD_PLAYEFFECT will cause trouble
  • ZS_MM_Rtn_Rest_Loop for some monsters
    • In vanilla idle-animation may have non-zero net movement, and if engine skips _Loop function then monster position wont be adjusted back to spawn-point.
  • ZS_MM_Hunt_Loop for monsters with long chaise
    • in vanilla monster will chaise players until the monster is out of view-range. In case of opengothic that means forever
  • NPC walk-teleport mislignment #585
    • Ring of water meeting(Lares and others travel in real-time)
    • Greg doesn't come quick enough to kill Dexter
    • Special-casing ai_gotowp("TOT"), due to Pedro in gothic2
  • NPC problems #354
    • NPCs won't heal in time
  • Npc state doesn't refresh(part of Add some vanilla behavior for npcs #653)
  • Npc::tickRoutine has no call to LOOP function for far-away monsters (performance)
  • Grimbald the hunter: When I first arrived there, only one snapper was there. My suspicion is that Grimbald killed them already over time but I am not sure. I found no snapper corpses.

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
Copy link

Abendlied commented Jul 26, 2024

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:

  • Lares to new camp
  • Baal Parvez to sect camp
  • Talas to goblin cave and to orc cementry

Gothic 2 NotR:

  • Lares to Onar (with intermittent waypoints)
  • Lares to stone ring (with intermittent waypoints)
  • Lares to water mages (with intermittent waypoints)
  • Mika to Akil
  • Bartok hunting (with intermittent waypoints)
  • Alligator Jack to pirate camp

NPCs moving position after story trigger
Gothic 1:

  • Diego from start lake to old camp (kills all starter monsters on the way)
  • Diego, Milten, Gorn, Lester for focus quest
  • Gorn for new mine recapturing
  • Lee to dam for monologue
  • Diego, Lester, Scorpio after chapter 4 triggered and OC gates are closed
  • Milten to NC watermages
  • Ur-Shak to orc city
  • Bartholo and Raven after Teleport to OC

Gothic 2 NotR:
Khorinis

  • Canthar to city
  • Greg to city
  • Greg to Orlans
  • Greg to Onar road
  • Greg to Dexter
  • Erol to his hut
  • Attila to hut behind Halvor
  • Ring of water meeting
  • Diego, Lothar into city
  • Xardas, Pyrokar, Vatras Eye of Innos at stonehenge
  • Lester to Xardas
  • Jharkendar prisoners to Khorinis
  • Rengaru running
  • Jack to lighthouse
  • Brian to lighthouse
  • Chosen crew to harbour after reading sea map
  • Chosed NPCs to prison (Canthar, Sarah, Rengaru, Fernando...) - and out again
  • Salandril to monestary
  • Bennet to prison and back to mercenaries
  • Elvrich nephew apprentice back to Thorben
  • Randolph for the drinking quest
  • Cavalorn to the city
  • Gerbrandt to harbour district

Jharkendar

  • Fisk and bodyguards to Snafs
  • Bloodwyn to minecrawler cave

VoM

  • Angar
  • multiple NPCs to old camp
  • Ur-Shak to Hosh-Pak place
    probably much more I cannot think of right now

Irdorath

  • Pedro
  • Mario

edit 1: formatting

@Abendlied
Copy link

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
Copy link

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
Copy link
Owner Author

Try commented Jul 28, 2024

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: #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
Copy link

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
Copy link

Abendlied commented Jul 29, 2024

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
Copy link
Owner Author

Try commented Jul 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants