Advice Requested… Hi, I’m making a game about starship battles. I’m curious about the scale I should use. The main player starship “in real life” would be about 400 meters long. So should I use the actual size for the ship, or scale it to about 2 Unity units (2 meters), so that it would be more the size of a character in a game like fortnight or pubg. What would Unity handle better? There will be other space obstacles and objects in the game. There will be no physics in the game. A full-scale ship means a MUCH larger map. I am wondering what Unity can handle on that scale. Or would it be better to make a ship “person” size and have everything more on that scale? How does Unity look at this? What problems might I run into?
At these scales you’ll need to look into floating-point precision issues (google that if not already familiar). Unity stores all positions as 4-byte floats, so you can’t get more than a few thousand units away from the origin before you will no longer be able to position things precisely.
So you should certainly, for one thing, keep the camera at/near the origin, and move everything else around it, rather than moving the camera around in that big space.
Beyond that, yes, scaling those ships down is a very good idea. Maybe to keep things simple just define 1 unit == 100 meters, so your starship is 4 units long. That’s a perfectly reasonable scale.
This will still not be enough to have realistically sized planets in your game, though. So if you have any of those, you will have to cheat.
@JoeStrout Thanks. I appreciate it. That is the main response I have gotten from about everyone. I did some fiddling about with unity and my player ship model and it didn’t take but a few moments to understand what everyone was talking about. My game is multiplayer, so I don’t know if keeping the camera at 0,0,0 is going to work. (Maybe I could develop a local script that takes the incoming transform information and adjusts it???) But the narrative of the game is that it takes place in a “funny/strange” area of space where things are smaller. (In game comedy since I knew I couldn’t do the planets and things actual size). The scale I am coming around to is about 4 meters long for the player ship. Can you think of any other problems I would have if my multiplayer game map was, let’s say, 7000 units (7 kilometers) square in the unity engine? It’s all about making sure I don’t go over 9999.999, 3 points of precision for position correct? I thought of building in an offset that would adjust for decimal precision from the start. So all ships stayed within the .### decimal places. (Don’t know if I am saying that correct). Learning as I go. I think if I keep it all under 9999.999 cubed (it’s a 3D map. Actually it would be double that as I could go -9999.999 also). Plus there are very few moving objects, and they go slow. Fast travel is blip out in one place, blip in in another. Update network position to everyone. You think Unity could handle that?
Thanks for responding. I really appreciate the advice.
Image of light testing for the game below.
You could indeed, but that does get complex in a multiplayer game (and multiplayer is complex enough already!). So yeah, you should probably try to avoid this if you can.
You can have planets etc. actual size, it just requires tricks and cheats. If you’re new to Unity development, then again I agree you should leave them out or scale them down.
No, it doesn’t work that way. You’re thinking in decimal notation; computers work in binary. Maybe try this blog post.
In my experience, if you try to use an animated character model at more than about 2500 units from the origin, the animations will get visibly jittery. Now you’re working with spaceships, not animated characters, so you might be able to get away with a little more. I assume 7000 units means you’re staying within 3500 of the origin. That’ll probably work, but you’ll need to test it to be sure.
I agree with @Kinnith7 that jitter can occur sooner, and in my tests, some (physics) jitter effects can be noticeable at about 1,000. the more complex the calculation, the more the error is magnified.
My opinion:
It is better to keep the players at the origin. The origin-centering is specific to each player and their device, and has no effect on other players. Other players are positioned relative to the player, the relative position information coming from the server.
The decimal equivalent of the “roundoff rule” significant figures is 6 digits for single precision, no matter where the decimal point is.
However, once you float the origin, all absolute limitations become meaningless. That rule is also incorrect because the gap error in floating point numbers doubles every power of two from 1.0.
My proof that absolute limitations become meaningless is the following video, all done in single precision, full scale, and ranging from +10e7 to -10e^11. All continuous.
As @Kinnith7 indicates, it might be difficult to move away from conventional navigation ideas, but if you succeed what you build will be more solid and extensible and better quality.
Thanks for the replies. I really appreciate it. I am going to start running tests in a bit and see how things behave.
This information has been extremely helpful.
I will post what I come up with here when it’s been implemented and I decide what to do. You guys have given me alot to think about. 8)