• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

NPC background process: room transitions

Hi everyone,
I'm currently trying to create an NPC system, in which NPC's have a simple path setup,
but it turns out to not be as simple as I thought.

What I want to do is:
have a non-persistent OR persistent NPC walk along a certain path,
and be able to move between rooms.

The player can talk to the NPC, at which point the NPC stops walking.
Talking and stopping the NPC is the only way the path can be temporarily paused.
The paths don't need to dynamically change at random, just a preset path to follow.

I've figured something out with persistent NPC's,just letting them run their path
and turning their visibility ON if the current room = the room associated with the right path.
At the end of that path, the NPC will switch to the next room's path, and if the player is
also in that room, only there will the NPC remain visible.

Persistent NPC's at first seem easy to do like this, but
persistence is something i want to avoid because it's not something I would give an NPC.
Persistence is more something I use for a save data object, or specific game controller objects.

Anyone that can point me to a forum post, a video,...
where NON-PERSISTENT NPC objects have a certain path BETWEEN multiple rooms,
with the possibility of "pausing" a path and still making the NPC transition rooms correctly?

Much appreciated :)
 

obscene

Member
You can't just send him to another room to follow a path. None of that is in memory unless it's the current_room. I think I would make one giant path that represents his whole journey through every room. Place the path in each room in the correct position. Most of the path would be outside the boundaries of the room of course. Place the NPC instance in the first room you come to and make him persistent. He will wonder around the path, most of the time off screen. When you switch rooms, you may need to get his position and then reposition him again on the path on the next room. I don't work with paths often enough to explain the details, but I think that would be the correct concept.
 
Top