Manipulate character movement that isn't on screen

Can I have some advices about how I should code to manipulate movement of characters that aren’t on screen?

My game have a map management and it has many map and they are connected by a node that I call it “gate” that be put on border of each map

I planned that I’ll create each NPC of my game to be alive by let them have their own movement and activity. and they still do their activity whether they are on screen or not.

They even can expose to the map that be on screen or disappear into other map.

But this is just my idea. I can’t imagine how to code it yet.

Thank you.

Well, if your characters have nodes that represent their positions (whether those be separate nodes or simply the nodes that hold their models), then I would imagine that you might simply move them as you’d move any other character: by setting the positions of those nodes.

That said, if you have a truly huge game-world and thus don’t want to keep all of your character-nodes in memory, then you might perhaps store their positions as vectors, and update those vectors according to the movements of the characters. Then, when the characters are loaded in, you might apply those positions to the nodes of the characters.

1 Like