Currently all NPCs are loaded immediately and shown all the time. We need to implement proper culling for performance reasons.
Investigation
[x] 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):
[x] 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.
[x] 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:
[x] Spawn all NPCs+Monsters when world is loaded (and do not render them until you reach their spot)
[x] Culling out of NPCs/Monsters after x-meters
[x] 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 routines and spawn points based on the information stored
[ ] v3:
[ ] 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
Currently all NPCs are loaded immediately and shown all the time. We need to implement proper culling for performance reasons.
Investigation
Implementation