This will my 1st time posting here. I’ll try my best to be clear.
Expectations:
I have this scene that is serving as the world map where majority of the gameplay is happening. Players would send out units from their cities to neutral buildings to gather resources inside them and bring them back to the player’s city.
Problem:
When I send the unit out of the city to gather and during that process I change scene the unit pauses and does not continue until I return back to the World Map Scene. I want to make the unit continue the entire process of gathering even when I am looking at another scene. This ruins the time when the unit is sent out and returns because it pauses the soldier’s movement which delays the arrival of the resources it is gathering.
Attempted Solutions:
I tried “Change Scene” which sadly resets the entire World Map scene. So I went with “Pause and Start a new scene” and ended up with the present problem.
Help needed
Is there any other “Action” in the events that allows a scene to continue even after I left? If there is none, what else can you suggest I do to allow the resources to arrive without being stopped just because I was looking in another scene.
This will be not performance friendly if you gonna have A LOT of units
But did you consider not changing scenes
And having all your gameplay on one scene on different layers and now just manage it by showing/hiding layers?
Other than that you would need to create math to calculate how much time it takes units to go from town to gather resources and just deal with that
I would go as simple as making timer
And now when its above some value add to resource var as much as one unit should get * how many units i have
And now your only concern would be to save value of timer between scenes
Well, at least I tried all options. To be honest I already asked Gemini and Gdevelop AI about this and they also said the same thing of using variables and elapsed time instead of relying on motion for this gathering process as this is gonna be ultra bad for performance.
I just really wanted to try if there was any chance this was ever salvageable. I was under the assumption that things like Inventories, Mail, etc. were always best as separate scenes. I’ll remake my non-World Map scenes so that they are now pop-ups inside the World Map. I already did one and it solved the problem.
Thank you very much for both of your insights and suggestions.
Ow you meant for a way to make other scene run in background instead of doing anything else
Well nah 1 scene at a time
And technically
I would go even further
I would just make soldiers walk from point A to B as visual representation
Where i would handle everything by timers
And now same logic i could use across all scenes
But if you just have few units walking from place to place
Then i would go with layers
Let’s say a squad goes to get resources and returns in 1 minute. Let’s use a timestamp: 1 minute = 60 seconds, 60 seconds = 60000 milliseconds.
We store in a global variable the time when the squad went (by timestamp) and when the squad should return (in 60000 milliseconds, i.e. timestamp + 60000).
If the timestamp => when the squad returns, then the squad should return!