Project X-Space

Black Phoenix

New member
Joined
Dec 8, 2011
Messages
14
Reaction score
0
Points
0
Website
brain.wireos.com
In my view the X-Plane flight simulator has a great potential to become a true aerospace simulator: it already calculates physics (not talking about their realism though) for arbitrary aircraft at subsonic and supersonic speeds, but it had some issues with space flight.

For example the integration was not correct, and the error grew as you would travel faster and faster (for orbital velocity the error was as high as 1 m/s error in velocity per 1 revolution around planet). Plus it was lacking some graphical and misc physics points.

Anyway, what does this have to do with Orbiter? X-Plane networking is very lacking, only works in LAN (and not very well), and of course the networking falls apart in orbit. I'm creating a plugin for X-Plane which fixes all those physics problems, graphics issues, and also adds networking support to X-Plane, including networking while on orbit.

So I found out that Orbiter API is pretty allowing, and already made this plugin (core parts of it) start up under Orbiter. The goal here - provide networking for low-speed and high-speed flight (orbital flight). As a bonus it also gives compatibility with X-Plane.

It's still a WIP, but so far it does synchronize the low-speed part (more details below).

Features (only ones making sense for the Orbiter version):
  • Precision low-speed flight (precision in other aircraft coordinates is a priority over their trajectories)
  • Adequate high-speed flight (other aircraft/spacecraft positions are visually correct, but not precise anymore)
  • Support for 30 vessels in orbit (planned to be extended to 500 in later versions. This number comes from CPU limit, not bandwidth)
  • Support for joined vessels (two vessels which are mechanically tied together, for example docked or simply rocket stages still attached)
  • Optional write protection (requires an unique key/hash for every spacecraft that will be recorded on server)
  • Models (meshes) are stored server-side, and are downloaded to all clients

Specifics (some things work in an unusual way):
  • In early versions flight is limited to low Earth orbit (X-Plane limitation, there's no way to go further away)
  • Uses custom physics engine (in some cases) which kinda ignores Orbiter physics settings right now
  • Synchronizes all vessels which are not "networked". If every player loads scenario with an ISS, assuming that ISS has a networked model defined, there will be several ISS's in the orbit (one for each player).
  • Uses UDP for networking
  • Simulation only runs in realtime
  • Time is driven by server

A bit of information on how it works:
The server generates a fixed amount of "frames" per second. During each frame it sends entire world state, delta-compressed, to clients (simple words: it sends to clients only bits that have changed).

Each vessel has a "state vector", out of which a limited number of variables is synchronized at the same time. State variables are:
  • X, Y, Z (coordinates in non-inertial coordinate system, relative to Earth nearest celestial body, but for now only Earth, also relative to CX, CY, CZ)
  • VX, VY, VZ (non-inertial velocity in same coordinate system)
  • AX, AY, AZ (non-inertial acceleration)
  • q (quaternion defining orientation)
  • P, Q, R (angular velocities)
  • CX, CY, CZ (relative offset for X, Y, Z coordinates)
  • Custom variables (defined by spacecraft)
  • Timestamp for this state vector

CXCYCZ are double precision, all other variables are single precision.

During initial minute or so client will synchronize their internal clock with server (typically to precision of about 10-50 msec).

During low-speed flight the state is synchronized as described before, when client receives new frame the state vector is extrapolated (based on known timestamp of this state vector), and then weighted-averaged with "visible" state vector (the one that's used to draw objects).

During high-speed flight the physics are switched over to server. The server calculates physics for all vessels, and positions of all other vessels are synchronized relatively to client (at least for the vessels in close range).

During this mode clients send a "log" of all forces which have acted on the vessel, along with timestamps (server will apply this forces in correct order, and with correct duration, BUT it does not correct for lag when doing so. The forces are presumed to be very small, from some sort of vernier RCS).

That's the general idea right now. The low-speed part is implemented (in X-Plane version, what's left to Orbiter see below), and parts of high-speed flight are implemented (it can integrate vessels on orbit, but it just ignores this data since no force "log" is yet sent).

Assumptions:
  • When two vessels are close, there are only long-term forces (gravity) and short-term forces (RCS) acting on them
  • Desired precision in position during high-speed approach (aka docking) is +- 0 meters
  • Desired precision in velocity is +-0.1 m/sec (would be better to talk about acceleration though)
  • Velocity change (linear, angular) from short-term forces is less or equal to desired precision in velocity
  • During high-speed flight the trajectory is weakly influenced by aerodynamics (not a correct assumption, but will have to do for now)

The project is open-source (I did not upload the source for newer thing yet though, I'll just post link here when I do). Problems that are left to be solved for orbiter version of the plugin: making meshes and drawing them, reading/writing list of vessels (it only does it for focused vessel right now), GUI (uses X-Plane GUI API, but is not very hard to remake interface to Windows API), reading vessel scripts somehow (or generating scripts based on thruster groups or whatever is used in Orbiter).
 
Orbiter can always use another planned multiplayer addon--can never have too many of those.
 
Orbiter can always use another planned multiplayer addon--can never have too many of those.

Ah no sorry, you misunderstood the post. It's not a planned orbiter addon, it's an X-Plane addon which is already working (most of it*), I just decided to port it over to Orbiter. To stop people suggesting Orbiter on X-Plane forums - so they can just use both simulators equally.

Most of it* - I previously programmed the networking in C. There was some weird bug with delta-compression, sometimes connecting to dedicated server caused invalid state to be loaded by it, fixed by a restart. Generally programming in C was annoying, so I've tried a new approach: mixing Lua and C, so now most of low-level stuff is in C, and highlevel protocol implementation is in Lua.

If you'd like more technical information/source code, I will upload it for you to see. I didn't want old C code to disappear just yet (err, it stays in repository history though), but here's the respository: http://dev.wireos.com/hg/x-space/file/29fc4e993461

Yeah I know it's a whole load of C files, honestly the rewritten version is structured much more nicely :)
 
Some updates to the project. I've started work on an additional feature that might be interesting to Orbiter users (though... a different project of mine might make it even more interesting, see below) - radio transmission simulation, including transmission through the server (between the clients).

The clients can send any sort of binary data, which will then be transmitted (radiowave propagation is "sort of" simulated - right now it's simply line of sight, slightly modified). The bits (which may have been corrupted) will arrive to the receiver. It's up to receiver to decode the data then.

This is roughly what radio transmission model looks like (white - probability that a given bit is not corrupted/distorted):
ZSlbq.png



So now up to the next project... I assume I'll make a new thread about this later on, when it reaches "beta" stage and would have some potential for anyone else to try it out. It is called VSFL Network - virtual spaceflight network. I'll save the technical explanations for later - to put it simply, it is like VATSIM, but for spaceflight.

The simpler version of the VSFL server will just synchronize some basic state and show some stuff on the website - that's boring and not something I'm focused on at the moment. The realistic VSFL server provides all the features including permanent simulation of objects launched into orbit - any satellite that has been released from the spacecraft will stay up in sky even if the simulation that was used to launch it has been closed.

It works like this: initial request for satellite registration is submitted, a simulation on server is created and vessel is registered with the network (each vessel must be registered, though for satellites an extra step is required to provide computer systems). The satellite simulation uses up some CPU time on my machine to run its computer system simulations, whatever else it wants (can do maneuvering thrusters, gravity/magnetic sensors, antennas & serial data transmission, atmospheric sensors, etc. Any other models on request). It runs permanently, and can exchange data with ground over the radio transmission simulation (ground OR other vessels).

Radio transmission model COULD be upgraded with a more complex one later... though LOS check is most practical and fast - I want my CPU time even if a lot of data would be transmitted.

What's ready: radio transmission (line of sight propagation model - no transmission/receive power yet, so signal can travel any distance without loss as long as its LOS), which I've tested in the first orbital VSFL flight. The protocol has some temporary placeholder stuff in it which doubles the traffic used, but that'll be gone by the time it goes publicly usable. It's syncing positions, but no permanency yet, though that's one of the next features to come (and permanency means on-orbit docking).

This map shows all the VSFL communication stations available at the moment (they can receive and most of them can also transmit data):
gr6zN.png


The red dot is based on telemetry received from spacecraft, the number near station circle is the signal strength in some units. 100% is line of sight, 80% is adequate, less than 70% is so noisy it's almost non-existant.

This flight was only partially crossing through comm station range. This is the spacecraft location as decoded from telemetry downlink - noisy areas correspond to bad comm/decoding errors (my error checking was inadequate):
XvddQ.png


The on-board system just encoded the telemetry, sent it at 9200 bps at 76 MHz. The comm stations received it, decoded, and fed to the tracking web page ( http://vsfl.wireos.com/realtime-tracking which is dead right now, since no flight is going on at the moment).


My main request to orbiter community stays the same as the last time - it would be nice if someone wanted to help me with GUI, so the plugin could be configurable and all. This isn't so critical though (it can be well configured through an ugh.. text file...).

And also interested in VSA's - but that's something for a different thread. I will bring VSFL Network up at the forums somewhere in April - that's when I expect to have something useable by others (at least partially), incl. permanency features and full downlink/uplinking.

Also interested in co-developers for the telemetry relay system, because ground coverage does kind of suck, and it WILL keep sucking.


P.S. The other stuff I'm silent about are:
  • Much better multithreaded heat conductivity model (for hull and TPS)
  • Better heating model that now covers all practical speed&altitude ranges
  • Reentry plasma visual effect... http://i.imgur.com/wKsC2.png
  • Nicer smoke effects that replace X-Plane one, and some extra improvements in rendering
These are in X-Space 8, which will be released soon... though that's something only for X-Plane at the moment sadly, wish I could draw custom stuff in Orbiter
 
Last edited:
I think this is great. I have am a big fan of orbiter multiplayer and Face's OMP. I would like to try this out
 
Back
Top