hi all, I’m testing something with a really huge scene and some huge objects. Unfortunately, I cant zoom out enough in the editor to even see all of one object. I know, scale it smaller, right? Well when I do that then my player ends up being scaled to .1 while the other vehicles and other objects are at 1 or larger. This works fine if I stay close to 0,0,0. As soon as I start to get 10k units away things start to shake due to floating point. I’m trying to change the scale so instead of .1 the player is at 5, and then everything else is scaled accordingly. I need to be able to get to a distance of 100,000 without any shaking. I know, what the heck am I doing that’s soo big. Well trust me there isn’t much in between. In short it’s going to be many levels in one level, spread all over the place. I will have a jumping mechanism to get me there. I currently use separate actual levels and it works great, but I run into sync issues with the multi-player, specifically around dynamically generated scene objects when the game server client leaves the game (or enters another level) as I can have different players in different levels at different times.
I think it’s too hard to explain all the details here, but I’m just trying to prototype a test to see if I can do it all in one mega level?
Another option would maybe be to try loadleveladditive, but only if I could load a level at a specific offset, but I don’t see an option for that?
Any help on either making the editor scale to support a larger world, or placing levels with additive is appreciated?
The usual way of solving this is that instead of moving the player, you move the world, so the player is always at the origin and hence has no jitter. Obviously making that change can mess up your physics etc though.
Otherwise, if the levels are separate pieces, can you put them all at zero but simply turn off the ones you’re not using? Then when the player teleports, hide the current one and show the new one instead.
Thanks for the reply. I actually thought of that, and in a single player game would be easy to do. However in a multi-player game it could become really challenging to try and convert the network updates to the proper values on each client. I’m sure with some smart coding it can be done but have you dealt with this before and if so is there anything you learned to share, or have you been more single player?
It shouldn’t be that hard if your game is broken into some kind of grid or tile system. Rather than moving the whole world all the time, you move the player around on the current tile which is centered, and only move the world when you transition from one tile to another. (Much cheaper than moving everything all the time.)
That should simplify things significantly, because then your network traffic has to know only what tile something belongs to, and its position relative to that tile. The server then doesn’t have to worry about what tile any client is on, and messages sent to the client can be handled in a consistent way that doesn’t involve too much overhead.
The tricky bit is managing transitions, but that shouldn’t be too big a deal either if you handle the positioning of all objects consistently. That is, any non-static object should always be positioned relative to its tile, rather than in world space. When the player moves from one tile to the next, it similarly gets assigned the new tile, and fires some event which causes all other tiles to re-position accordingly. (As a bonus, you could also asynchronously load and unload content for non-adjacent tiles.)
But also, it sounds like you’ve got massive scale issues, and I’d strongly suggest fixing them. As a general rule, it’s a good idea to make sure that at their normal size things are at scale (1, 1, 1). For starters, I believe that makes Unity’s graphics pipeline more efficient as it can enable more internal optimisations. Secondly it’s less brain bending for developers, and if you can avoid messing around with scale in code that eliminates a whole potential class of bugs. Thirdly, it makes the Editor far easier to deal with. I could go on, but just take it from me - I learned in my early days - getting the scale right is something you want to get right up front, not deal with it during your development.
thank you both. After thinking about it, it’s probably not that hard as angrypenguin discusses. All the data is passed in NetworkRigidBody, so if I add a cell to that, and on the receiving side adjust the value appropriately based on the current cell its actually very little overhead, so I can entertain that. As for my scale issue AP mentions, If I leave things scaled to .1 for the player and 1 for the capital ship I’m fine. As it is now I’m fine if I stay within 20k units of 0,0,0, which for a single section is fine, so if I combine the scaling with the grid system I should achieve everything I need. thanks for giving me a sounding board.
AngryPenguin, I love the alias. I’m a Flyers hockey fan, and therefore Angry @ Penguins after last nights 4-5 loss to those flightless birds hahaha, when I saw your alias I couldn’t help but laugh.