Cross-Scene Simulation?
Hi everyone,
I'm still quite unexperienced with Unity when it comes to performance issues.
My goal is to have a basic space sim like game, basically the kind of thing you already know from all the space sims out there: Multiple sectors with "star gates" connecting them, fighting, trading.
I'd like to simulate all the space ships and stuff in the other sectors and enable the player to jump between ships and therefore between sectors in realtime.
Now, I know, as Unity can't run multiple scenes simultaneously, the typical approach to simulate foreign sectors would be to simply roll the dice on some events (like piracy whatsoever) and do some calculations on distances and battles and so on. Then just spawn a ship wrack the next time the player enters that particular sector. But that won't allow me to do that cross-scene-jumping and it minimizes the actual simulation in it.
So I came up with the idea to load everything that's in a scene (i.e. sector) into layers and then just hide the unneeded layers in the camera settings at runtime. Calculations on collisions etc. would be done only for the respective layer(s) respecting the collision matrix settings.
Now my question is: Is this the way to go? Are there better approaches? Is that even possible performance-wise or will it simply kill every machine that tries to run the game? Any experience on this?
Thanks in advance, kind regards, Outliver
What about fullscreen element transition? Why not make each sector a different scene
When you use your stargate, you make a cool fullscreen video/animation/special effects that hides the game (think like a blue vortex like stargate)
While blue vortex is running, you load the scene in background.
Once loaded you make a fade to white screen
Then you load your new scene.
In your new scene you add a white image in full screen
Then you fade your white image to void, then displaying back your game
Edit: (I suggest this but I don't what your game is about, homeworld like, sins of solar empire, Eve online like game, ...)
I mean, if you have mass battles with lot's of physic (like Space engineers, eve online), CPU will have problem. If it's like sins of solar empire, with only road between planets and almost no physics, it's not the same impact. Loading all sector and tracking every fights seems big, but i don't know your game.
Generally, if the player don't see it, better not make him do calculations, unless you know you need it.
Hey, thanks for the reply! :)
There's probably not too much battle action going on here but neither do I have fixed static roads so there is quite some physics and ai involved.
Anyway, my question is not "how do make a loading screen animation". I can't simply load a scene or keep it unloaded until needed because I need to simulate "Sector B" while the player is in "Sector A". Additionally, the player should be able to swap to another ship in another sector (i.e. to take control over the ship e.g. in case of an enemy encouter). I think, that's the main issue here.
Thanks a lot :)
I understand better. Just to add a brick in the different scene proposition; « to simulate "Sector B" while the player is in "Sector A" ». Have no real time fight, an algorithm do the job before your player arrive.
What if you define units categories (bombers, interceptors, cruisers, destroyers) and you define strength and weaknesses of unit categories (interceptors > bombers, cruisers > interceptors, etc.) (or just use your ships raw datas, health, damages, etc.). So you can do an evaluation on how much units has been destroyed over time since the begining of the fight.
And you can have a separate database, and use a global event$$anonymous$$anager for your pirates, trade routes.
If this doesn't please you I'll stop speaking about different scenes x)
(at the bottom it was the end of the comment tree so i post it here xD )
No, it doesn't ;D In your example, I would caluculate the state that the scene would be put into right after loading, right? I'll have to think about that, if it might be a reasonable compromise.
But to stop talking about different scenes, what about my initial idea about using separate layers for each sector in a single scene and then have some sort of sector-layer-manager-script whatever.. thingy...? ^^ Would that be reasonable or is it a performance killer?
Well done everything can work (breaking open door). About layers and camera, Unity already do Frustrum Culling by default (only calcul what in camera cone) and something else exist wich is occlusion culling $$anonymous$$aybe you can read this.
For you, what is heavy on the CPU/GPU in your game?
The article was kinda helpful but still it looks like I gotta do some serious prototyping first. Thanks so far, Odyssee :)
Your answer
Follow this Question
Related Questions
Playing audio through multiple scenes 2 Answers
Additive Scenes, best way to hide content? 1 Answer
Complicated level change problem 1 Answer
How can I merge 2 scenes into one project? 0 Answers
Unity performance questions 1 Answer