Has anyone tried making an AI system for NPCs in a multi-area city?
We have 5 exterior areas and numerous interiors, multiple points of interest: shops, taverns, etc. 'Ordinary' ambient anims look very inappropriate in this case: NPCs just randomly wander in a limited space in a single area.
My ideas were:
- Spawn: Generate NPC with random appearance, generate activity list (i.e. go to a tavern, spend 5 hrs there, then go to a local bazaar, spend 3 hrs there, then go to a random door and despawn).
- Pathfinding: built-in pathfinding causes NPCs to cut edges and walk near the building walls. People usually walk on the roads. My approach was to pre-configure the area by placing waypoints on intersections and linking them together with localvars. The pathfinding
script then finds the best path to the destination and makes sure that NPC walks on the road.
- POI activity: Once an NPC reaches the POI, the AI control is handed over to the local AI script written specifically for this POI (tavern, shop, bazaar, etc.)
- Once the activity queue has been executed, the NPC despawns. The spawner script is then free to create another NPC with a different appearance and activities
- Resource saving: if there are no players in the area, the AI doesn't assgn any actions to the NPC, but still mantains the action queue and timers.
Has anyone tried doing something like this?
Modifié par virusman, 30 juillet 2012 - 02:50 .