Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

Networking and planet simulator

Sign in to follow this  


Haven't posted any update since some time.. sorry.

I haven't been idle though. I've been coding pretty intensively these last weeks, although it's only the top of the iceberg. I have started the client / server implementation of my solar system simulator, and today, got the first "good" results.

I am simulating the complete solar system (OUR solar system), with approximately 50 bodies, all correctly orbiting around each other. The simulation is done on the server, and the rendering on the client.

I was a bit worried about the amount of bandwidth usage required to make this little world run smoothly, but finally it's going very well. Assuming 1 update packet per second and per body, each packet being around 50 bytes (positions are transfered as doubles. Floats don't have enough internal precision), i only consume 3.5 KB per second.

Optimizations are not in yet. In particular, the amount of updates per second will be dependant on many factors, like:
- the velocity of the body: Jupiter is rather slow to rotate around the Sun, in comparison of the Moon around the Earth. For the moon, 1 update/sec is pretty right. I think i might get away with 1 update/10 secs for Jupiter, or other "slow" planets/moons.
- the distance at which the camera is from the body: i don't need 10 updates per second to display a planet of 1000 Km displayed at 40 A.U.
- finally, extremely small bodies (<1 pixel) do not need any update at all, since they are "culled" server-side.

You might be surprized about the "1 update per second" only, but planets do move pretty slowly and i implemented client side prediction of the entities movement. It's only a linear interpolation but it works well at the moment. I will improve it later. For the planets.. 1 update per second looks like perfect. You'd never believe it's running on a server.

The clustering system is in. This is basically a data structure heavily optimized to quickly query what entities are in a radius around another entity. This allows the server to determine, given a body/planet, which clients can see it. But i need to stress test it.

The networking component becomes mature. I recently added a lot of functionnality: multithreading, low latency, low CPU usage, low amount of temporary copies, automatic disconnections, automatic latency/ping determination, implements RDP (reliable UDP, but with a reliability system that can be set per-packet), that kind of stuff..

In the next days i'll do some stress tests and consolidate the net code.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!