I am calling on your experience with Unity to tackle this problem.
I have ~20 scenes in which NPCs exists. Sometimes, the same NPC will exist in 2 scenes.
Each have their dialog, quests and schedules. Some roam, some sit, some stand. Each’s schedules is recorded on a .csv file and read.
What would be the best way to manage the NPCs on a schedule and why:
-
Each scene contains each NPCs that are required (read: already placed, no spawning event). If the player is in the scene between certain in-game hours or is doing a quest, the NPC will have its navmesh and other scripts activated and will be rendered and scaled from 0 to 1. Otherwise, NPCs are disabled, scaled to 0 and parked elsewhere in the scene until needed. This may be the least efficient method but the most easily manageable with the least amount of debugging.
-
Each scene contains spawn points that will spawn or de-spawn NPCs based around their schedules. This will require creating and managing NPC prefabs based around their schedules. Each time, an NPC will be created and later destroyed. This seems most efficient in terms of resources however, how efficient is it? In terms of debugging, many tests will have to be done to make sure the NPCs do not interfere with each other.
I cannot think of any other design to manage these NPCs.
Any suggestions?