Русский New site

Advanced search

[ New messages · Forum rules · Members ]
Page 2 of 3«123»
Forum » SpaceEngine » Off-topic Discussions » Demostrator I (Now more friendly controls)
Demostrator I
AlphaDate: Thursday, 15.12.2011, 10:50 | Message # 16
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
Ok, i get a mechanism to produce a smooth movement from detail to general. If you want i can share it with you, i think it is useful and worked fine, at least for my computer. This not a so basic mechanism as the previous one, but somehow more complex.

Edited by Alpha - Thursday, 15.12.2011, 10:53
 
SpaceEngineerDate: Thursday, 15.12.2011, 18:49 | Message # 17
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
I've rewritten the camera code now, and I will make physics-like calculation of camera movement. I.e. 100-200 iterations per second, not one per frame. This will unbind camera movements of framerate.

*





 
AlphaDate: Friday, 16.12.2011, 10:32 | Message # 18
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
Yes i have tested it many times, really i'm writting a physics based program for my thesis and it is absolutely necessary to separate physics calculation form frame rate, this planet simulator is just a hobbie.
I think that more than 50 iterations per frame is enough, if you put 200 iteration probably frame rate will slow down for large numbers of objects. 50 iterations per frame is enough to have a smooth movement.

Secondly, for interactions between objects (collisions, detections) i higly recommend you to distribute objects in a 3d mesh based on XYZ coordinates, it allows you to compute only nearby objects and not All objects everytime you calculate distances between them.

It does not work for gravity because you need all distances everytime, i can give you some tricks to accelerate it and not fall in exponential calculations.

Will you use newtonian physics? I think it is the most efficient physics calculations.

Any way my last post was about a way to accelerate mesh regeneration. I just unbind mesh generation from frame rate, so i don't claculate the enitre mesh when i need it, i just calculate it in 6 o 7 steps and then i present it, it allows me to have a smooth movement from general to detail with a mesh generation every 6 - 7 frames without noticeable delays.


Edited by Alpha - Friday, 16.12.2011, 10:35
 
SpaceEngineerDate: Friday, 16.12.2011, 12:29 | Message # 19
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
In SpaceEngine, I collect texture/mesh requests while render the frame and run loading process at the end of the frame. If loading takes more than 50 ms, I interrupt it and begin next frame. All unprocessed requests will be loaded in next frames. I also try to make loading in other thread, but found that OpenGL doesn't love multithreading: I hope that lags will be eliminated using multithreading, but they on the contrary increase.

For ships, I will use Newtonian physics and take into account gravity influence from every body in system. Physics calculations will be performed 100-200 times per second, while calculation of gravity forces at only 50 times per second, because they are expensive. However, as long as planets are very big compared to ships, reducing of gravity calculation accuracy will not be noticeable. To optimize gravity calculations, I may merge distant planets with their satellites, and model asteroid belt's potential with analytic expression. And of course such calculations will be performed only for bodies in system where a ship is. For interstellar flight, nearby stars will be taken into account, and gravity field of galaxy will be modeled by analytic expression.

*





 
AlphaDate: Friday, 16.12.2011, 13:06 | Message # 20
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
"while calculation of gravity forces at only 50 times per second"

Yes, but what about collisions? To take in account collisions you must calculate all objects distance with all objects (ships, stars, shots,etc.), i imagine you will use a 3d matrix to put all objects in their "cube" and then calculate only near bojects. I tested 3d matrix and i could simulate more than 10000 bodies with 100% accurate collisions.

To make collision calculations more efficient i have mutiple previous filters before use the "expensive" algorithms. I have a general readius for ships, a sub radius for modules in ships and then collisions. This worked fine even with complex shapes or morphing shapes. If you use hiperelliptical forms you can even calculate collisions with explosions that change forms in real time without noticeable delays, this is something interesting.

If you are interested i will send you code about hiperelliptical shapes.
 
SpaceEngineerDate: Friday, 16.12.2011, 13:30 | Message # 21
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
Quote (Alpha)
Yes, but what about collisions?

To calculate collision, I need to calculate precise position of only one planet - with which ship is colliding. In SpaceEngine I don't expect massive player interactions such as 1000x1000 armies with thousands of physical objects that may collide each other.

Quote (Alpha)
i imagine you will use a 3d matrix

Do you mean the octree?

Quote (Alpha)
I tested 3d matrix and i could simulate more than 10000 bodies with 100% accurate collisions.

I know about GPU physics simulation with 10-50 thousands of bodies. If you get 10000 bodies on CPU at real time frame rate, that's an excellent result!

Quote (Alpha)
If you are interested i will send you code about hiperelliptical shapes.

I don't clearly understand what you mean. Is it spheres and ellipsoids?

*





 
AlphaDate: Friday, 16.12.2011, 13:44 | Message # 22
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
"I don't clear understand that you mean. Is it spheres and ellipsoids? "

This is the interesting thing, it's a spehere, it's a ellipsoid or it's a cube, all depends of only ONE factor, so you can change from cube to sphere to starlike shape in real time just chaging this factor.

first imagine and spherical object, add three radius, now you have an ellipsoid, if all radious are equal it's a sphere, if not it's an ellispoid.

Ok now imagine you have a factor that transform this sphere in a cube, how?

spherical distance = Square(x^2 + y^2 + z^2) -> now you divide x by distance, y by distance and z by distance and you obtain 3 vectors, then you multiply this vectors by radius and you have a point in a sphere.

now imagine

distance2 = Square(x^10 + y^10 + z^10) -> if you divide x by distance2, y by distance2 and z by distance2 your vector will be different, if you multiply it by radious you obtain a cube like form.

It's more complicated than this but this is the basic concept, it's higly efficient and there are ways to make far more complex forms with this simple method.


Edited by Alpha - Friday, 16.12.2011, 13:46
 
SpaceEngineerDate: Friday, 16.12.2011, 14:18 | Message # 23
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
But how fast is collision detection with these things? For two colliding spheres it is very simply: just compare distance with sum of spheres radii. For axis-aligned boxes (AABB) it is simply too: just compare distance along every coordinate axis with size of boxes. Collision detection for randomly orientated boxes (OBB) is a bit complicated... And most complex case is arbitrary polygonal mesh. And how with these hyperelliptical shapes? Is where simple analytic expression like for spheres? And for randomly orientated hyperelliptical shapes?

*





 
AlphaDate: Friday, 16.12.2011, 14:33 | Message # 24
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
Essentially hiperelliptical shapes collision is a variant of spherical one for randomly oriented axis and diferent radius, so it's very fast. Like cubes you need to compute more than one point, anyway i'm suspicious that there must be a formula to compute nearer points but i have not mathematic base to develope it.
It's very fast and you could use many techniques to avoid unnecessary calculations like use a minimal distance before began hiperelliptical computing, etc... I had simulated more thant 150 ships runing around, and game only slows down when 30 or 50 ships come in collision at the same point, this means a very unprobable case, anyway if you ar not going to put large numbers of ships it will work perfectly. You could generate explosions with random shapes. Essentially my planets are hiperellipses, and they have mountains, craters, etc. so i think you could generate real time explosions with this mechanisms, simulate shock waves, etc.

Maybe you don't need it, but if you think it could be interesting for space engine just ask me and i will send you anything you want.

If you want i will send you a variant or this test with shape morphing ships to see the effect.


Edited by Alpha - Friday, 16.12.2011, 15:04
 
SpaceEngineerDate: Friday, 16.12.2011, 16:07 | Message # 25
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
is it possible to simulate massive ships battle in your demo?

Quote (Alpha)
Maybe you don't need it, but if you think it could be interesting for space engine just ask me and i will send you anything you want. If you want i will send you a variant or this test with shape morphing ships to see the effect.

Please, send it to me, it may be useful when I start working on ships collision.

*





 
AlphaDate: Friday, 16.12.2011, 23:54 | Message # 26
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
my demo is not optimized for large battle ships, but i can put 10 or 100 ships and let them move around. You could see clearly collisions if you do as follows:

Now we began with 10 ships then you can observe clearly collisions with shape morphing ships.

Just press "-" one time and do not move, wait two or three minutes... then little battle ships will began to follow you.

DO NOT TURN

it is not optimized, i think that an optimized engine could work fine.

Look big ships, they are shape morphing.

In the 100 ships case i put 30 little ships and 70 big ships, i do it this way to prevent massive collisions that slow frame rates.

Attachments: Installer10Ship.rar(196Kb) · Installer100Shi.rar(196Kb)


Edited by Alpha - Saturday, 17.12.2011, 01:59
 
AlphaDate: Saturday, 17.12.2011, 17:29 | Message # 27
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
Remember that planets are the same object than ships, but planets are developed and ships are still in an initial phase. So i'm pretty sure that this mechanism could result in detailed ships.

Just another question: Maybe you are already doing it, but when you calculate light and athmospheric effects on planet mesh, maybe it could be useful to priorize calculations on near areas, for nearer mesh areas one calculation per frame, medium distance areas ones calculation every 3 -5 frames, for far areas one calculation every 10 frames... maybe it could be useful.
 
JackDate: Sunday, 18.12.2011, 03:36 | Message # 28
Observer
Group: Newbies
Philippines
Messages: 9
Status: Offline
Thank you for sharing.
 
AlphaDate: Sunday, 18.12.2011, 11:56 | Message # 29
Space Tourist
Group: Users
Spain
Messages: 31
Status: Offline
Its better to share it, than leave it in my pc memory for eternity. biggrin
 
SpaceEngineerDate: Sunday, 18.12.2011, 13:43 | Message # 30
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4796
Status: Offline
Quote (Alpha)
Just another question: Maybe you are already doing it, but when you calculate light and athmospheric effects on planet mesh, maybe it could be useful to priorize calculations on near areas, for nearer mesh areas one calculation per frame, medium distance areas ones calculation every 3 -5 frames, for far areas one calculation every 10 frames... maybe it could be useful.

I render all parts of planet that is visible on screen. It is impossible to cache lighting calculations somewhere? (where?), and it is unnecessary. SE does all lighting in pixel shaders, not on the mesh.

*





 
Forum » SpaceEngine » Off-topic Discussions » Demostrator I (Now more friendly controls)
Page 2 of 3«123»
Search: