A realistic, huge and open space environment?

@ForceX, I’ve been thinking on this, since I am now experiencing the same mesh jittering your were. How are you approaching it currently? My thought is to create an empty game object called space. Put everything that isn’t attached to the ship in it. Then, you can just move and rotate the space object. Objects in space update their positions relative to the space object’s center. All you should have to do now is update the space object relative to the ship. Transform.InverseTransformDirection() and Transform.InverseTransformPoint, I think, will become our best friends in doing this.

@callahan44, you can do multiplayer using this system. It is just a little more relativistic math, but it is not too difficult.

I have a working model I’ll PM it to you so you can check it out and give me your thoughts.

These articles may be of interest

http://answers.unity3d.com/questions/137097/scale-objects-based-on-distance.html

http://wiki.unity3d.com/index.php?title=Floating_Origin

http://www.gamasutra.com/view/feature/2984/a_realtime_procedural_universe_.php

1 Like

The issue I see with moving the universe and not the player is the performance overhead for re-calculating static physics. I’m fairly sure PhysX uses some kind of octree or other spatial partitioning system to speed up static collision checks (I mean, it has to use some kind of pre-calculated broad phase search system), if you move a static collider all that will need to be re-caculated. You won’t see any hit from a handful of objects but with a few hundred planets, space stations and a handful of asteroid fields and I reckon you’ll end up below 10fps in no time.

The links Beugnen pointed to look good though.

I’d also not want to try and implement multiplayer ridigbody interactions with a floating origin system, just thinking about it hurts.

If anyone is interested I have been trying to get Homeworld Modders involved with transfering Homeworld to Unity so that all ships can be used. All of the ship models are already complete. They are textured and ready to go. All that needs done to convert them into Unity add scripts to them based upon their interactions within Homeworld so the same style of game play can be achieved in Unity but where scenes or maps can be linked together to form a persistent Universe.

If interested check out the Homeworld Complex website where all of the modding tools are there along with all of the scripts that determine how ships fire, are built, attack and how resources are collected, ect.

Like I said all that needs done is too take the models and scripts from Homeworld and incorporate them into a Unity.

I made a game like this. Here are some of the problems I encountered:

1. Objects were too far away. When you have such an open, massive world, it is nearly impossible to find other objects near the size of your ship. They appear as specks on the screen. Solution: I made a script that would draw arrows above these objects (or pointing to the objects if they are off-screen). It worked fantastically, and is now available on the Asset Store: http://u3d.as/content/gdcore/radar-arrows

2. Physics were resource-intensive. Trying to simulate an entire solar system eats up your resources. I originally tried simulating an asteroid belt by giving rigidbodies a nudge and let a point-gravity script take over. Normally, you get get away with having a lot of rigidbodies because most of them sleep at any given time, but in this case, gravity wouldn’t let any sleep. Not a good idea. Solution: Add pretend physics. I parented all the asteroids under a single belt object, and then rotated that each frame around the center planet. The same idea could be used for moons and other satellites.

3. Impossible to control. When objects are really far away, when you use a forward thrust, for a long while nothing on-screen really changes. It doesn’t feel like you are going anywhere, so you keep holding down the thrust. Finally, you approach your destination, but then overshoot it travelling a 10,000 km/s. To make matters worse, we humans are used to having ground under our feet and this concept called “down.” It is easy to get disoriented in null G, and I constantly found myself spinning out of control. Solution: To solve the problem of overshooting a target destination, I did two things: I made the amount of thrust decrease as speed increased, and I decreased the side-to-side velocity of the ship with the thrust (to keep it from drifting too far). To solve the problem of spinning out of control, I added a Stabilize button to my game. It decreases the ship’s angular velocity. (Each frame it would multiply the angular velocity by 0.7).

4. Players can leave the universe. This was a serious problem I encountered with my game, especially when I tried having planets exert gravitational force on the player, which often threw the player to the edge of the universe like a comet when gets too close. The empty void doesn’t make an engaging game. Solution: The first thing I tried was to make gravity work in reverse. Normally, gravity is stronger as you get closer. I made it stronger as you get further away. The idea was that the gravity would overpower the thrust and trap the player near the planet. The implementation was buggy and I eventually ditched the idea. Instead, I created a huge force-field around the entire system. Normally, this would make the game seem very closed, but I made it invisible from most of the system, but increased the opacity as you approach. When you reach it, it is practically solid. I made its collider a trigger that, when exited, would bounce the player’s velocity back into the game.

I have not done this with unity but I have had problems like this with other engines.
And your solution to the never ending universe is viable for so long…

Because in a 3d space…
If you move to far on a floating point… the floating point at one point becomes… unpredictable.
There a demo on the net somewhere with a spaceship moving a long a floating point as very fast speeds.
And it clearly shows the limits of 3d space. So, it becomes impossible to move forever in one direction without actually adjusting everything.

So, just keep a eye out for that.
If you math starts getting realy crazy then you prob need to reset everything to the original position and then account for some sort of offset in each direction of where it actually is x,y,z, so things like… world pos… are correct… if your displaying it to the user… even though the actually game engine as been reset they will never actually know.

First off I know this is basically a dead section in the forum. But anyone that has already posted, I am wondering if you ever fixed the float point problems? If you did what did you do to do this? Are they multiplayer compatible? Also a screen shot from my game because why not?

@Snownebula Very nice. Multiplayer? I see large numbers in meters. what kind of scale are you using?

Hi everyone,
Floating Origin http://wiki.unity3d.com/index.php?title=Floating_Origin
works quite good for me. i use big terrain for very fast ship.