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

Snappers don't spawn outside the Monastery ruins #45

Merged
merged 1 commit into from Apr 16, 2021
Merged

Snappers don't spawn outside the Monastery ruins #45

merged 1 commit into from Apr 16, 2021

Conversation

szapp
Copy link
Collaborator

@szapp szapp commented Apr 16, 2021

Snappers don't spawn outside the Monastery ruins.

This fix corrects the spawn of the two snappers such that they appear in the game. On saving, this fix is reverted to leave no changes in the savegame. That means, the spawn of the snappers is invalidated again. However, if the player is currently in spawn range of the snappers when saving, their spawn is not reverted and they will be written to the savegame. In that event, they remain in the game. This is necessary to avoid inconsistencies when saving the game while engaging with the snappers.

@AmProsius AmProsius added this to To Do in v1.0.0 via automation Jan 6, 2021
@catalinstoian
Copy link

@catalinstoian catalinstoian commented Jan 16, 2021

Wld_InsertNpc (Snapper,"OW_MONSTER_NAVIGATE02");
Wld_InsertNpc (Snapper,"OW_MONSTER_NAVIGATE02");

changed to

	Wld_InsertNpc		(Snapper,"OW_MONSTER_NAVIGATE_02");
	Wld_InsertNpc		(Snapper,"OW_MONSTER_NAVIGATE_02");

@szapp
Copy link
Collaborator

@szapp szapp commented Jan 24, 2021

This fix might be close to impossible to implement. How important is it?

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Jan 25, 2021

As it's not noticable, it's not that important to me.

Isn't there any way to just spawn two additional snappers at these waypoints? Or would that be incompatible to mods fixing this issue as shown above?

@szapp
Copy link
Collaborator

@szapp szapp commented Jan 25, 2021

It wouldn't be exactly incompatible. But there is no reliable way to check if the issue was fixed already. We would spawn to additional snappers (to the possible already fixed ones).

@szapp
Copy link
Collaborator

@szapp szapp commented Jan 25, 2021

Actually, I might be able to check if the bug was already fixed. I will leave a note about this, so I don't forget:

Tokenize the Startup and check for any pushed strings. Compare the contents of all pushed strings against "OW_MONSTER_NAVIGATE02" and if found, spawn two snappers manually.

@szapp szapp added the type: revert on save label Jan 25, 2021
@AmProsius AmProsius removed this from To Do in v1.0.0 Jan 26, 2021
@szapp szapp added compatibility: difficult type: session fix and removed type: revert on save labels Feb 1, 2021
@AmProsius AmProsius added provided fix and removed not noticeable labels Feb 11, 2021
@AmProsius AmProsius added the validation: validated label Feb 20, 2021
@AmProsius AmProsius added this to To Do in v1.1.0 via automation Mar 5, 2021
@AmProsius AmProsius added this to the v1.1.0 milestone Mar 5, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Mar 6, 2021

Some more thoughts:

  1. Instead of inserting the snappers only at new game, they could (much like the key item in #46) spawn as long as a certain event has not happened yet (e.g. completed focus quest with Gorn). The check for story progression would ensure not to insert the snappers multiple times and creating an endless source of experience points.
  2. The snappers could either be inserted using their original instance or a duplicate instance from G1CP (like the key item in #46). The former would require this to be a revertible fix where the snappers are removed upon saving. (Problem: How can the snappers be uniquely identified to remove them?) As for the latter, unlike items as in #46, patch-specific NPCs are not written to game saves (see here). This would result in the snappers never being saved.
    In both cases, what if the player is currently engaged in a fight while saving? Loading would result in the fight reset. A hybrid solution could work: Make it a revertible fix: If the distance between PC and snappers is close enough, write them to the game save. If not, do not write them to the game save. Here the same issue arises: How can the snappers be uniquely identified?

So far it sounds very complicated.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Mar 6, 2021

How can the snappers be uniquely identified?

If we introduce new instances, can't we just give them a unique ID or some other variable that the other Snappers haven't?
I just don't know how to check if the Snappers have been defeated, because they won't be in the world anymore.

@szapp
Copy link
Collaborator

@szapp szapp commented Mar 6, 2021

How can the snappers be uniquely identified?

If we introduce new instances, can't we just give them a unique ID or some other variable that the other Snappers haven't?
I just don't know how to check if the Snappers have been defeated, because they won't be in the world anymore.

Yes that’s a general difficulty in Gothic, that also a lot of mods struggle with: Human NPCs generally only exist once in the world. They can be identified by their script instance, e.g. VLK_123_Buddler. Monsters, on the other hand, are objects created using the same script instance. Therefore they cannot be uniquely identified once they are in the world.

Generally, this is solved by having duplicates of the script instance. This can be seem for quests where the player is supposed to defeat certain monsters.

This is an issue I will think about a little bit.

@szapp
Copy link
Collaborator

@szapp szapp commented Mar 6, 2021

If we introduce new instances, [...]

Sorry, I misread this. If we use new instances, we can in fact identify them. NPCs of new instances will not be stored in the game saves, however. If the snappers are in line of sight or are currently engaging with the player somehow. The will suddenly be reset when loading the game.

@szapp szapp removed provided fix type: session fix labels Mar 6, 2021
@szapp szapp added this to Other in Fix templates Mar 17, 2021
@szapp szapp added the impl: modify/analyze script func label Mar 17, 2021
@szapp szapp self-assigned this Mar 17, 2021
@szapp szapp moved this from Other to Unsorted in Fix templates Mar 19, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Apr 14, 2021

I thought this would be conceptual nightmare. See comments above. Now, I remembered that Ikarus is taking advantage (I think initially unaware) of the fact to NPCs that fail to spawn are still created and exist in the world hashtables. Look who we got here:

image

@szapp
Copy link
Collaborator

@szapp szapp commented Apr 14, 2021

Now we can just identify them by their missing waypoint (there might be a more reliable way, I will investigate) and then insert the Snappers mid-game at their correct waypoints. We will save their instances to put them back into their limbo state when reverting the fix. Should they have died in between, that cool, too.

The only hurdle is to decide what to do if they are currently interacting with or visible to the player.

  1. Either keep them in the save - they will then become part of the game and can no longer be "removed".
  2. Still remove them and risk them being re-inserted awkwardly.

@AmProsius
Copy link
Owner Author

@AmProsius AmProsius commented Apr 14, 2021

  1. Either keep them in the save - they will then become part of the game and can no longer be "removed".

I'd go with this solution. It doesn't introduce possible inconsistencies.

@szapp szapp moved this from To Do to In Progress in v1.1.0 Apr 14, 2021
@szapp szapp requested a review from AmProsius Apr 16, 2021
@szapp szapp removed their assignment Apr 16, 2021
@szapp
Copy link
Collaborator

@szapp szapp commented Apr 16, 2021

The test will have to be a bit elaborate by checking if the snappers are gone when unloading the patch.

@AmProsius AmProsius merged commit 3894db7 into master Apr 16, 2021
@AmProsius AmProsius deleted the bug045 branch Apr 16, 2021
v1.1.0 automation moved this from In Progress to Done Apr 16, 2021
AmProsius added a commit that referenced this issue Apr 19, 2021
@szapp szapp moved this from Unsorted to Other in Fix templates Apr 26, 2021
@szapp szapp moved this from Other to Engine mechanics in Fix templates May 14, 2021
@szapp szapp moved this from Modify engine mechanics to Other in Fix templates Feb 6, 2022
@szapp szapp moved this from Other to Default revert manual in Fix templates Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility: difficult impl: modify/analyze script func validation: validated
Projects
Fix templates
Default gamesave manual
v1.1.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants