solar system generator and gravity simulation eventual MMO

code.google.com/p/stableorbit/

Part game part distributed science research.

TL;DR

People playing the free to play MMO space conquest game will be helping scientists create more accurate models of distant solar systems.

Long time lurker first time poster. I just wanted to thank you guys for the excellent community and engine you provide. Even though I’ve been working with Panda for about two years now on a side project your forums and documentation are so complete I never needed to post anything.

I figured it was time to introduce myself and my project in case anyone might be interested.

My name is Collin Schroeder, I’m a Seinor in the CS program at UAA (Anchorage). I’ll be starting a MS soon. I work full time for a government contractor building web applications.

I teamed up with a physics student (Ryan Haynes) to try and speed up a monti carlo solar system generator he had been trying to build. Initially he and I were unable to create planets and stars that would produce any orbits whatsoever.

I used a GA approach in an attempt to speed things up. Through countless hours of parameter meddling the Genetic Algorithm eventually led us to a more general solution which we could rapidly produce orbits and star systems without the need for the GA.

In its current form I have both a client and a server. a client may choose to download previously generated systems from the server or choose to generate a new one and upload it afterwards.

I had been fairly busy last semester and unable to commit much time to the project. however now that I hear Nvidia has released a PhysX port for 64bit Linux, and the recent tentative support for PhysX in Panda3d, I’m going to undertake a refactoring project to port most of our raw physics code to use the Panda3d API and to clean up the design in general. Weve been toying with Cuda and have been able to run rock solid sims with more than 10,000 particles supporting collision detection and nbody gravitation. We hope that moving some of raw python physics code we hacked together over to PhysX will yield similar performance results.

The long term goal of the project is to create a Space Conquest MMO with as much procedurally generated content as possible. (hopefully on the same scale as dwarf fortress). I’m currently looking at using my central server to keep track of users items and solar system warehousing with player interaction done with a p2p based method.

We’d like to get observational exoplanet data from the National Virtual Observatory linked into the solar system generation algorithm. The idea being that we could base solar systems on the observed star/planet pairs and pitch in millions of other planets trying to find toroidal zones around the star where more planets may exist. If we’re really luck it may help Astronomers reduce their search space and speed up the search for exoplanets.

Thats the plan anyhow. Even if we never finish the big goals (you can’t reach them unless you aim for them) I’m having a blast coding with Panda3D. Once again thanks for creating and maintaining such a first class 3d engine and community. I had tried many other engines (even tried writing my own) and Panda3d is the absolute best intuitive cross platform python scripted 3d engine I have ever seen.

P.S.

If PhysX turns out not being a good match for our project we’re also considering writing our own OpenCL based BSD licensed physics engine. If we end up taking that route is it something that could be considered a valuable contribution to Panda3d?

Or I’ve noticed a lot of other space games out there. if anyone is interested in joining forces let me know.

This project sounds very, very cool and I can’t wait to see it in action.

Yes, but you must know that PhysX has no GPU acceleration on Linux. It’s only available on Windows (with NVidia hardware obviously).

It would certainly be. However, if you actually consider doing that I might suggest that joining forces with Bullet and writing integration code between Panda and Bullet would be a better approach. There is certainly a need for good, hardware accelerated physics engines in the OpenSource community in general and Bullet is the closest to get there. If I remember correctly, they’ve already begun the work on OpenCL acceleration for Bullet and they have support from AMD. So if you find PhysX unfit for your project you might want to join their efforts so that you don’t start from scratch reinventing the wheel :slight_smile:. And Bullet is OpenSource of course.

Again, the project seems really nice, keep us up to date with the progress :smiley:

Hello, and welcome to Panda3d!

I have spend some time on gravitational lenses and large scale structure before I abandoned science and moved to industry, so I know about the difficulties of n-body simulation.

I’m afraid that neither PhysX nor Bullet or ODE will help you as much as you might hope fore. All these physics engines are designed with “normal” games in mind, and hardware acceleration is mainly geared at fast broadphase collision detection for meshes. Hardware solvers are still experimental.

Since you already have stable algorithms implemented in Python/pycuda it might be worth the time to have a look at Panda3D’s source code. There is a folder panda/src/skel, which demonstrates how easy it is to write C++ classes and have them wrapped for Python by Panda3D’s interrogate tools. So maybe porting your algorithms to C++ and having them wrapped by Panda3D gives enough of a performance boost, while not loosing stability at the same time.

By the way: What approach are you using to solve your n-body simulation, and how are you integrating (Runge-Kutta, Euler, Leapfrog, …)?

Hello, and Thanks for the replies, I’m sure it’s going to save me time. Our current implementation is using a naive n^2 algorithm to accelerate each body, check for collisions and leapfrog for integration. all in straight python. Unfortunately as of yet there are no oc-trees or other more creative means of cutting down on the number of calculations in the trunk version. I wanted to pick a good GPU acceleration technology before having to rewrite everything.

We were able to rewrite the nbody solver into the Nvidia Particles demo as a cuda proof of concept. and we even wrote a version with c modules last year but GPU acceleration is now one of our main goals. (after running our unoptimized algorithm with 10,000 particles we can’t get enough).

We hoped to be able to use a mature open-source physics library for GPU acceleration and to alleviate some of the work involved in optimization. It’s disappointing existing physics libraries may not be up to the task.

Indeed bullet might be more trouble than it’s worth. But it will at least improve over my completely naive n^2 collision detection. But I’ll take a peek at it now that I know physx doesn’t support GPU acceleration on Linux. Do you guys know if Bullet supports any nifty data structures like spacial hashing?

The most likely candidate at this point is OpenCL or Cuda once we can wrap our minds around them. I haven’t yet dove into the C++ side of Panda3d yet. Since GPU physics acceleration is the main goal of the current refactoring effort, would you reccomend that we build them with pycuda/pyopencl or straight cuda/opencl and tie into panda3d at the C++ level?

I would suggest you submit your initial post as a review at devmaster.net devmaster.net/engines/engine … .php?id=95, as any info there helps panda a little more.

Your plan is impressive and the fact that you are taking a scientific approach is ingenious.

While I am no expert in either components of a game/science project and my time is probably limited to hours/month for such activities, I’d surely care to join your efforts, since your plan seems to fit 99% what I would like to see done for a space game in all areas (concept, approach, realism, etc).

I’ll download the current release and probably contact you on the googlecode interface.