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

Implement NPC culling #52

Open
9 of 17 tasks
JaXt0r opened this issue Jun 21, 2024 · 0 comments
Open
9 of 17 tasks

Implement NPC culling #52

JaXt0r opened this issue Jun 21, 2024 · 0 comments
Assignees

Comments

@JaXt0r
Copy link
Contributor

JaXt0r commented Jun 21, 2024

Currently all NPCs are loaded immediately and shown all the time. We need to implement proper culling for performance reasons.

Investigation

  • Analyze the value from original G1 about the distance for culling --> ~10-15m (First mesh is made transparent, +5m, the NPC is despawned and respawned if reached)
  • Implement an NPC culling manager similar to the Vob culling manager. (Maybe reuse it?)
  • Handle G1 behaviour (please check with Marvin mode spawns and G1 checks for yourself):
    • It seems that culled out NPCs are still "working". It means for a certain distance their invisible but still doing their routines? - yes. ~+5m distance after invisibility, they will be removed from game.
    • It seems that if you're really far away, they will be completely being disabled and re-enabled when you're close by again.
  • To be handled: Whenever an NPC is brought back again (e.g. Marvin mode in G1 spawning to a far away WP), the routine (e.g. for walking) is being interpolated between Routine-start and Routine-end. (You can check with the two swamp Templar walking between swamp and old mine. When you spawn next to them, they will immediately spawn at their interpolated routine route)

Implementation

  • v1:
    • Spawn all NPCs+Monsters when world is loaded (and do not render them until you reach their spot)
    • Culling out of NPCs/Monsters after x-meters
    • When spot is reached again, make the meshes visible again
    • NPCs/Monsters just restart their routines from scratch
  • v2:
    • Load SaveGame and NPCs/Monsters which are inside RootObjects, will go on with their current routine status and spawn points based on the information stored
  • v3:
    • Optimize Culling spheres: If NPC is walking, then alter culling-array's value
    • Implement culling logic similar to G1: (1) fade out NPC/Monster, (2) destroy ~+5m further away
    • As Wld_InsertNpc() is called only once per new game start, we need to ensure, that our culling data stays the same across world switchings
@JaXt0r JaXt0r transferred this issue from Gothic-UnZENity-Project/binary-dependencies Jun 21, 2024
@JaXt0r JaXt0r self-assigned this Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant