BGMC26: Solar Sailing Space Simulator (SSSS)

Congratualtions to smoking_mirror for guessing what the game is about. ANd so this thread is no longer the “Super Secret Space Simulator”, but is the … “Solar Sailing Space Simulator.”


Some concepts and math:

WARNING: This is probably not going to be a fun game to play.

Lol at first i thought that this was SSS (Sub surface Scattering Space Game

Lol , My bad !!! :slight_smile:


Lol is it abt math?


I’m sure it will appeal to some…not my thing, but I think that it is something that piques your interest, so why would no one else be interested… It seems like a larger project though…just my thinking…I’m not sure how the gameplay elements are planned out though.

If you add time-warp, it might be more a fun game.

It will definitely need a time-warp. Otherwise playing a game would take months or years. It’s just that, well, normal orbital mechanics is intuitive enough as it is.


In case you can’t see what’s going on there, let me explain. There is a vehicle (yes, it looks like an umbrella), and below that is an image of the vehicle’s normals. The image of the normals will be the basis for the physics of the whole game.

After getting the render to texture running, I tried processing the image in python, and almost immediately ran into issues. Even at 128px resolution, attempting to extract the 16384 vectors resulted in a lousy 12 FPS - let alone doing any processing with them. In comes the ctypes module to save the day - allowing the 65536 values to be passed into C without really touching python. So doing similar processing in C took only 0.0065 seconds - a 10x improvement.

However, I now need to throw a page of math at the system, so I expect that time will increase a fair amount. I’m hoping I’ll be able to keep the 128px resolution. Either that or I’ll have to figure out a way to split the processing over multiple frames. At least I’m not doing 16 thousand raycasts per frame! Bulletphysics would not like that at all.

Edit: Just noticed I’m catching the previous render texture in there. Oops. Need to filter that out.

Looks great so far!
What will be the antagonist of the game?

Is it a solar sail?
The sail is made up of 6 triangles, so for basic control you’d only need 6 rays wouldn’t you? You could subdivide that, 6x6 for example would still give high performance while giving very similar results to a 128×128 texture…

@smokng_mirror: Yup, it’s a solar sail. Congratulations, thread title unlocked.

Yes, I could have gone with a simplified approach such as using a single raycast per sail area. Or I could have just gone with the simple formulae on wikipedia that just deal with sail area and angle with respect to the sun. But then you’re locked to providing metadata about the vehicle, rather than just it’s shape. Considering that rasterizers are very very fast at extracting projections of geometry, to me it made sense to use it to do the heavy lifting.

Even if I have to go down to an 8x8 texture (which you can do in BGE), that’s the equivalent of 64 raycasts. Admittedly, more of those would be wasted than if I specifically placed raycast locations, but by the time you’re at even 32x32 texture, you’re doing 1024 raycasts with far less processor load than the equivalent raycasting (there’s a reason game engines aren’t raytracers). And if you need to process the results of those raycasts it’s always going to take time regardless of raycasts vs rasterization. There isn’t too much math involved (a vector projection and a cross product), but from working with trails, I know that the mathutils module struggles to do more than a couple hundred operations per frame - and the math is simple enough for me to implement in plain C. I was aware when I started that the bandwidth requirements would be high, and decided I needed the challenge.

Actually, this BGMC is just an excuse to implement this simulator. I’ve been wanting to play around with solar sail design for a while - and anything that would provide experimental control should do a little more simulation than a game would.

So anyway, force calculation is done (vector projection). Now I need to calculate the applied torque from the sail (cross product).

You’re going to be flying that umbrella and the challenge is simply going to be to get to various locations (eg change orbits, exit a lagrange point, earth/moon transit, etc). I think that will be quite hard enough - particularly if I decide to do it in 3d…

Actually a while ago I had an idea in my mind to use real-time rendered normal buffer for simulation of air flow for air resistance and lift force simulation. Cool to see that the process of creating the texture is already confirmed being doable.

65536…what was the size of a short again?..does anyone still use the ‘short’ variable?

This looks like the kind of game I’d like to play. Can’t wait to see where you get with it. :slight_smile:

Just whatch out for performance when you do. There’s a lot of data in an image

2**16 == 65536. In this case it is also 4 bytes per pixel of a 128 pixel square image. Any shouldn’t you be using int16_t instead of short…

Well, hopefully it gets somewhere.

Well, you can now blow the vehicle away from the star using the forces and torques computed by the C module. So the physics (and the “hard” part) is done. Tomorrow I’ll add the actual gameplay.

Oh, and … STAR!

It animates beautifully as well, with the features slowly changing and flares drifting up from the surface.

:slight_smile: you are correct , TBH I was asking because I simply do not remember and it made a little spark go off inside my head :slight_smile:

Is that star animated? I imagine not...would maybe be too much work, but would be really nice to look at.

EDIT: I see under the image you state that it is, in fact, animated.

@Justin: Here’s an animation. The gif loops poorly, the real animation loops properly:

Lessons about flying solar sails:

  1. Change velocity slowly - otherwise you end up in elliptic orbits, and because a solar sail doesn’t have much force at the aphelion, it is very hard to move into a high orbit if you tried to change orbit fast.
  2. Try to keep the craft’s cabin pointing towards the star - getting out of a tumble is very hard.

I think the gameplay is going to be a couple of tutorials on how to control a solar sail, and then passing through waypoints/picking up parcels. It’s hard enough without any other sources of gravity, so I think I’ll leave other planets out (as cool as they would be).

Anyway, we have a HUD widget:

The yellow lines is the sun vector. The green is the force from the sail, and the purple is the current velocity. I’m going to add torque to this widget as well - somehow.

Does the HUD show it in 3D?
I like the looks of things so far, the sun looks very awesome.

That is a very nice star!

@Shogun Lloyd: Thanks
@Adrians: Nope, it’s 2D - and actually, I just removed it as I changed how the camera view works so things are now obvious without it.

You’d think that if you just used plain ANSI C, then it would be easy to get running on both Linux and Windows. Unfortunately creating window’s DLL’s is slightly different to creating linux .so files, so I ended up spending two hours fighting compilers in Windows. However, it now (should) be windows and linux compatible. I don’t have a mac here, so I haven’t been able to build/test for mac.

Anyway, I reduced the control throw on the sail and it’s now playable although you still can get into hard-to-recover spins.
I also added comets to colled. Yes I know that the tails should point away from the star, but this looks prettier:

Tomorrow I’ll add in a score screen.

For those who want to test, please download this zip. With luck it should work out of the box with Blender 2.78 on Windows and Linux. If it doesn’t, please let me know what OS you’re using. (13.5 MB)

With luck it should work out of the box with Blender 2.78 on Windows

Confirmed for windows 10

It looks like a very easy game, i was so wrong!

Woah! That is cool!

Works fine for me on Windows 10, Blender 2.78c