I have setup a platform game where the player walks between layouts. There are also characters walking around that move between layouts. All layotus work on the same time, so if you come back to a lyout 1 hour later then 1 hour of time should have passed. Initially I have set the players and characters to be global and use an array to record their position so if the player leaves layout1, enters layout2 and then comes back to layout1 the characters will be in the same position and keep on doing what they need to do.
My issue is that I want the characters to keep moving even when they are on a different layout. My tried solutions so far are;
1. Each person has a path (in an array) they follow which has key stages (each with coordinates, a layout, and a time) that determines where they should be any time in the game at intervals of say 30 seconds. So stage 1 start here at this time, stage 2 walk here at this time, stage 3 idle around here at this time, etc. When a character is on the current layout, the character does all these activities one after the other in realtime, no problems! using behaviours. When a character is not on a layout, their coordinates are changed each time the path "time" is reached for each stage, then when the player returns to the layout, the characters are simply re-positioned to this position.
Problems with this is when the player returns to the layout of the character in between 2 stages of the path, the character can either move to the start or end location of their current stage in the path, making them jump to locations. If the players exits and enters a layout quickly enough the characters will keep jumping between stages rather than starting off where they were when they left the layout.
2. Record the time the player leaves a layout and then again when they come back to the same layout. The game then resets the time back to when they originally left and fastforwards (time scale set to 10) to the current time by changing the time scale. All the characters will therefore move around fast for a few seconds (can hide using a layer). This seemed like a good solution but the issue I have with this is the fastforward often causes the characters to over exaggerate simulation movements or delays trigger to behaviours than if the timescale was set to 1. Causing issues with the characters travelling to their correct cooridinates to trigger next stage in path.
3. I haven't tried it but when a character is offscreen I could calculate where they should be every tick, but this would be quite complicated on a multilevel platform (think hills where X&Y positions change constantly). It would work but...... must be a better solution and not so code heavy.
Is there another easier solution I am missing? I feel I am over-complicating it.