Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.
Elliot Négrel-Jerzy edited this page Mar 2, 2023 · 11 revisions

Hello there !

If you came here, you might be looking for help. Well lucky you, I've created this short wiki.

Displacement

Currently, I'm working on wasd key movement, but there is still no settings menu, so you'll have to switch your keyboard to azerty mode: to do so, press [win]+[spacebar]
zqsd

Moving the camera (your point of view) is pretty simple, just use z to go forward, s to go backwards, and q or d for lateral movement. In case you didn't notice yet, the camera's orientation is fully controled by mouse: just move it to look around.

Speed

This game features two speed variables:

  • the player displacement speed variable: when cruising through space and planets, use the scroll wheel on your mouse to accelerate/decelerate
  • the absolute time scale variable: use the right and left arrow keys to speed up/down the time inside the simulation

Changing Frame of reference

By default, the game doesn't move the camera: it follows the absolute Frame of reference, which is the (O,x,y,z) axis. Clicking on a celestial body allows you to follow it, as long as you don't press one of the zqsd keys, which would switch your state to "free", or in other words, stop following this body.

For developers

It is possible to add planets, moons, asteroids and whatever you fancy in this program.
However I still haven't created a functionnal HUD that allows a common player to do so. The game will only load the planets mentionned inside the list named self.data, inside the world class, whose structure is explained in the next paragraph.

Structure of the self.data list

First of all, you need to clone the project
Now open the main.py file and take a look at the code

self.data=[
        [0,0,0,-0.00,0.003,0,0.30,0.30,0.30,100000.00,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/lp_planet_0.egg"),(0.1,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/lp_planet_1.egg"),(0.14,0,0)],"low_poly_planet01",False,0.1]
        ,[10,0,0,0,0.003,0,0.05,0.05,0.05,20.00,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/Icy.egg"),(0.05,0,0)],"Ottilia_modified",False,0.1]
        ,[0,70,10,0,0.005,0,0.1,0.1,0.1,40.00,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/asteroid_1.egg"),(0,0,0.2)],"Selena",False,1]
        ,[100,0,10,0,0,0,5,5,5,1000000,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/sun1.egg"),(0.01,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/sun1_atm.egg"),(0.01,0,0)],"Sun",True,0.1]
        ,[-100,50,70,0,0,0.003,0.15,0.15,0.15,1000.00,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/Earth2.egg"),(-0.1,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/Earth2_atm.egg"),(-0.15,0,0)],"big_fucking_planet",False,0.1]
        ,[200,0,0,-0.001,0,0.01,0.1,0.1,0.1,100000,False,[self.loader.loadModel(MAINDIR+"/Engine/realistic_asteroid.egg"),(0,0.01,0)],"spaceship",False,0]
        ,[0,-120,0,0.004,0,0,0.3,0.3,0.3,100000,True,[self.loader.loadModel(str(MAINDIR)+"/Engine/FG1.egg"),(0.01,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/FG2.egg"),(0.01,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/FG3.egg"),(0.01,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/FG4.egg"),(0.01,0,0),self.loader.loadModel(str(MAINDIR)+"/Engine/FG5.egg"),(0.01,0,0)],"Frozen_giant",False,0.1]
        # insert your 3d models here, following the syntax (this is the default scene that will be loaded on startup)
        ] 

Here goes the scheme used:

[x,y,z,l,m,n,scale1,scale2,scale3,mass,static,[file,(H,p,r),file,(H,p,r)...],id,lightsource,brakeforce]

For each body, you must add this pattern to the self.data list, containing the following arguments:

  • x,y,z: initial position of the object
  • l,m,n: initial speed
  • scale1,scale2,scale3: obviously the scale of the object over the three axis
  • mass: mass in kg
  • static: boolean, defines if the body can accelerate/decelerate using engines (not implemented yet)
  • [files]: panda3d readfiles list (first file must be the ground, the others are atmosphere models). The structure of this list is: [filepath0,(H,p,r),filepath1,(H,p,r)]
  • id: string, defines the name of the body
  • lightsource: boolean, defines if the body emits light or not.
    If you want the hitbox to be correctly scaled, and your body to have reasonable proportions, your 3d model must be a 5*5 sphere, or at least have these proportions.

Creating and importing 3d models

You will need a 3d editor, and for that purpose, I recommend you Blender. Tutorials are available on the net, that show you how to install the .egg exportation module. When you eventually manage to create your own .egg 3d file, make sure the radius of the sphere (RIP flat-earthers) equals aproximately 5 3d units.
By aproximately, I mean the min and max values are 4.97 and 5.03 (of course you can try other values, just be aware of the danger, comrade).

Why ? you may ask

Because the planet's hitbox is defined to match a 10 x 10 x 10 planet, and not a 3.14 x 803 x 42 one, so stop asking stupid questions and read the wiki till the end.

Why are you saying the planet must be 10 x 10 x 10 large ? Didn't you tell us the radius had to be 5 units ? That's impossible

Of course it's possible. A sphere's diameter equals twice its radius, that's why.

Warnings

There are however some bugs I have overridden by modifying some values in the list. For example, the unit used to calculate forces and displacements is the 3d unit per second, which, if I've done the maths correctly, equals to 28 000 km/s
That explains why the speed I gave to the bodies in the default list is so ridiculously small. I'm working on an ingame converter though, that would make the calculations way easier.
It is also very important to note that you may not load multiple light emitters. That could cause some weird graphical glitches, and in some cases, crashes.

Frequently asked questions

What is the real time scale ? Like what is the initial time scale, in comparison to ours ?

There's currently no way to know it, it depends on you computer's performances, as the time_scale variable is initialized at 5.
The position of each body is updated every frame: let's create a framerate variable, the coeficient between real and simulated time will be time_coeficient=time_scale*framerate, which gives us for instance, with a framerate of 40 fps, and a time_scale of 5s/f (seconds per frame), a time_coeficient of 200 (which means that the ingame time is 200 times faster than yours)

How many bodies can the algorithm handle without crashing ?

Same answer, it depends on you CPU and/or GPU, but there's no theorical limit

I found a bug in the algorithm / it crashes sometimes, what should I do?

Please create an issue in the issue section of the repository, and explain what you were doing before the bug happened (what you were doing in the program, not in real life, lmao I don't care about your dog eating donuts or whatever)