Download

How would I create an NPC scheduling system involving multiple maps?

I want to create a single player game were the NPCs follow a distinct schedule, like Stardew Valley. I’ve been working on the system for a few days. Here’s what i have so far.

  1. Data table with a defined schedule that the NPCs can follow.
    2.In world clock that records in game hours(60 seconds in real-time), days, and months.
  2. Having the NPC’s spawn within one map at certain places based on their schedule.
  3. Having NPC’s move to a “Standing Point” actor during certain times based on their schedule for a single level.

The problem I’m having is scaling this up for use in multiple maps. Specifically

  1. How would I get the location of the “Standing Point” actors in different levels?
  • Is there a way to use get all actors of a class on multiple maps, or get information from other levels.
  • I tried saving the locations in the instance on construction, but to my knowledge instance only starts during runtime so I couldn’t use that to save the location values.
  • I really hope I won’t to manually input the location for every location an NPC could be standing.
  1. How would I simulate actor movement within the maps I’m not in. Is there a way to simulate movement while only using the numbers, while still maintain the NPCs pathing so they don’t end up spawning in a wall or something?

  2. How should I have NPC’s move through multiple levels. Say if the NPC is in map 1 has a destination in map 3 but has to pass through map 2 how would I tell him to pass through the levels? I could create a big data sheet with all the connecting points of the map and just have the NPC branch through the data tree until they get all the transition points they need to pass through to reach the map with there destination, that doesn’t seem the most efficient way of handling things.

The best option, IMO, is to “down-rez” NPCs that are in zones that the player is not in. Have a schedule of “location to be in” and “time to spend there,” and if the player is not in the level, use one simulated minute to walk from one target to the next one. You can still simulate whatever trade/mining/action is done at each place, using symbolic effects (add/remove inventory, etc,) without playing any animations or anything. The NPCs just exist as rows in a table at this point.
When the player enters a level that has NPCs in it, those NPCs spawn in whatever location they are in, and the Actors take up the simulation job, traveling through actual pathing/walking, playing animations when taking actions, etc.
View it as “LOD” for NPC actions!