Outerra forum

User mods, screenshots & videos => Plugins / Add-ons => Topic started by: planetsim on May 28, 2014, 02:17:55 pm

Title: Integrating with another sim
Post by: planetsim on May 28, 2014, 02:17:55 pm
Hi,

I am currently building a D3D11 based rendering engine for a space flight simulator called Orbiter. http://orbit.medphys.ucl.ac.uk/ (http://orbit.medphys.ucl.ac.uk/)
It supports the simulation of the Solar System. I would love to try and integrate it with Outerra rendering. From what I understand so far, other planets are planned in the future once the engine is fully tested out with Earth.

I was wondering if its currently possible to set the camera position in Outerra through C++ or any other language. If I want to render spacecraft meshes on the top of what Outerra has rendered, is that possible ? What if I want to render a celestial sphere/stars and then make Outerra start its planet rendering ?

I want to try this only for Earth now of course.

Title: Re: Integrating with another sim
Post by: John514 on May 28, 2014, 02:22:43 pm
Could be possible. Lets see what Cameni (one of the devs) thinks about that!
-------------------------------Off topic(kinda)---------------------------------
(BTW since you seem to interested, the launch for the ISS is about an hour from now.
http://www.ustream.tv/nasahdtv (http://www.ustream.tv/nasahdtv))
Title: Re: Integrating with another sim
Post by: PytonPago on May 28, 2014, 04:09:19 pm
Could be possible. Lets see what Cameni (one of the devs) thinks about that!
-------------------------------Off topic(kinda)---------------------------------
(BTW since you seem to interested, the launch for the ISS is about an hour from now.
http://www.ustream.tv/nasahdtv (http://www.ustream.tv/nasahdtv))

 ... wow ... just oppened it for lift-off. That was some timing ! .....
Title: Re: Integrating with another sim
Post by: cameni on June 01, 2014, 06:21:19 am
I was wondering if its currently possible to set the camera position in Outerra through C++ or any other language. If I want to render spacecraft meshes on the top of what Outerra has rendered, is that possible ? What if I want to render a celestial sphere/stars and then make Outerra start its planet rendering ?
It's possible to use the IGC API (http://outerraworld.com/appdata/Anteworld/ot-api.zip) to control the camera externally, but that's mainly for cases when the cockpit is external (not rendered) as well. We could perhaps extend it to include the ability to control also the position & orientation of an imported model the same way.
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 03:00:54 am
Thank you for your reply, Cameni. Yeah so there are 3 things here:
1. Controlling the free camera, which is the mode that Outerra is in when started.
2. Controlling the transformation of imported models.
3. Controlling the camera when 'inside' a cockpit.

It seems that the IGC API already supports 1 so I can start using that.

For 2, one way to do it is to provide a base class called Vessel (or something similar) that implements the basic API for importing meshes and transforming/drawing them in the world frame. Each object of Vessel could have a world transformation matrix that will contain its position and orientation. If an user wants to add extra functionality to a vessel then he can derive from Vessel. During rendering this world matrix * view matrix * perspective projection matrix = final co-ordinates on screen.

For 3, its important to know that we are in 'cockpit mode' and which vessel/vehicle/model inside whose cockpit we are presently located. Once these are known then the mouse can be used to control a cockpit camera which I guess will use a different projection with a different field of view perhaps. It will probably have bounds on the amount it can translate in each direction. If the IGC API can provide functions to activate a cockpit camera and choose the vessel inside which to focus then this can be done pretty easily.

In Orbiter, the rendering engine keeps track of a few things things to ease the process of getting in to cockpit mode and out into the external world again. There is always a 'focus object' and the camera is generally focussed on it when the object is chosen. But it can be moved as far away from this object as we want. If the focussed object is a vessel(as opposed to a planet) and this vessel provides a mesh of the cockpit and a cockpit camera position, then pressing a key will activate the cockpit camera mode and the user will be 'inside'. Pressing another key brings him back out again to the external world with a free roving camera. The cockpit mode is simply the cockpit mesh as it looks like from inside, drawn after the scenery has finished drawing.


Title: Re: Integrating with another sim
Post by: cameni on June 02, 2014, 06:01:05 am
2) is normally done using the normal import process in OT, see the importer board and various vehicle scripts that animate parts of the model. One thing is that you'll have a problem communicating from the dll to vehicle's script. However, vehicle scripts can actually run in dll plugins as well, the Javascript API is generated from C++ API. We just need to define means of defining that given vehicle does not use a script but a dll.

3) is handled inside the script as well.
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 06:54:48 am
ok, I ll check it out. So there is a script in written in Javascript and a C++ dll plugin ?

I guess if I choose to do so, then I can implement everything entirely in C++ also ?
Title: Re: Integrating with another sim
Post by: cameni on June 02, 2014, 07:16:18 am
IGC API is both C++ and JS, though it probably doesn't make much sense to use via JS.
Common vehicle scripts are written in JS, but they can be also written in C++, though that part isn't accessible yet in the demo.
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 07:45:09 am
Thanks for the reply.

Is it possible to render anything myself in OpenGL in C++ before the OT planet rendering begins ? Say I want to draw stars or a celestial reference grid(when the camera is in space) before planet rendering begins. Is it possible to register a callback to get a 'call' before OT rendering ?
Title: Re: Integrating with another sim
Post by: cameni on June 02, 2014, 07:53:50 am
No. Renderer thread is separate from the application thread, so it's not possible (without some special support). There will be a 2D/3D drawing API for these things.
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 07:57:37 am
Ah ok and this API will record the 2D/3D drawing calls from the application thread and queue them for drawing on the rendering thread I guess :)
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 12:05:26 pm
Running into an error while compiling the plugin project. Upgraded to Visual Studio 13 when opening :

http://s28.postimg.org/tjy85rmul/error.png (http://s28.postimg.org/tjy85rmul/error.png)
Title: Re: Integrating with another sim
Post by: cameni on June 02, 2014, 02:04:51 pm
Please remove the comm_static project from the solution, and add one from include\comm\_build\msvc\2013\ there instead.
Title: Re: Integrating with another sim
Post by: planetsim on June 02, 2014, 10:59:48 pm
Ok, did that. Getting some linking errors now :

Error   2   error LNK2019: unresolved external symbol "protected: struct coid::thread __thiscall coid::thread_manager::thread_start(struct coid::thread_manager::info *)" (?thread_start@thread_manager@coid@@IAE?AUthread@2@PAUinfo@12@@Z) referenced in function "public: struct coid::thread __thiscall coid::thread_manager::thread_create(void *,void * (__cdecl*)(void *),void *,struct coid::token const &)" (?thread_create@thread_manager@coid@@QAE?AUthread@2@PAXP6APAX0@Z0ABUtoken@2@@Z)   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\comm_staticd.lib(pthreadx.obj)   igc_plugin

Error   3   error LNK1120: 2 unresolved externals   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\Debug\igc_plugin.dll   1   1   igc_plugin

Error   1   error LNK2019: unresolved external symbol "public: static void * __cdecl coid::interface_register::get_interface_creator(struct coid::token const &)" (?get_interface_creator@interface_register@coid@@SAPAXABUtoken@2@@Z) referenced in function "public: static class iref<class igc_plugin> __cdecl ot::igc::get<class igc_plugin>(class igc_plugin *)" (??$get@Vigc_plugin@@@igc@ot@@SA?AV?$iref@Vigc_plugin@@@@PAVigc_plugin@@@Z)   F:\Code\Orbiter\Outerra\ot-api\ot-api\example\igc_plugin\igc_plugin.obj   igc_plugin
Title: Re: Integrating with another sim
Post by: cameni on June 03, 2014, 02:27:32 am
I've updated the example (http://outerraworld.com/appdata/Anteworld/ot-api.zip) to build with VS2013.
Title: Re: Integrating with another sim
Post by: planetsim on June 03, 2014, 01:03:32 pm
Thanks it compiles now. I guess I should drop igc_plugin.dll into the OT root directory(where outerra.exe is). Is there someway to tell that this plugin is loaded and working from within OT ?
Title: Re: Integrating with another sim
Post by: cameni on June 03, 2014, 01:16:49 pm
No, it has to be put into "plugins" folder in the install dir. You will see a message in the eng.log that it has been loaded. Note that the dll name must end with plugin.dll, e.g planetsim-plugin.dll
Title: Re: Integrating with another sim
Post by: John514 on June 03, 2014, 01:19:37 pm
What does this do, exactly?
Title: Re: Integrating with another sim
Post by: cameni on June 03, 2014, 01:45:06 pm
It's a way to use OT as an image generator, by controlling the camera position and orientation from an external source via a plugin. People who have their own physics simulator (or are using another simulation program) can have OT rendering the world for them.
Title: Re: Integrating with another sim
Post by: John514 on June 03, 2014, 01:46:01 pm
Hm.....That would be a big hit with FSX users......
Title: Re: Integrating with another sim
Post by: Steve.Wilson on June 03, 2014, 08:25:57 pm
Remembering that Outerra doesn't have a world populated by cities and roads and other aircraft.  I've had similar thoughts for X-Plane, but the main problem is the visible terrain matching the terrain in the physics simulator.  One or the other must rule, otherwise the aircraft could fly through the terrain at points, or be smashed by "terrain" that is not visible.  Then too, when you're on a runway or on the ground using some sort of bush field, then both simulation engines must be in perfect terrain height agreement.
Title: Re: Integrating with another sim
Post by: planetsim on June 03, 2014, 11:38:15 pm
I am guessing the field of view of the camera can be adjusted to match that. For example in Orbiter, I need to get the FoV from the sim and set it on the OT camera.

Setting the FoV would affect the view frustum and frustum culling.
Title: Re: Integrating with another sim
Post by: Steve.Wilson on June 04, 2014, 10:45:41 am
It's not a view problem, it's a terrain/vehicle interaction problem.  Orbiter would only have this problem should the simulated spacecraft have need to land on a planet. 

I think the problem would likely be solved by having Outerra collision detection just as available to the driving simulation as the Outerra view system.  In X-Plane, terrain collision detection can be turned off by setting the sim/operation/override/override_groundplane dataref to 1.  Then, whatever code that is used to mesh the two simulations would be responsible for collisions/crashes, landing gear interaction, etc.
Title: Re: Integrating with another sim
Post by: John514 on June 04, 2014, 01:18:28 pm
Well, we can always choose the Outerra collision (since it has a better elevation dataset) to be used instead of the said game collision. Af course, the missiong runways/airports would be a problem! :P

In terms of the current flight simulators, its just not worthy to create such application.
Title: Re: Integrating with another sim
Post by: planetsim on June 04, 2014, 10:26:43 pm
How about a combined approach. When the plane is close to the ground then we can let OT have control of the plane, let it do its collision checking and set the plane's position and orientation.

When its in the air and no longer colliding(as reported by OT) then XPlane has control over the plane's position and orientation.

That raises the following questions :
1. When the plane collides with the ground then OT's PhysX(or Bullet whichever is used) engine will report a collision and probably a resulting transformation matrix for the plane giving its new position and orientation. If this puts the plane back in the air then the matrix has to be used to transform the plane accurately in the XPlane sim as well as sets its velocity/acceleration. Then XPlane can take control again.

2. If the plane lands back on the ground then OT takes over again. As long as the plane is on the ground, OT has control so the plane is like a ghost object in XPlane controlled by external transforms.

3. Not sure yet how to ensure that a plane thats landed in XPlane is also landed in OT. Probably some sort of heightmap matching is needed there. We can either set up a custom height map in Xplane that matches the one in OT. Or retrieve the terrain height from OT and set it in XPlane at runtime.
Title: Re: Integrating with another sim
Post by: Steve.Wilson on June 04, 2014, 11:47:23 pm
A seamless transition that accommodated all possible scenarios would be a challenge.

What is a collision system, anyway, but a means of detecting the proximity of certain xyz coordinates on the vehicle to the local terrain, be it meadow, street or runway? 

Outerra has to always own the geometry of the aircraft/spacecraft, and thus, Outerra will be able to report to the driving simulation, be it X-Plane or Orbiter, whether or not a crash collision has occurred, or if a non-crash interaction between landing gear and the terrain has occurred.

A crash condition is easy to resolve with whatever the normal reaction might be to the destruction of the vehicle.

On the other hand, the most complex collision analysis would happen as the vehicle's landing gear transitioned from unloaded to fully loaded.  I think that's where the greatest challenge lays.  X-Plane knows where the landing gear is on a given aircraft relative to the aircraft, but Outerra would know where the landing gear was in relation to the terrain. 

I think that's the key transition to accommodate.  X-Plane would report deflection of the landing gear depending on load, resulting in an ever changing report to Outerra where the landing gear was.  It would be a challenging feedback loop to code.

Ultimately, I think that the smartest solution would be to use the Outerra terrain database to generate an extremely simple terrain mesh in X-Plane, in other words one without land class data, etc., that was identical to the Outerra terrain mesh, and both kept in perfect synchronization to double precision.  That way X-Plane handles all terrain collisions and the interaction code is kept as simple as possible.

How to accomplish the terrain transfer?  A good question.  There are tools available for users to generate their own X-Plane terrain meshes.   I guess the question to ask for this solution is how to prepare the Outerra terrain input to satisfy the X-Plane tools?
Title: Re: Integrating with another sim
Post by: planetsim on June 05, 2014, 06:26:50 am
Is the terrain heightmap known to double precision levels by OT before it starts running ? Or can it change during runtime due to 'fractalization' ? If it does change at runtime then can we query it from OT and inject a new heightmap patch into the XPlane sim - at runtime ?

I think the actual heights at any region are only known at runtime by OT and varies much more than the base heightmap which serves only as a low resolution 'guide' for the lay of the terrain.

So some kind of runtime injection of heightmap has to be done into any sim that OT is used with.
Title: Re: Integrating with another sim
Post by: cameni on June 05, 2014, 06:54:12 am
That's a bit oddly phrased question, but I know what you mean.
Heights are deterministic, they cannot change during run time. Once a discrete position gets its height computed, it's set. However, there's a catch - finer mesh representations bring extra detail in between the height samples. It matters when you ask about the height of the terrain at some point in between the known samples - with coarser mesh levels you get an interpolated answer, since they simply do not know anything about stuff in between the discrete samples. Finer meshes will give you finer results.

Still, deterministic doesn't mean that the heightmap is "known" before running OT. Purely theoretically, one could compute the exact refined sample height just using the basic (~75m) OT dataset + road/vector modification. In practice it would be insanely inefficient to do it per request.

JSBSim integration works by providing height callbacks for gear and wingtips. They then compute suspension forces that are applied to the physics body, and integrated with the rest of the computed/simulated forces. Any simulator can be connected that way, as long as it can handle such external callbacks.

The best is if the simulator can work by generating forces that are integrated back in OT, instead of setting the position/orientation directly. That way those externally simulated objects can interact with other objects in the OT world.
Title: Re: Integrating with another sim
Post by: Steve.Wilson on June 05, 2014, 01:56:15 pm
I'm still digesting the last two posts, but that's an extraordinary bit of data.  My mesh idea clearly wouldn't work since the OT "mesh" is refined dynamically during runtime.  The JSBSim landing gear positional data would clearly match up with the positional datarefs in X-Plane, using that example.  So it seems to me, on the surface, that perhaps the synchronization would be more between JSBSim and X-Plane, rather than between OT and X-Plane.
Title: Re: Integrating with another sim
Post by: planetsim on June 06, 2014, 03:09:53 am
Integration of the forces may work. But then we would not be actually using the XPlane or Orbiter engine. Those engines' jobs are to calculate the resulting displacement from the applied forces too. So lets say I do supply the forces to OT after taking them Orbiter, then OT may calculate a displacement of 5m on the runway for a plane, while the Orbiter sim may calculate 2m.

At that point a resync of the OT internal sim and the Orbiter external sim would be needed.
Title: Re: Integrating with another sim
Post by: cameni on June 06, 2014, 04:04:28 am
JSBSim can be made to work that way, DCS works that way, and I guess others can be too. Those engines compute all the forces that affect the object, various aerodynamic ones and from the propeller etc, not just the applied ones. At the heart of simulator is an integrator, that takes the force impulses and integrates the speeds and positions. One could usually separate the integrator from the rest. This allows to have many simulation cores using one common integrator, while still being able to interact with other objects (running other cores) because contact forces are handled by the universal core.

There can be small differences in the used integrator algorithms, and for some simulators the one used in OT can be unsuitable in the eyes of their users, but in that case we'd at least need a way to send contact points or forces back to those simulators.
Title: Re: Integrating with another sim
Post by: planetsim on June 06, 2014, 01:08:53 pm
Thanks for detailed reply.

Yes I agree Orbiter should be able to integrate with OT by providing the required forces. All the forces on an object can be got from Orbiter and the vectors given to OT. OT can then integrate them.

My question is, doesnt JSBSim or DCS also maintain the position/velocity of the object at this time ? Or as you said, do they just calculate the forces based on the aircraft engine type or propellor blade design and give it to OT. Are their integrators disabled at this time ?

I guess for Orbiter I could create some sort of situation for a vessel where its held in one place in space as far as Orbiter's internal position/orientation is concerned. Yet the vessel will be able to fire its thrusters or retro jets as needed. So it would not move at all in Orbiter as it would be somehow 'locked down'

But since all the forces that the vessel  is generating would be given to OT, which would then integrate it, the vessel will move in OT, in the direction of the resultant force.

---------

But hmm, I guess I may actually need to move the vessel in Orbiter too because some of the forces on the vessel depends on its location. Especially when the vessel is close to orbital velocity.  If it ends up in space then there is the tug between gravity and centrifugal forces. So I ll need to set the current position/orientation, translational velocity/rotational velocity  of the vessel in OT back in Orbiter too. Guess there is no skipping the feedback loop.

Title: Re: Integrating with another sim
Post by: cameni on June 09, 2014, 01:24:26 am
My question is, doesnt JSBSim or DCS also maintain the position/velocity of the object at this time ? Or as you said, do they just calculate the forces based on the aircraft engine type or propellor blade design and give it to OT. Are their integrators disabled at this time ?
I just described how they can work with their addon aircraft. Since they are integrating the forces themselves, this is what they expect from any addons - a collection of forces to integrate each frame.

These simulators usually do not expect to be a provider of the simulated forces for another simulator, so connecting them to OT is usually much simpler by providing positions and speeds instead. You will lose the interactivity though. Ultimately I expect that someone will implement physics plugin into OT that will work at the force level, and will allow vehicles to use that physics module using its higher level API.

Title: Re: Integrating with another sim
Post by: planetsim on June 09, 2014, 10:44:35 am
Ok, I understand. I am thinking of starting out a bit simpler with the Railway Vehicles, so I can get a bit familiar with how custom physics can be implemented from a plugin for vehicles: http://forum.outerra.com/index.php?topic=2720.0 (http://forum.outerra.com/index.php?topic=2720.0)

To that end, is it possible to add physics models to the main bullet physics world in OT. How do I retrieve this world ? Is there an API for this ? Also is it possible to do some debug drawing of the physics rigid bodies like the bullet debug drawer does ? Like local co-ordinate systems and the outline of btCollisionShapes etc ?
Title: Re: Integrating with another sim
Post by: HiFlyer on June 13, 2014, 01:04:17 am
So....... Whatever happened to this topic?
Title: Re: Integrating with another sim
Post by: planetsim on June 18, 2014, 09:41:12 am
I am able to use the plugin now to set the camera position as I want and vary it at runtime.  I noticed that the plugin sets an absolute position in the global frame to

double3 startPos = double3(-2286686.1965365410 + vary,-3734648.0835802061,4638811.4431277402);

How were these co-ordinates arrived at ? What is the origin and orientation of this frame ? Is the planetary center the origin ?

How do I convert a point on the surface of the earth, specified in terms of the (long, lat, alt) into this global frame of (x, y, z) ? When I want to setup something somewhere specific then all I have is the long, lat from google maps.
Edit: Ok I got it from the Saved Locations > Lat/Lon/Alt tab, but this does not give me the numbers in global frame (x,y,z), that I can pass to igc::setPos().
Title: Re: Integrating with another sim
Post by: cameni on June 18, 2014, 10:45:17 am
It's the ECEF (http://en.wikipedia.org/wiki/ECEF) frame.
I guess we should add the geographic<->ECEF conversions there too.
Title: Re: Integrating with another sim
Post by: planetsim on June 18, 2014, 10:56:49 am
That would be useful !

2 overloads please :), for conversion, one that accepts the lat, long in degrees and another in decimals : https://support.google.com/maps/answer/18539?hl=en
Title: Re: Integrating with another sim
Post by: cameni on June 18, 2014, 11:42:37 am
The latter is already in comm/token.h, toangle() method:

///Convert angle string to value, consuming input
/// formats: 49°42'32.91"N, +49°42.5485', +49.7091416667°
double toangle();

usage:
coid::token tok("49°42'32.91\"N");
double lat = tok.toangle();
Title: Re: Integrating with another sim
Post by: galayko on March 22, 2015, 02:54:29 pm
Ok, i've downloaded OT-API for VS2013.
Compiled successfully, put it into the plugins dir, but while loading Outerra says:

INFO: starting io_man...
DEBUG: program directory: C:\Program Files (x86)\Outerra\Anteworld\
INFO: Outerra 0.8.4, build 5244 from Wed, 18 Feb 2015 21:18:04 GMT
DEBUG: Nvidia driver profile "Outerra" found...
DEBUG: Initializing engine...
DEBUG: data root directory: C:\Users\NiKe\Outerra\
DEBUG: Windows version: 6.2.9200
...
DEBUG: (c4e) baad upd rect: 0,0 17,17
DEBUG: loading plugin: igc_plugin.dll
DEBUG: removing window from zorder list "logger"
DEBUG: windows z-order:
    fading_logger visible  disabled  type=16
    fading_message disabled  type=16
    logo_widget visible  disabled  type=16
    login_window type=64
    www/lib/desktop/desktop-manager.html visible  type=16
    logger visible  disabled  type=32

ERROR: failed to load plugins/igc_plugin.dll
DEBUG: Buffer created (1569) 'smoke' size 3KB
...

Tried x86, x64, Debug, Release. No way.
Using Visual Studio 2013 12.0.31101.00 Update 4 on Windows 8.1.

Please, tell what am i doing wrong?
Title: Re: Integrating with another sim
Post by: cameni on March 22, 2015, 03:16:43 pm
It looks that the API is outdated and wont work with the current version. We'll update it with the next patch.
Title: Re: Integrating with another sim
Post by: galayko on March 22, 2015, 03:32:12 pm
Is it possible to roll back to an older version, that supports currently available OT-API?
Title: Re: Integrating with another sim
Post by: langdon on October 24, 2015, 01:52:35 am
Hi,
Is the OT-API working in the current version?
I've compiled igc-plugn.dll but fails to load.

Thanks.
Title: Re: Integrating with another sim
Post by: cameni on October 24, 2015, 01:17:55 pm
I have updated the api files for the new version.
Title: Re: Integrating with another sim
Post by: langdon on October 25, 2015, 08:59:18 pm
Thanks,
Works well now.
Title: Re: Integrating with another sim
Post by: langdon on October 29, 2015, 08:58:39 am
Hi again,
I've actually got a plugin now that takes FSX / P3D output (via fsuipc) and drives the Outerra engine via the OT_API.... almost.

Everything is almost ok around the equator but I've got some kind of weird problem with pitch being wrong the further I move away from the equator..either North or South.
I don't think it's my code creating the issue because even if I hard code ECEF values as per the example igc_plugin.dll and rotate the heading from 0 to 2PI (0-360 degs) it seems like its not rotating around a 'normal' to the planet surface. Am I missing something? Do I need to compensate in my code for this change in position?

Code:
void llaToWorld(double lat, double lon, double alt)
{
   double rad = 6378137; // radius
   
      lat = lat * (M_PI / 180.0);
      lon = lon * (M_PI / 180.0);

      double f = 0.0; //flattening
      double ls = atan(pow((1.0 - f), 2) * tan(lat));    // lambda

      double x = rad * cos(ls) * cos(lon) + alt * cos(lat) * cos(lon);
      double y = rad * cos(ls) * sin(lon) + alt * cos(lat) * sin(lon);
      double z = rad * sin(ls) + alt * sin(lat);

         ecef[0] = x;
         ecef[1] = y;
         ecef[2] = z;
   
}

then later:

startPos = double3(ecef[0], ecef[1], ecef[2] );

double dtr = M_PI / 180.0;

quat startRot = set_heading_pitch_roll(startPos, float3((playerHeading*dtr), (dtr*playerPitch), (dtr*playerBank)));

this->set_pos(startPos, startRot);


this shows the effect:
startPos = double3(-2286686.1965365410,-3734648.0835802061,4638811.4431277402);
quat startRot = set_heading_pitch_roll(startPos, float3(0, 0, 0));

this->set_pos(startPos, startRot);      


Any clues or even a link to a clue would be really appreciated.

Thanks,
Langdon
Title: Re: Integrating with another sim
Post by: cameni on October 29, 2015, 03:02:21 pm
Function set_heading_pitch_roll was extracted to the example a long time ago, not sure what state it's in. There are quat_from_hpr and hpr_from_quat methods in <ot/glm/glm_ext.h> that you could use instead. These require the correct up vector for given ECEF  position, which is simply a normalization of the position.

  quat rot = glm::quat_from_hpr(float3(glm::normalize(pos)), hpr);

You need to compute a new rotation quaternion when the position changes.
Title: Re: Integrating with another sim
Post by: langdon on October 29, 2015, 11:56:32 pm
Thanks dude... works great now.

quat rot = glm::quat_from_hpr(float3(glm::normalize(startPos)), float3((playerHeading*dtr), (dtr*playerPitch), (dtr * -playerBank)), true);

this->set_pos(startPos, rot);

Now I fire up FSX/P3D and Outerra and I can use Outerra graphics in my simpit.
It's 'rough as guts' (Australian expression) but if anyone wants to see it work just drop the dll in the plugins folder.
get the dll here:
http://www.siliconroad.com.au/fsx_plugin.zip

Something weird I noticed is that sometimes, when alt-tabbing between Outerra and FSX my joystick disconnects. The work around is just pull it out of its current usb slot and plug it in another.


Any chance of a bulk importer of objects and/or roads in the near future ?
I know the FSX and Outerra terrain meshes don't exactly align (pretty damn close in a lot of places I've tried though. Happily surprised) but if I could import all the worlds runways (db's are freely available), it'd be a great starting point.

'If you build it, they will come' ... but I imagine you guys have already witnessed that!

Love your work..It's a great future.

Now I'll load up an ultralight, put on my DK2 and enjoy a lovely sunset flight.

Thanks guys!

Langdon
Title: Re: Integrating with another sim
Post by: cameni on October 30, 2015, 01:58:13 am
Great job.

Any chance of a bulk importer of objects and/or roads in the near future ?
I know the FSX and Outerra terrain meshes don't exactly align (pretty damn close in a lot of places I've tried though. Happily surprised) but if I could import all the worlds runways (db's are freely available), it'd be a great starting point.

Both are being worked on. We are fixing the global OSM road import and adding possibility to add object placement during the import.
We also want to import the runways from a better source than OSM, what dbs are you referring to?
Title: Re: Integrating with another sim
Post by: Acetone on October 30, 2015, 04:46:30 am
Really nice langdon :)

I don't have FSX around so just a question : your plugin is extracting FSX plane position/orientation right? You don't have the entire plane/animations/systems visible in OT?
If you have the possibility to do it, a video would be really nice :)
Title: Re: Integrating with another sim
Post by: langdon on October 30, 2015, 05:28:32 am
@cameni 
The site for the data I was referring to was:
http://ourairports.com/data/

But if it was just me and because I own a copy of fsx/p3d I would just use a program called MakeRunways and extract all of the runway info etc. out of FSX/P3d

I've done that and you are welcome to download a copy of the program (its free. comes with the FSUIPC sdk) and the data I extracted from my copy of P3D v3. The data would be copyrighted but I don't see the harm in using it if I own a copy of P3D. Lots of other FSX/P3D addon developers make use of it this way (eg. Radar Contact)

Its here: http://www.siliconroad.com.au/makerunways_with_data.zip 

Lots of good data in there. Particularly the xml.

@acetone
Not sure if you know FSX well but there's an addon called FSUIPC that extracts data from FSX/P3D. It comes with an sdk that basically allows me to work with it.
You're right, I don't have all the aircraft animations etc visible in OT. What I do have is all the cockpit systems working on one monitor and the outside world (OT) showing across 3 others. The beauty of FSUIPC is that it connects with WideFS which in actual fact allows me to run my 'cockpit visuals' on one pc (a really low end pc) and then via a network have OT showing outside visuals on a completely different pc (high end, good gfx card etc).

There's a lot of conversation about having the meshes between FSX and OT sync'd but in reality, you're not supposed to get that close to the terrain anyway unless you're near a runway.

I'll try and make a video of what I've achieved but its really less than 50 lines of code :)

Langdon
Title: Re: Integrating with another sim
Post by: langdon on October 30, 2015, 05:33:03 am
@acetone

I  just checked out your scenery mods... holy crap! That's some seriously awesome work! You've really the scenery guru.

L
Title: Re: Integrating with another sim
Post by: Acetone on October 30, 2015, 06:27:14 am
@acetone
Not sure if you know FSX well but there's an addon called FSUIPC that extracts data from FSX/P3D. It comes with an sdk that basically allows me to work with it.
You're right, I don't have all the aircraft animations etc visible in OT. What I do have is all the cockpit systems working on one monitor and the outside world (OT) showing across 3 others. The beauty of FSUIPC is that it connects with WideFS which in actual fact allows me to run my 'cockpit visuals' on one pc (a really low end pc) and then via a network have OT showing outside visuals on a completely different pc (high end, good gfx card etc).

There's a lot of conversation about having the meshes between FSX and OT sync'd but in reality, you're not supposed to get that close to the terrain anyway unless you're near a runway.

I'll try and make a video of what I've achieved but its really less than 50 lines of code :)

Langdon
@acetone

I  just checked out your scenery mods... holy crap! That's some seriously awesome work! You've really the scenery guru.

L

Thanks ! It's really interesting. About the scenery, these are made with Gmap so in theory locations and airports are accurate, but I wonder if you could land a FSX plane in one of these airports, that could be an interesting test to see it's possible to have landings sync too. In general, the runways orientation is not perfect in my sceneries (sometimes 1° of difference) but the biggest problem could be the elevation.
I guess that the only option to have these working perfectly fine would be to use the same database for airports in both FSX/P3D and OT, but right now only hand made content is possible.
Title: Re: Integrating with another sim
Post by: John514 on October 30, 2015, 06:48:54 am
But the runways have to be projected on OT terrain, rather than being made with absolute elevations from the runway data, because that would make them cut and raise terrain to extreme levels, or even make them just spawn in a pit in the ground!
Title: Re: Integrating with another sim
Post by: langdon on October 30, 2015, 08:33:15 am
This is interesting...
isn't it from the same NASA data that you guys at Outerra use?

http://www.avsim.com/topic/467959-freemesh-x-freeware-worldwide-mesh-upgrade-p3dfsx/
Title: Re: Integrating with another sim
Post by: dbb on October 30, 2015, 10:03:47 am
We also want to import the runways from a better source than OSM, what dbs are you referring to?
At least in the US the FAA publishes this data freely. From here (http://www.faa.gov/airports/airport_safety/airportdata_5010/) if you do a search for all regions, all districts, etc. You'll be taken to a page with "Data Downloads" which will provide airport and runway data in CSV formatted files. All the necessary data should be there to properly place runways. The National Flight Data Center (https://nfdc.faa.gov/xwiki/bin/view/NFDC/WebHome) may contain other useful information, especially under NASR (https://nfdc.faa.gov/xwiki/bin/view/NFDC/56+Day+NASR+Subscription). Internationally, it's probably possible to get access to the AIRAC (https://en.wikipedia.org/wiki/Aeronautical_Information_Publication) data that's used for flight management systems and whatnot.

There's also the X-Plane Scenery Gateway (http://gateway.x-plane.com/) for user submitted airport sceneries. The data is obviously in a format to be used by X-Plane, but the data itself is licensed under the GPLv2 (http://gateway.x-plane.com/docs/TermsAndConditionsForUploadOfAirportScenery.pdf).
Title: Re: Integrating with another sim
Post by: langdon on October 31, 2015, 03:20:20 am
Quick question...
Is there a way to get the current ECEF (or LLA) position out of Outerra via the IGC interface?

eg.. is there a get_pos(double3); ?

Thanks.
Title: Re: Integrating with another sim
Post by: cameni on October 31, 2015, 01:45:09 pm
It's there as pos() method. Header igc.h contains all methods available to IGC, documented.

Code: [Select]
    ///Set camera position
    //@param ecef position in ECEF coordinates
    //@param rot camera rotation into OT view space (-z forward, +y up, +x side)
    void set_pos( const double3& ecef, const quat& rot );

    ///Get current camera position in ECEF
    const double3& pos();

    ///Get current camera rotation in OT view space (-z forward, +y up, +x side)
    const quat& rot();

    ///Get info about current position & speed
    void info( ifc_out ot::igc_data& data );

    ///Test intesection of ray with terrain
    //@return 0 if the ray does not intersect
    //@return 1 if intersects
    //@return 2 if intersects but the starting point is below the terrain
    //@param from starting position of the ray to test
    //@param to ending position of the ray to test, note: keep the ray as short as possible
    //@param pos surface position at the intersecting point
    //@param norm surface normal at the intersection
    //@param dist distance from the starting point to intersection
    int intersect( const double3& from, const double3& to, ifc_out double3& pos, ifc_out float3& norm, ifc_out float& dist );

    ///Set world time for current location
    //@param dyear day of year
    //@param tday solar time of day
    //@param flowm time flow multiplier, 1.0 normal time flow
    void set_time( int64 dyear, double tday, float flowm = 1.0f );
Title: Re: Integrating with another sim
Post by: langdon on November 04, 2015, 05:34:25 am
Thanks,

Any chance at pointing me to some info on how to convert UTC to Solar Time?

And do you guys start counting days from 0 AD or some other date?

Thanks,
L
Title: Re: Integrating with another sim
Post by: cameni on November 04, 2015, 06:43:56 am
Solar time has 12AM with sun at zenith, so you basically need to subtract msec_per_day * radians(longitude) from UTC time (in msec).

I think at the moment we are counting days from the beginning of current year, but it will likely change the whole thing to UTC soon.
Title: Re: Integrating with another sim
Post by: langdon on November 05, 2015, 05:30:43 am
Thanks cameni,

It seems this works:
tday = ((playerUTCHour * 60 * 60 * 1000) + (playerUTCMinute * 60 * 1000) + (playerUTCSecond * 1000));
this->set_time(playerDayNumber-1, tday);

the 'player' variables are being extracted from fsx. So maybe I was over thinking it trying to work with solar time.

@acetone.
Your LHNA didn't line up with FSX out of the box but I downloaded some alps scenery for fsx/p3d that had been corrected and it lines up perfectly! WWhat a pleasure.

Talkeetna was close.. the centerline was ok but the piano keys were in the 'fsx' grass. About 2m lower than the fsx runway. Bald Mtn was a blast but about 9m difference in altitude.
I'm thinking I might just butcher the fsx bgl files to match your OT files :)

Assuming its possible, I'm going to invest a little time making some runway lights. Outerra just kills at sunrise/sunset but I really need lighting on the runways.

If you're looking for a new scenery project any time...Innsbruck would be beautiful!
I had a go at doing St Barts but for the life of me, I couldn't get the runway at the correct elevation and flat. It just seemed to lay along the terrain. But I'll keep trying.
Title: Re: Integrating with another sim
Post by: cameni on November 05, 2015, 07:33:13 am
It seems this works:
tday = ((playerUTCHour * 60 * 60 * 1000) + (playerUTCMinute * 60 * 1000) + (playerUTCSecond * 1000));
this->set_time(playerDayNumber-1, tday);

the 'player' variables are being extracted from fsx. So maybe I was over thinking it trying to work with solar time.

It should work when you are close to the prime meridian, but will drift away with increasing longitude.
Title: Re: Integrating with another sim
Post by: HiFlyer on November 05, 2015, 08:59:40 am
Thanks cameni,

It seems this works:
tday = ((playerUTCHour * 60 * 60 * 1000) + (playerUTCMinute * 60 * 1000) + (playerUTCSecond * 1000));
this->set_time(playerDayNumber-1, tday);

the 'player' variables are being extracted from fsx. So maybe I was over thinking it trying to work with solar time.

@acetone.
Your LHNA didn't line up with FSX out of the box but I downloaded some alps scenery for fsx/p3d that had been corrected and it lines up perfectly! WWhat a pleasure.

Talkeetna was close.. the centerline was ok but the piano keys were in the 'fsx' grass. About 2m lower than the fsx runway. Bald Mtn was a blast but about 9m difference in altitude.
I'm thinking I might just butcher the fsx bgl files to match your OT files :)

Assuming its possible, I'm going to invest a little time making some runway lights. Outerra just kills at sunrise/sunset but I really need lighting on the runways.

If you're looking for a new scenery project any time...Innsbruck would be beautiful!
I had a go at doing St Barts but for the life of me, I couldn't get the runway at the correct elevation and flat. It just seemed to lay along the terrain. But I'll keep trying.

If Outerra integrates a worldwide airport database with height data at some point, I suspect (hope) runways and etc will line up a lot more nicely with FSX. That would be very very cool!
Title: Re: Integrating with another sim
Post by: langdon on November 05, 2015, 11:07:55 am
Am I right in assuming the 'lights' system is currently broken?

It seems the only models with working lights are those that come with Anteworld. None of the user contributions seem to have working lights.

Title: Re: Integrating with another sim
Post by: Acetone on November 05, 2015, 11:41:06 am
Am I right in assuming the 'lights' system is currently broken?

It seems the only models with working lights are those that come with Anteworld. None of the user contributions seem to have working lights.

Right now it's not possible to make working lights with static models, only with vehicles. I think Uriah managed to make some kind of active runways lights, but you had to enter these as if it was a vehicle to make them work. Same thing with animated models, Levi's Wind turbine (http://www.outerramods.com/mods/wind-turbine-animated) is activated when you enter it.

A function to toggle animations/lights at some set distance of the camera was planned for static models.
Title: Re: Integrating with another sim
Post by: HiFlyer on November 05, 2015, 11:42:54 am
Am I right in assuming the 'lights' system is currently broken?

It seems the only models with working lights are those that come with Anteworld. None of the user contributions seem to have working lights.

The F-117 and the Ilyushin Il-14P have lights, as well as a few ground vehicles. Uriah showed working runway lights quite some time ago, but I think the current lighting is a bit hard on frames. (not sure why)

I think we're all waiting for Outerras equivalent of illuminated textures. The Cessna did have some a long time ago, but current versions of Outerra do not.

EDIT: Looks like Acetone and I cross-posted.  =D
Title: Re: Integrating with another sim
Post by: thx_nb on November 05, 2015, 02:41:38 pm
Quite a few user-contributed models have not been adapted to match new methods names for adding lights, after a recent change in Outerra. Some have, like HiFlyer mentioned.
There are also a lot of user-vehicles that are not or don't seem to be actively maintained by their original creators / importers, and which have not been changed since lights where added.

It should be a relatively simple change, if you are a bit familiar with Javascript.
Title: Re: Integrating with another sim
Post by: HiFlyer on November 05, 2015, 08:17:39 pm
I can't wait till you do a video.  :))
Title: Re: Integrating with another sim
Post by: Rudeboy1988 on November 06, 2015, 02:53:58 am
Just a little test
https://www.youtube.com/watch?v=onWl6FLzMwc
Title: Re: Integrating with another sim
Post by: langdon on November 06, 2015, 03:27:38 am
Sweet Rudeboy !

You beat me too it (-:
Title: Re: Integrating with another sim
Post by: HiFlyer on November 06, 2015, 09:10:54 am
Very nice.  =D

I wonder if the ultimate test of something like this is having different computers driving each sim.
Title: Re: Integrating with another sim
Post by: langdon on November 06, 2015, 08:58:46 pm
I think Rudeboy's video is better, especially as a comparison.

This one's more so Acetone can see his scenery at work.
I guess Cameni see's this kinda stuff all the time. Nice engine guys.

Video: https://youtu.be/IFJ9P-3ijdU

Don't know what happened with the sound and the jerkiness is due to the screen capture software.

Crap flying is all on me (-:
Title: Re: Integrating with another sim
Post by: langdon on November 06, 2015, 10:44:35 pm
Runway Lights...
Not Recommended.
I made a vehicle with multiple lights and 'parked' it on the piano keys.
Absolutely killed the frame rate.
I really need to figure  out this screen recorder too. Sorry for the blue lines.

Big pause halfway when I change  to complete darkness in the FSX feeder.


https://youtu.be/dvTFBMtE8eI
Title: Re: Integrating with another sim
Post by: langdon on November 06, 2015, 10:49:46 pm
One more...

I should have used the built in video recorder but I forgot (-:
The one I used seems to have sped up the video a little.

These lights are only visible from about 5km out.

https://youtu.be/RpZFhxeqr1Y
Title: Re: Integrating with another sim
Post by: langdon on November 06, 2015, 10:59:48 pm
Cameni,

I've got a vehicle here and I'm modding the javascript to try and pick up it's position from an external server (via ajax).
I also tried to just read a local text file but the script seems to fail at:

var rawFile = new XMLHttpRequest();

Am I asking too much of the scripting engine at this point?
Should I wait for a few more updates? (-:

Thanks,
L

Title: Re: Integrating with another sim
Post by: Acetone on November 07, 2015, 03:51:56 am
This one's more so Acetone can see his scenery at work.

Wow, wasn't expecting both runways will match at that level  :o
Really great video !


I made a vehicle with multiple lights and 'parked' it on the piano keys.
Absolutely killed the frame rate.

What kind of light are you using? I can't remember which one, but there should be a perf difference between point lights and spot lights.

Really, really interesting work. I bet some simmers with a home cockpit will be really interested by this tool :)
Title: Re: Integrating with another sim
Post by: langdon on November 07, 2015, 05:17:30 am
I used point lights. I tried with spots but they were kind of strange.

There are probably a million different optimizations and adjustments I could have made but it seemed fairly pointless because attaching the lights to a vehicle wasn't a persistant way of keeping them in the world. I had to reposition them every time I restarted the engine.

I had real pain originally positioning them. I hacked a BMW and tried to 'drive' them into position. That was ok until I realized that the handbrake on the BMW didn't work and when I was in the air the BMW started  rolling down the runway :)

Anyway.. file is attached if you want to play with it... You can edit the first few variables in the script file to adjust for the runway length and width, light intensity etc.
light_z is the distance they are up from the surface.

I'm really looking forward to a permanent solution.

Title: Re: Integrating with another sim
Post by: HiFlyer on November 07, 2015, 05:39:05 am
There is a video of Outerra showing a bajillion lights with little apparent fps impact, but it seems more work is required to have them available for runways and such.  =|

By the way, I've found that with a Nvidia card, Shadowplay can work very well with Outerra for making stutter-free videos that include sound.

https://www.youtube.com/watch?v=_fyTy5UFBmA
Title: Re: Integrating with another sim
Post by: cameni on November 07, 2015, 04:19:40 pm
I've got a vehicle here and I'm modding the javascript to try and pick up it's position from an external server (via ajax).
I also tried to just read a local text file but the script seems to fail at:

var rawFile = new XMLHttpRequest();

Am I asking too much of the scripting engine at this point?
Should I wait for a few more updates? (-:

It's a pure JS, doesn't contain extra stuff from html. It won't be supported in future updates, vehicle scripts are supposed to define only the local vehicle behavior.
Title: Re: Integrating with another sim
Post by: langdon on November 07, 2015, 08:56:07 pm
Ahh..ok.
So I guess the follow up question is...

Is there any way, currently, to inject position data into a vehicle from an external source?
Title: Re: Integrating with another sim
Post by: cameni on November 08, 2015, 01:51:09 am
Maybe via a hack .. but otherwise no, it would need some multiplayer code.
Title: Re: Integrating with another sim
Post by: langdon on November 10, 2015, 01:13:32 am
I'm guessing this won't work either?

Code: [Select]
var http = require('http');
    var server = http.createServer(function (request, response) {
        response.write('hi');
        response.end();
    });
    server.listen(3000);

It's telling me 'require' is not defined?

I did manage to get JSBSim to open a port but ended at a dead end too :)

L
Title: Re: Integrating with another sim
Post by: langdon on November 10, 2015, 02:00:47 am
OK, so looks like I confused V8 with NodeJS.. groan..

Don't suppose it's any easy job to compile in a tiny socket function and expose it to V8?
Title: Re: Integrating with another sim
Post by: cameni on November 10, 2015, 06:22:27 am
This belongs to a higher level; how would you know form the script what instance to connect where?

Hmm, maybe you could create the planes from C++ via aircraft control API ...
Title: Re: Integrating with another sim
Post by: langdon on November 10, 2015, 07:21:22 am
2 Things..

1.) There's an aircraft control API?..  can I have a look?
2.) Being that my interest is driving OT with the FSX engine, I would spawn a bunch of aircraft. I believe they have an 'instance_id' (if not I'm sure I could generate a unique id) and have them 'checkin' with the fsx interface at the other end of the pipe (tcp port). the fsx interface would link them with AI traffic in FSX. I'd just send a string down the pipe like <id1><position><orientation> | <id2><position><orientation> | etc etc.

The best solution would be, to be able to have my fsx interface spawn and destroy OT aircraft at will but I'm  happy with small steps. It's a big lonely sky! :)

I'll try and upload a video of my flying dolphin :|
Title: Re: Integrating with another sim
Post by: cameni on November 11, 2015, 03:35:42 am
There's an aircraft control interface but it's got a ton of dependencies, so I think I'd rather add methods to create and manage objects through the IGC interface. It would be creating static objects (i.e no sim engine attached to them). It will also need the velocity vector to interpolate rendering frames, but that can be computed from previous positions.
Title: Re: Integrating with another sim
Post by: langdon on November 11, 2015, 03:58:28 am
That sounds promising.

One spinoff of being able to create/destroy static objects is that I could spawn an airport where I need one (ie. when it's supposed to come into view).

Where do I send the Golden Pheasant ?  :)
Title: Re: Integrating with another sim
Post by: Uriah on November 12, 2015, 02:35:16 am
It would be great to be able to set the position, rotation and jsbsim properties of an aircraft from an external source. Not only could another simulator or physics engine drive the aircraft, but you could also record data in the CSV output from jsbsim and play-back a flight from stored data.

Great work langdon! I'll be sure to give your plugin a try. :)

Regards,
Uriah
Title: Re: Integrating with another sim
Post by: langdon on November 12, 2015, 09:24:31 pm
Cameni,

Is there any way to get the terrain altitude from any given lat/lon in the aircraft script?

I'm  trying to hack my autopilot script to do terrain following but I need to be able to 'look forward' at least a few hundred meters and get the terrain height to give my autopilot a 'pull up' command.

Thanks,
L
Title: Re: Integrating with another sim
Post by: cameni on November 13, 2015, 12:46:27 am
You can use intersect() method of igc, preferably giving it as short from-to range as possible.
Title: Re: Integrating with another sim
Post by: langdon on November 13, 2015, 01:19:26 am
You might find this interesting.

Multiple aircraft following preset waypoints.
The wings are wobbling because I haven't tuned the PID controllers on the ailerons but I kind of like it. It gives them personality :)


So now I can fly around with my pretend friends!

https://youtu.be/xu5exdw7xBg
Title: Re: Integrating with another sim
Post by: HiFlyer on November 13, 2015, 01:50:47 am
Pretty cool!
Title: Re: Integrating with another sim
Post by: langdon on November 13, 2015, 04:01:41 am
This makes the flying more interesting.

I'm just flying the standard OT Cessna here. Not connected to FSX so now I need to try it in my Oculus. :)

If it's preferred that I post these Videos in another forum, just give me the word.

https://youtu.be/z2M3AV0tP_E
Title: Re: Integrating with another sim
Post by: John514 on November 13, 2015, 07:02:07 am
The next step up from this is to make FSX run only to provide the physics and don't display images at all, so it could save up on system resources
Title: Re: Integrating with another sim
Post by: langdon on November 13, 2015, 07:12:48 am
Are you talking about the c++ IGC or is this something available in the javascript?

I'm looking for something in javascript.
Title: Re: Integrating with another sim
Post by: John514 on November 13, 2015, 07:13:50 am
No, I don't know if something like this exists. I was just thinking
Title: Re: Integrating with another sim
Post by: langdon on November 13, 2015, 07:25:12 am
Sorry, that was meant for Cameni.

RE FSX.. that's already possible.. via WideFS.. I can run FSX on a crappy laptop at absolute minimum settings and via a network FSUIPC <-> WideFS run just OT graphics on a high end machine.

When I say 'crappy laptop' I'm talking about a $20 laptop I picked up on Ebay :)
Title: Re: Integrating with another sim
Post by: John514 on November 13, 2015, 07:29:18 am
Sorry, that was meant for Cameni.

RE FSX.. that's already possible.. via WideFS.. I can run FSX on a crappy laptop at absolute minimum settings and via a network FSUIPC <-> WideFS run just OT graphics on a high end machine.

When I say 'crappy laptop' I'm talking about a $20 laptop I picked up on Ebay :)
Oh wow
Title: Re: Integrating with another sim
Post by: M7 on November 13, 2015, 10:07:23 am
Very cool stuff!
Title: Re: Integrating with another sim
Post by: KW71 on November 13, 2015, 04:27:49 pm
Cool!!! Woud be good to give it a try!
Title: Re: Integrating with another sim
Post by: M7 on November 13, 2015, 04:58:38 pm

Multiple aircraft following preset waypoints.
The wings are wobbling because I haven't tuned the PID controllers on the ailerons but I kind of like it. It gives them personality :)


Yeah looks like they're piloted by terrorists who just got their pilot license and are ready to crash into something  =D
Title: Re: Integrating with another sim
Post by: OmniAtlas on November 17, 2015, 06:20:41 am

http://www.siliconroad.com.au/fsx_plugin.zip

Something weird I noticed is that sometimes, when alt-tabbing between Outerra and FSX my joystick disconnects. The work around is just pull it out of its current usb slot and plug it in another.


Any chance of a bulk importer of objects and/or roads in the near future ?
I know the FSX and Outerra terrain meshes don't exactly align (pretty damn close in a lot of places I've tried though. Happily surprised) but if I could import all the worlds runways (db's are freely available), it'd be a great starting point.

'If you build it, they will come' ... but I imagine you guys have already witnessed that!

Love your work..It's a great future.

Now I'll load up an ultralight, put on my DK2 and enjoy a lovely sunset flight.

Thanks guys!

Langdon

Thank you for this Langdon -- here is a short flight I did with my A320 home cockpit flying around the Gold Coast --

https://www.youtube.com/watch?v=-TaQx7ouq5w&feature=em-upload_owner


A couple questions if I may since this is my first time using Outerra (I downloaded and bought it once I found out it can be compatible with FSX/P3D)

- Is there anyway to run outerra on a different monitor? I have the projector setup on a different output but I was only able to make it run on that desktop when I make it the 'main' desktop in Windows setting.

- Is there any way to adjust the time? Is it linked up with FSX/P3D time?

Thank you!
Title: Re: Integrating with another sim
Post by: langdon on November 17, 2015, 07:23:14 am
Hi,

I'm incredibly envious of your simpit!
Mine is still years from completion. I've built an MCP and throttle quad and just finishing up my first FMC.

I can't answer about running Outerra on a different monitor, you'll have to ask the OT guys. I actually run it across 5 monitors. Have you tried the cylindrical/spherical projection? It's have on the frame rate but is SOOO much cheaper than Nthusim !

As for transferring FSX time to OT. Yes... I've finished version 2 which adjusts the OT time. I'll likely put it online tomorrow. Unfortunately, I don't think there is much else I can add after that due to the limitations of the OT API for now.

I have written some script that can be added to the OT aircraft that makes them fly waypoints. It doesn't interact with FSX but it's nice to see a bit of 'life' at  the airport :)

I would love to be able to inject FSX weather into OT. I hope the OT guys are listening...

L
Title: Re: Integrating with another sim
Post by: HiFlyer on November 17, 2015, 09:10:09 am
This seems like an opportunity, actually. If Outerras Osm implementation along with other databases can provide cities and airports that match FSX/X-plane locations, then I can easily see sim-pilots, maybe even some professional simulation companies, adding Outerra to their repertoire.

The question is, are the devs positioned for, or capable of (resource-wise) taking advantage of something like that.

And are they interested.

If I was a third party company looking for a market, I might consider taking a look at this as well, honestly, and working with the devs to see what could be done.
Title: Re: Integrating with another sim
Post by: bomber on November 17, 2015, 03:15:20 pm
The next step up from this is to make FSX run only to provide the physics and don't display images at all, so it could save up on system resources

Provide the physics?

Is there a belief that it's better than what we can do?
Title: Re: Integrating with another sim
Post by: John514 on November 17, 2015, 04:35:30 pm
The next step up from this is to make FSX run only to provide the physics and don't display images at all, so it could save up on system resources

Provide the physics?

Is there a belief that it's better than what we can do?
Long term, Outerra flight physics will be batter (blade element theory) but at the moment, FSX can do better. Flight behaviour on its own is better than FSX at the moment but everything else is missing.
Title: Re: Integrating with another sim
Post by: bomber on November 17, 2015, 05:25:48 pm
Sorry you've lost me.... What's everything else?
Title: Re: Integrating with another sim
Post by: OmniAtlas on November 17, 2015, 05:50:39 pm
Hi,

I'm incredibly envious of your simpit!
Mine is still years from completion. I've built an MCP and throttle quad and just finishing up my first FMC.

I can't answer about running Outerra on a different monitor, you'll have to ask the OT guys. I actually run it across 5 monitors. Have you tried the cylindrical/spherical projection? It's have on the frame rate but is SOOO much cheaper than Nthusim !

As for transferring FSX time to OT. Yes... I've finished version 2 which adjusts the OT time. I'll likely put it online tomorrow. Unfortunately, I don't think there is much else I can add after that due to the limitations of the OT API for now.

I have written some script that can be added to the OT aircraft that makes them fly waypoints. It doesn't interact with FSX but it's nice to see a bit of 'life' at  the airport :)

I would love to be able to inject FSX weather into OT. I hope the OT guys are listening...

L

Hi Landgdon, I'll be looking forward to trying out your newest version!

How about implementing AI aircraft translation? Perhaps all FSX/P3D AI can be injected with the default outerra aircraft. I am excited with what is to come.

My simpit was relatively straight forward to setup. I envy you guys who can build your own parts - I simply buy (this pit has FDS and cp flight parts)

Cheers.
Title: Re: Integrating with another sim
Post by: John514 on November 18, 2015, 12:43:03 am
Sorry you've lost me.... What's everything else?
NavAids, Autopilot, Atc, weather effects, turbulence... These kind of things.
Title: Re: Integrating with another sim
Post by: langdon on November 18, 2015, 03:43:18 am
Version 0.2.

Now includes synced time (almost) with FSX/P3D.
The time can actually differ by about 10 minutes depending how far away from Greenwich you get. I didn't do the 'solar time' functionality properly. I just used a shortcut. It's highly unlikely you'll tell the difference but let me know how you  go anyway.

I'd love to inject traffic and/or weather into OT but that's up to the Outerra guys now.  I don't think there's anything more I can do with the IGC interface.

Version 0.2  is here:

http://www.siliconroad.com.au/ot/fsx_02_plugin.zip

(too large for attachment)
Title: Re: Integrating with another sim
Post by: HiFlyer on November 18, 2015, 05:02:07 am
Sorry you've lost me.... What's everything else?
NavAids, Autopilot, Atc, weather effects, turbulence... These kind of things.

Actually  amongst the last few updates were windspeed controls, wind direction and turbulence, amongst others, under the weather tab.
Title: Re: Integrating with another sim
Post by: OmniAtlas on November 18, 2015, 05:31:27 am


Version 0.2  is here:

http://www.siliconroad.com.au/ot/fsx_v02_dll.zip

(too large for attachment)

Hi Langdon -- resource not found on the link you've provided. Cheers.
Title: Re: Integrating with another sim
Post by: langdon on November 18, 2015, 05:34:44 am
I updated the link in the post but here it is anyway:

http://www.siliconroad.com.au/ot/fsx_02_plugin.zip

or just go to:

http://www.siliconroad.com.au/ot/

L
Title: Re: Integrating with another sim
Post by: langdon on November 18, 2015, 05:48:37 am
Someone might get a bit of a laugh out of this...

http://www.siliconroad.com.au/ot/c172.langdon.zip

It's the OT Cessna with some 'autopilot' code.

Get to about 5000ft over Tallard (LFNA) and spawn a few.

You can change the waypoints in the top of the code.
You can generate a list of waypoints from a kmz (google earth) polyline file at:
http://www.siliconroad.com.au/ot/  if you're REALLY keen.
The code is crap..I know it...but it's just a start :)

L
Title: Re: Integrating with another sim
Post by: bomber on November 18, 2015, 01:14:01 pm
Long term, Outerra flight physics will be better (blade element theory) but at the moment, FSX can do better. Flight behaviour on its own is better than FSX at the moment but everything else is missing.

NavAids, Autopilot, Atc, weather effects, turbulence... These kind of things.

Ok I see what you're saying but you can't just 'suck in' a navaid from FSX... because there's no interaction with it through a GUI.

And a navaid is a beacon... ie a fixed point on the planet that has a known co-ordinate that an instrument within a planes cockpit gives directions too.... ALL of that can be done now... if we had a 2d GUI...

Autopilot.... yet again no 2d gui..

weather.... that's a good one, but even if rain was brought in tomorrow it would only be visual because non of the flight models are set up to interect with water ingress...

ALL the potential is here in Outerra, it's not a mish mash of FSX, ANOther flightsim and Outerra's terrain, running side by side.

I aplaud what's been done within this thread as an excercise of using another application within Outerra, and personally would love to see another aplication used as a supply chain manager, directing AI components through autopilot/waypoint commands to deliver goods from point to point based on data (supply and demand) at various nodes. I think if we had this, used in both commercial and military roles, which was then taken to online play the potential interaction you'd have with your environment would be massive...

Good luck with whats being done at present though... I do applaud it

regards

Simon



Title: Re: Integrating with another sim
Post by: langdon on November 28, 2015, 09:51:37 pm
For what it's worth.. That fsx plugin works with x-plane 10 as well via xpuipc.
Title: Re: Integrating with another sim
Post by: HiFlyer on November 29, 2015, 10:05:34 am
For what it's worth.. That fsx plugin works with x-plane 10 as well via xpuipc.

For what its worth, I'm hoping that after the show is over on the 4th, the devs might be available to offer you more assistance in the work you are doing. If you can get this to really work, in conjunction with Outerra OSM support for locations and airports, I suspect it would generate a lot of intermediate interest.
Title: Re: Integrating with another sim
Post by: HiFlyer on December 20, 2015, 12:09:57 pm
Langdon, A new thought: After watching some gliding videos on Youtube, including some of condor soaring simulator, it suddenly occurred to me that with the ability to set paths for planes you've demonstrated, it might be more feasible now than ever to have actual glider tow planes, where the ask-13 could be "linked" to the tow plane until a predetermined area, and then the ASK-13 could manually release and do some gliding.

The tow plane could have several predetermined paths to areas with precalculated wind/thermal maps. I believe bomber had mentioned previously that thermals and ridge lift were possible in Outerra and JSBSIM.

Does this sound doable? Or interesting?

Seems to me that gliding (especially in 3d with the oculus!) even in just specially built-up areas (buildings, etc) around the various gliding zones, might become a very attractive feature in Outerra.
Title: Re: Integrating with another sim
Post by: Uriah on December 20, 2015, 12:31:19 pm
JSBSim has a tow hitch interface that is designed for this specific purpose. I've been trying to figure out exactly how it works, and if Outerra will need to add something to the interface in order for it to work. It is already used in FlightGear, and could also be used for aerial refueling, or a fighter jet with a towed radar decoy, etc...

http://wiki.flightgear.org/Howto:Setup_winch_and_aerotowing_for_JSBSim-aircraft

I already know how to set it up for each aircraft, but I am not exactly sure about how the two are connected/detached.

Regards,
Uriah
Title: Re: Integrating with another sim
Post by: bomber on December 20, 2015, 12:44:20 pm
It's flightgear using Nasal scripting......
Title: Re: Integrating with another sim
Post by: Uriah on December 20, 2015, 01:08:38 pm
Ah, so it isn't directly in JSBSim. Hmmm... well I wonder how difficult it would be to setup... :)
Title: Re: Integrating with another sim
Post by: bomber on December 20, 2015, 01:12:26 pm
Having seen the speed of your work,  I don't think too hard to convert the logic from Nasal to java script file called up by the planes fdm.
Title: Re: Integrating with another sim
Post by: HiFlyer on December 20, 2015, 01:14:00 pm
http://wiki.flightgear.org/What_is_Nasal
Title: Re: Integrating with another sim
Post by: Uriah on December 20, 2015, 02:01:32 pm
Having seen the speed of your work,  I don't think too hard to convert the logic from Nasal to java script file called up by the planes fdm.

I'll have to look into the code more in depth in the near future. I really want to do aerotowing, aerial refueling and towed radar decoys.
Title: Re: Integrating with another sim
Post by: HiFlyer on December 21, 2015, 09:16:42 am
Hmmmmmmm..... Well, at least one more piece of the puzzle has been revealed.........
Title: Re: Integrating with another sim
Post by: langdon on December 21, 2015, 08:12:45 pm
As far as I've been able to ascertain, there's nno way two aircraft objects can interact. There's no collision detection/physics between them so providing one aircraft with a 'hook' and the other with a 'catch' so to speak won't work. I imagine that would've been the most realistic way to do it.

Other than that, we'd need to be able to get position and attitude data from each object to an external plugin that could manage it all and 'fake' the interaction of tug and glider.

If we could get that position and attitude data (and maybe one more generic string that we could load with anything we like) to flow back  and forward between a plugin and each object then the possibilities would be close to limitless. (AI, ATC, NAV, MULTIPLAYER etc etc).

My wishlist for 2016 would be:

1.) Position/Attitude/GenericPacket data flow in/out to a plugin for each object.
2.) Large area levelling
3.) Lighting for static objects

L
Title: Re: Integrating with another sim
Post by: langdon on May 12, 2016, 12:30:35 am
Hi,

Is there an updated IGC API?
I just tried compiling the example from the api zip I downloaded last year and anteworld fails to load the plugin and just stops responding.

Thanks,
L
Title: Re: Integrating with another sim
Post by: cameni on May 12, 2016, 01:18:46 am
I have updated the zip file to version 16.6655, also added the environment api.
Title: Re: Integrating with another sim
Post by: langdon on May 12, 2016, 01:23:24 am
Thanks...

CAT III approach... here we come :)

L
Title: Re: Integrating with another sim
Post by: josem75 on May 12, 2016, 02:36:18 am
I dont know what kind of witchcraft you made but looking stunning.. 
Title: Re: Integrating with another sim
Post by: langdon on May 12, 2016, 07:20:56 am
Latest plugin  here:

http://www.siliconroad.com.au/ot/fsx_03_plugin.zip

No weather sync yet though... workin' on it.

L
Title: Re: Integrating with another sim
Post by: langdon on May 12, 2016, 11:37:34 am
@Cameni..

Any chance for a few code lines to get me started..
like just to change say... rain_density.

I'm having a mother of a time just getting the ot::environment pointer. (if I'm even supposed to be getting that?)

I spend all day writing vb and javascript so finding my way around a c++ api is a hard slog :)

L
Title: Re: Integrating with another sim
Post by: langdon on May 12, 2016, 11:57:41 am
OK.. got it to rain so I guess the rest is 'academic', but I'd still appreciate a few lines if you have time.

My code is probably sub par... and that's being complimentary :)

L

Title: Re: Integrating with another sim
Post by: cameni on May 12, 2016, 12:20:11 pm
Once you got the environment interface (iref<ot::environment> env = ot::environment::get()), you just fill out the structs and invoke setters ... there is nothing special in it, except you need to set masks in some of the structs to indicate the values you are changing.
Title: Re: Integrating with another sim
Post by: langdon on May 13, 2016, 03:56:24 am
See, for a guy who writes online booking engines, getting to:

 (iref<ot::environment> env = ot::environment::get())

was a huge step :)  .... actually I looked at the code:

static iref<igc_plugin> _M = ot::igc::get(new igc_plugin); 

and thought...well that's kinda the same, so blundered around for a while with it and env.h and voila... managed to adjust rain.
Glad you gave me a heads up on the masks though... would've been painful finding out that the 'hard way'.

Curious now... is there a way an in game model , say a Cessna, can read the environment?
Eg...if it was dark, I could turn on a light or if it was raining, start wipers..or raining at intensity 0.9 put the wipers on high?

L
Title: Re: Integrating with another sim
Post by: cameni on May 13, 2016, 04:52:25 am
For lights you can use this.solar_time function in aircraft script, that returns {time, sun_coef} object, defined as:
Code: [Select]
//@param time [out] solar time at vehicle location, in miliseconds
//@param sun_coef sun position relative to horizon: 0 sun at horizon, 1 sun at zenith, -1 sun at anti-zenith

T817 script has an example of automatic lights using the sun_coef value.

Even though you can access the env interface from javascript (var env = this.$query_interface("ot::js::environment.get")), it will likely go away soon, because it would allow aircraft to mess with global settings which is not desirable. There should be some kind of sensors api for environment sensing instead.
Title: Re: Integrating with another sim
Post by: langdon on May 13, 2016, 04:57:55 am
Thanks,

Actually.. turning lights on and off was an after thought..
What I was thinking is that I could ride position information into a model via an environment variable :)

ie  rain_intensity=0.00123476009876543

L
Title: Re: Integrating with another sim
Post by: cameni on May 13, 2016, 05:16:20 am
I'm not sure I understand, what you want to achieve?
Title: Re: Integrating with another sim
Post by: langdon on May 13, 2016, 05:30:14 am
A way to communicate with an ingame vehicle from the outside world.

A really POOR version of multiplayer :)
Title: Re: Integrating with another sim
Post by: cameni on May 13, 2016, 05:52:34 am
Messages encrypted in the rain ... now that would be some matrixesque movie :D

Hmm, not easily in the current version, but in the next one there will be something accessible at the global game level.
Title: Re: Integrating with another sim
Post by: langdon on May 13, 2016, 05:58:58 am
Ya see how desperate we are now :)
We'll (I'll) literally try anything!
Title: Re: Integrating with another sim
Post by: langdon on May 13, 2016, 07:46:07 am
Hmm...forgot about rotation....
So position in the rain and rotation in the clouds :)

Anyone know of a FlightAware type service with a FREE live data feed?

So pointless, but a good laugh on a wet Friday night.
Title: Re: Integrating with another sim
Post by: langdon on May 14, 2016, 12:00:11 am
Many will ask, "what's the point"...

Sorry..I couldn't figure out how to get the correct object rotation. My dll just kept sending through zeroes.

But for a laugh.. here's the proof of concept.
I can control the position of an in game object by passing position info via the weather system.

I am flying a helo in P3D and transferring it's position info to the object in Outerra.

https://youtu.be/40cLn4ehGMs
Title: Re: Integrating with another sim
Post by: cameni on May 14, 2016, 01:39:49 am
In glm_ext.h there's quat_from_hpr function, if hpr angles are what you got.
Title: Re: Integrating with another sim
Post by: langdon on May 14, 2016, 06:28:59 am
Hi,
Yeh been using that function for a while now.
My problem was much more stupid :)
First I tried to stick a number in a float that was way to large and then I forgot to cast some doubles to floats anyway... basically moron errors .. but that's what happens when you spend 90% of your life coding web apps :|

Anyway..that's sorted.

I ended up passing 7 variables one at a time via "auto_weather_period" and using "rain_density" to  indicate which variable was being passed. If I set rain density down to 0.00007 and less , it doesn't have much impact on the environment.

So one more video...

https://youtu.be/M2RxRavR_Mg
Title: Re: Integrating with another sim
Post by: langdon on May 16, 2016, 03:36:54 am
How long do you think before you give us a multiplayer(ish) api?

I've put some client/server code into the igc dll and I can send position data etc to the server but it's actually very tricky to get all that data reliably thru the 'rain' :)

A month or 2 or do I push on with my madness? :|

L
Title: Re: Integrating with another sim
Post by: langdon on May 16, 2016, 05:03:46 am
Hmm.... a small glitch in my plan...

It would seem that an object (aircraft) can control the weather but as soon as I spawn another aircraft the first aircraft is no longer able to manipulate the weather variables?

OR, is it because object A is setting eg. the rain_density and then object B is setting the rain_density (overwriting object A's setting) and then you update the frame and call the plugin.dll?

It would seem I can inject positions into multiple ingame objects but I can't get the positions back out.

I suppose I could put eng.log on a ram disk and monitor it for changes and write the positions out thru there...

But there's nuts  and then there's REALLY NUTS :)
Title: Re: Integrating with another sim
Post by: cameni on May 16, 2016, 02:25:39 pm
Yea, only one vehicle can be the last to set the rain :)

Technically you could expose an interface from your dll that would be accessible from aircraft scripts, just like the env interface is. However, even though it's almost automatic, the initial setup might be a bit problematic for you. Hmm, maybe I could expand the example with it ...
Title: Re: Integrating with another sim
Post by: langdon on May 16, 2016, 11:31:11 pm
Any help and examples are always greatly appreciated!

A nudge in the right direction is always better than spending  hours poking around in something that is quite complicated to grasp.

Thanks,
L
Title: Re: Integrating with another sim
Post by: cameni on May 17, 2016, 01:14:16 am
Ok, new ot-api.zip (http://outerraworld.com/appdata/Anteworld/ot-api.zip) uploaded, added interface example. T817 script that uses it attached here.
Title: Re: Integrating with another sim
Post by: langdon on May 17, 2016, 01:25:48 am
Sweet..downloaded and looking at it now...

Am I wrong or did you just release something that could potentially change Outerra forever?

Objects communicating with the world outside the Outerra engine, which means they can potentially communicate with each other.

So... if that's the case...its just a matter of time before I  can fly the Cessna on vatsim :)
L
Title: Re: Integrating with another sim
Post by: langdon on May 17, 2016, 03:44:35 am
Small problem...

I'm pretty sure I worked out how it functions but I may be getting it wrong so:

t817 code:

function update_frame(dt, engine, brake, steering, parking)
{
    $plugin.set_value(99);

...
}


dll code:

int tVal = 22;
   myfile << "Value a:" << plg.get_value() << "\n";
   myfile << "Value b:" << tVal << "\n";

the output in my dll log file (myfile) is:

Value a:0
Value b:22
Value a:0
Value b:22
Value a:0
Value b:22
Value a:0
Value b:22

....

I didn't change much else in the example dll. Only enough to write the log file.

Also, the dll compiles ok but when I exit Outerra I always get this error: (dialog popup image attached):

The instruction at xxxxxxxxxxxxxxx  referenced memory at xxxxxxxxxxxxxx. The memory could not  be read.

Note.. I get the same error even if I use the example without any modification.
I'm using VS 2013 on Win 10 if it matters


Am I missing something?

L

Title: Re: Integrating with another sim
Post by: cameni on May 17, 2016, 04:06:14 am
The example increments the value from plugin for each new vehicle spawned. That worked fine, so I guess you must be clearing the value somewhere, or talking to a different plugin class instance.

Yep, the latter - the plg member is not actually used, when the script connects, it invokes the creator method (plugin::get), and that creates its own local singleton object. You can change it to access the _M module object instead, and take the plugin class instance from there (but it probably needs to be changed to iref<plugin> plg

The crash is likely because of incorrect cleanup when the plugin unloads and leaves the singleton that destroys late.
Title: Re: Integrating with another sim
Post by: langdon on May 17, 2016, 05:36:52 am
Ok..I kinda get it.. I didn't notice the code in the script that incremented the value on each vehicle spawn... my bad... but I see that the value can be passed between objects...super cool.

Up front..I just want to apologize for you having to teach me my job but I'm a bit lost with:

You can change it to access the _M module object instead, and take the plugin class instance from there (but it probably needs to be changed to iref<plugin> plg

Are you talking about  changing the script to access the instance of plugin created by the dll?
Title: Re: Integrating with another sim
Post by: cameni on May 17, 2016, 06:20:54 am
No, in the C++ code. When js queries the interface, a special creator method gets called, in this case plugin::get. It should return a plugin object. It's completely in its hands what object gets returned - whether it's a singleton, or a newly created instance of the object, or something obtained from somewhere based on the optional parameters.

I made a mistake of adding plugin plg; into the igc_plugin object, but that instance wasn't the one returned by the creator method.
Title: Re: Integrating with another sim
Post by: langdon on May 17, 2016, 07:32:41 am
Yay...
Thanks for your patience.

static iref<plugin> _PLG = plugin::get();

gets me the same instance being used by the javascripts and I'm picking up the  vehicle spawn ids as they change.

Thanks heaps.
Title: Re: Integrating with another sim
Post by: langdon on May 18, 2016, 06:33:00 am
Is there a variable in script that indicates which

var geom = me.get_geomob(0);
geom.get_inst_id()

is currently being inhabited, that is, if I spawn 2 vehicles and I jump out of one and into the other is there some variable somewhere that says 'player is currently controlling object x' ?

Thanks,
L
Title: Re: Integrating with another sim
Post by: cameni on May 18, 2016, 09:29:00 am
I don't think any such variable is currently available to vehicle scripts or igc.
Title: Re: Integrating with another sim
Post by: langdon on May 18, 2016, 09:41:21 am
As a temporary measure, I suppose I could add a switch to the cockpit that says.."I'm here" and send the inst_id into the plugin.
Title: Re: Integrating with another sim
Post by: langdon on May 19, 2016, 03:19:22 am
I just got a whole order of magnitude more respect for those poor guys that code multithreaded servers for MMOs and MOGs.

It's one thing to spam a bunch of coordinates out through a port..
It's a WHOLE other thing to do something meaningful with them,  turn them around and send them back down all the other connected lines :)

Title: Re: Integrating with another sim
Post by: langdon on May 20, 2016, 02:55:40 am
Has anyone made an open cockpit aircraft for Outerra?
Title: Re: Integrating with another sim
Post by: PytonPago on May 20, 2016, 03:07:52 am
Has anyone made an open cockpit aircraft for Outerra?


You mean like the Shavrov Sh-2 ?

http://forum.outerra.com/index.php?topic=1281.0 (http://forum.outerra.com/index.php?topic=1281.0)
Title: Re: Integrating with another sim
Post by: langdon on May 20, 2016, 03:42:20 am
Thanks,

I download and installed it but unfortunately something in the script must be broken.
I'll have a poke around and see if I can get it airworthy again :)
Title: Re: Integrating with another sim
Post by: HiFlyer on May 20, 2016, 02:43:56 pm
Thanks,

I download and installed it but unfortunately something in the script must be broken.
I'll have a poke around and see if I can get it airworthy again :)

Yup, that plane has been grounded for quite a while.
Title: Re: Integrating with another sim
Post by: langdon on May 21, 2016, 05:48:35 am
@Cameni..

I've got a rudimentary setup now but I have a few questions.

I open Outerra on two machines and spawn two t817 's. on each machine.
t817 A is controlled by me and t817 B is controlled by the 'other' Outerra user.

Q1. Is it possible to run two  instances of Outerra on one machine? My testing says no but maybe you know differently?

Q2. If I run one FULL copy of Outerra (paid for) and one demo copy on another machine the pc running the demo-only copy doesn't seem to run the plugin.dll? Is that correct?

Q3. If I start a FULL version on PC A  and then start a full version on PC B. PC A gets 'logged out' from you guys. It still continues to send my server data so it'll do in a pinch but do I strictly need two full versions of Outerra?

Thanks,
L


Title: Re: Integrating with another sim
Post by: langdon on May 21, 2016, 08:42:56 am
Quick video showing the jerky movement of the externally driven object.

Multiplayer server is hosted in Australia.
Ping between me and server is approx. 19ms.
Plugin is sending position and rotation data every 100ms. (set by me..could potentially be faster).

I think I'll need to get the velocities and calculate interim positioning.

https://youtu.be/w50HwobemCc



Title: Re: Integrating with another sim
Post by: cameni on May 21, 2016, 09:51:41 am
Yea you definitely need to interpolate positions for given frame render time.

The demo version doesn't run plugins, and when you log in with another instance, it will kick out the previous one. Just create another account for testing and PM me the name.
Title: Re: Integrating with another sim
Post by: langdon on May 21, 2016, 11:30:54 pm
Heaps better.

Technically the receiver_client is 100ms behind the sender_client because I'm interpolating between the last 2 received positions.

I suppose I could get predictive and extrapolate based on a known velocity vector but from what I've read that has drawbacks if you change heading quickly and isn't worth the effort.

At the speed of sound your talking about 30cm over 100ms. I guess you have to be going for a 'head shot' in a Mig to worry about that kind of accuracy :)


https://youtu.be/Cb9wuFzNQdA
Title: Re: Integrating with another sim
Post by: langdon on May 22, 2016, 12:52:11 am
My 2 pc's are at opposite ends of the house, so there's a long gap between me starting the recording and actually starting the t817 :)

You'll notice 1 or 2 position/rotation glitches in the movement. At some point they'll need to be filtered out.

So..... anyone in the GMT+10 time zone?

https://youtu.be/C19lXCyTPDI
Title: Re: Integrating with another sim
Post by: langdon on May 24, 2016, 05:16:22 am
Quick question...

I understand there's no way (yet) to programmatically spawn a vehicle, but is it possible to have 'pre-spawned' vehicles in a .ota package ?

Something makes me think that when I first discovered Outerra there was a scene where there was a Cessna a Mig and a truck all parked at an airport? Or am I mis-remembering?

L
Title: Re: Integrating with another sim
Post by: KW71 on May 24, 2016, 09:34:45 am
Quick question...

I understand there's no way (yet) to programmatically spawn a vehicle, but is it possible to have 'pre-spawned' vehicles in a .ota package ?

Something makes me think that when I first discovered Outerra there was a scene where there was a Cessna a Mig and a truck all parked at an airport? Or am I mis-remembering?

L
Hi! Do you mean an .otx ?

You just need to place the vehicle using the editor (F7) and include the cache containing that cell.
Title: Re: Integrating with another sim
Post by: langdon on May 24, 2016, 10:33:22 am
If I do that, will the vehicles be functional or just static?
Title: Re: Integrating with another sim
Post by: KW71 on May 24, 2016, 11:07:18 am
You can use them hitting enter.
Title: Re: Integrating with another sim
Post by: langdon on May 25, 2016, 04:36:44 am
I must be missing something really basic because hitting ENTER does nothing for me unless I do it on a vehicle that I spawn.


With the Monterrey scenery.....the AH-64's that are included.. Do they function for y'all when you hit ENTER?

For me they are just static objects that I can't enter.


L
Title: Re: Integrating with another sim
Post by: langdon on May 26, 2016, 04:44:08 am
Damn...

I just realized something. With one-on-one multiplayer you just bounce one set of coords back and forth between the two players but with 3 or more, that's one set out going and 'n' sets incoming.

Which means the igc.dlll that updates one time every frame needs to receiving data between frames..

Which means THREADS !!!

Arrrrgh.

Which means
Title: Re: Integrating with another sim
Post by: cameni on May 26, 2016, 10:43:02 am
Probably not worth the hacking effort on the igc level.

But you actually do not need threads for this, just need polling for received datagrams at the frame start, updating object positions, and sending your own positional datagrams to other peers.

With the Monterrey scenery.....the AH-64's that are included.. Do they function for y'all when you hit ENTER?

For me they are just static objects that I can't enter.

I don't have the scenery installed here now, but I know there was a bug that you had to be outside of the bounding box of the vehicle/aircraft, but not too far, otherwise enter wouldn't work.
Title: Re: Integrating with another sim
Post by: Acetone on May 26, 2016, 11:06:59 am
With the Monterrey scenery.....the AH-64's that are included.. Do they function for y'all when you hit ENTER?

For me they are just static objects that I can't enter.

Enter vehicles can be a little bit tricky sometimes, but it works for these AH-64, you just need to be close enough (around 10m away, check with the "TAB" key HUD), but not inside the bounding box, as Brano said.
Title: Re: Integrating with another sim
Post by: langdon on May 27, 2016, 03:09:18 am
Thanks,
Yep..not inside the bounding box works.
Unless you actually spawn a vehicle from the menu..then inside the bounding box seems ok too.

RE: Threads..yeh.. I had an issue with a lot of 'flickering' vehicles which I'd assumed was me spending too long inside the dll receiving data. I also think it was compounded by using a 'blocking' receive as well. I made sure its non-blocking now.

I think I also got the cart-before-the-horse setting variables in the vehicle js and expecting to pick them up 'after' in the dll but the dll is called before the vehicle js update..

L
Title: Re: Integrating with another sim
Post by: langdon on May 28, 2016, 06:10:13 am
Quick question..

I get gx,gy,gz from the dll and pass them to this

var geom = me.get_geomob(0);
geom.set_pos({ x: gx, y: gy, z: gz });

  in the vehicle js.. Vehicle moves as you would expect....but as soon as I stop sending it set_pos() commands..it seems to return to where it would have been prior to me not sending the commands.

OR if you prefer... I take off, drop bomb...bomb should follow a parabola from where I 'launch' it.. instead..it's back in the hangar where I took off from?

Wierd...I continue to check my code but it seems all ok ... so far.
Title: Re: Integrating with another sim
Post by: SteelRat on May 28, 2016, 11:00:42 am
Quick question..

I get gx,gy,gz from the dll and pass them to this

var geom = me.get_geomob(0);
geom.set_pos({ x: gx, y: gy, z: gz });

  in the vehicle js.. Vehicle moves as you would expect....but as soon as I stop sending it set_pos() commands..it seems to return to where it would have been prior to me not sending the commands.

OR if you prefer... I take off, drop bomb...bomb should follow a parabola from where I 'launch' it.. instead..it's back in the hangar where I took off from?

Wierd...I continue to check my code but it seems all ok ... so far.

Code: [Select]
geom.move({ x: gx, y: gy, z: gz });
?

will need to be taken into account
https://en.wikipedia.org/wiki/Quaternion
Title: Re: Integrating with another sim
Post by: SteelRat on May 28, 2016, 11:04:52 am
PS

I think, too, will not work. We need to change the position of the object, not the position of the geometry.
Title: Re: Integrating with another sim
Post by: SteelRat on May 28, 2016, 11:10:48 am
PS 2

Probably have to write a lightweight AI that will manage the remote object, that is, use the command for motion technique.

Code: [Select]
this.extra_force(params);
this.wheel_force(params);
this.wheel_brake(params);
...
Title: Re: Integrating with another sim
Post by: langdon on May 28, 2016, 11:57:02 am
thanks,  wasn't aware of geom.move({ x: gx, y: gy, z: gz });

I'll  give it a try.
Title: Re: Integrating with another sim
Post by: cameni on May 28, 2016, 12:44:53 pm
set_pos on geom will only move the geometry, but not the position in physics. There's set_pos on vehicle itself that will do what you need.

Edit: um, actually that's not present on the vehicle physics object  ???
Title: Re: Integrating with another sim
Post by: SteelRat on May 28, 2016, 03:29:28 pm
Quote
Edit: um, actually that's not present on the vehicle physics object

When I, too, wondered why this is not)

Edit: We need to add a method this.remove_from_scene(). To properly remove the object.
Title: Re: Integrating with another sim
Post by: langdon on May 29, 2016, 02:42:40 am
I think I've finally got it... :)

Aircraft are still a bit jumpy but I think that's due to the 100ms latency I've hardcoded in as a test.

I can say though... Multiplayer Outerra with a Rift is REALLY COOL!

Just want  to say too..Levi's Heinkel_He51 is absolutely beautiful !
Title: Re: Integrating with another sim
Post by: langdon on May 29, 2016, 08:57:50 am
New line of questioning now :)

Weather.... It's not actually possible to make it sunny at point A and cloudy at point B is it?
The weather is basically global right?

Thanks
Title: Re: Integrating with another sim
Post by: HiFlyer on May 29, 2016, 10:40:33 am
New line of questioning now :)

Weather.... It's not actually possible to make it sunny at point A and cloudy at point B is it?
The weather is basically global right?

Thanks

I'm pretty sure that's the case. At this point I would even enjoy just the ability to create and save weather themes, Instead of having to create something for each session.
Title: Re: Integrating with another sim
Post by: cameni on May 29, 2016, 02:46:30 pm
Manually set weather is global. Automatic one will vary also depending on the location, albeit in uncontrollable manner, obviously.
Title: Re: Integrating with another sim
Post by: langdon on May 29, 2016, 07:44:04 pm
Thanks,

That's what I thought.
I was thinking of something like REX Weather architect for Outerra.
I can change the global weather on-the-fly based on data from somewhere like openweathermap.org  but I won't have the ability to place bad weather in a particular location that you can see in the distance and avoid.
Title: Re: Integrating with another sim
Post by: langdon on May 29, 2016, 10:06:29 pm
There was some mention of: "- sketch API to draw lines, images (C++)"  in July last year.
Does this exist for us yet and is there any info on it somewhere?
Title: Re: Integrating with another sim
Post by: cameni on May 30, 2016, 10:44:07 am
It exists, but it's unstable (api-wise) so we didn't publish it yet.
Title: Re: Integrating with another sim
Post by: langdon on May 31, 2016, 06:53:10 am
I know a lot of folks here are flight simmers and probably have Active Sky Next already.
I could interface with ASN  for weather which I think updates every 15mins and has historical data and the ability to save weather 'profiles'

BUT... a lot of people won't have it...There's a service openweather.org that I can use (or even weather underground) but people would need to apply  for a FREE api key to use it. Also..it's data is 2 hours behind real time.

Both options would be great but one has to come first :)

Anybody wanna give an opinion?

L
Title: Re: Integrating with another sim
Post by: Acetone on May 31, 2016, 01:01:17 pm
I would say openweather.org, since there are not only flight sim enthusiasts in OT, and even in this crowd, I'm not sure everyone has bought Active sky :)

Thanks a lot for your work langdon, it's very interesting to see what you are doing with the engine  :D
Title: Re: Integrating with another sim
Post by: langdon on June 01, 2016, 01:45:34 pm
@cameni,

Is it possible to have multiple cloud layers?

I don't see anything in env.h that indicates it would be possible.

L
Title: Re: Integrating with another sim
Post by: cameni on June 02, 2016, 01:24:49 am
Not yet, currently it's just a single layer.
Title: Re: Integrating with another sim
Post by: langdon on June 28, 2016, 04:13:59 am
Don't use Casecom power supplies! Two dead in the  space of two days.
Now that I've got that off my chest :)

Finally got 1 back working with a graphics card that can handle Outerra but I need the second to continue the multiplayer plugin. Should have a new PSU by weeks end. (assuming it the PSU :|)

In the meantime been doing some weather work and a bit of work on another side project I've got going which leads me to this 'question'....

I actually fly in real life. I'm building a glass cockpit for an LSA aircraft (experimental class so just about anything is possible). I''ve got a whole bunch of sensors hooked up to a Raspberry Pi and that all works out ok with a 7inch display showing data similar to the PFD on a 747.

I'm looking to get a second Navigation Display made and I was thinking about how Garmin have 'synthetic vision'. I'm assuming there's no way to get Outerra working on a PI but it may be possible on a NUC / Brix. I could download all data for the entire plannet (or at least my area) but Is there anyway to run Outerra 'offline' ?

I find I need to login before I can get it to run. Maybe with a dongle or something? Happy to pay a bit extra.

Just for interests sake, the usual Glass Cockpit cost around USD 6000+. So far mine is about $250.
That gives me:

Airspeed (real airspeed not ground speed)
Artificial Horizon
Compass
Altitude
Vertical Speed
And anything you can get from a GPS..
If you combine Airspeed/Compass with GPS Ground Speed and Track you can get wind speed and deviation which is extra goodness :)
I'm also looking at GNUradio to get VOR for backup navigation. That's a whole extra 20 bux :)

Anyway
Plugin coming soon.
L
Title: Re: Integrating with another sim
Post by: langdon on July 01, 2016, 06:12:44 am
Quick question...
When I have 2 plugins both derived from ot:igc in the plugin folder it seems both are instantiated but the update() method of only the first is called.

Am I missing something?
Title: Re: Integrating with another sim
Post by: cameni on July 01, 2016, 10:39:37 am
That's right, only one IGC plugin was assumed to be active at a time. Two plugins controlling image generator would be problematic.

I find I need to login before I can get it to run. Maybe with a dongle or something? Happy to pay a bit extra.

We have a way to change the tie the license to hardware instead of having to log in, but it's not used in public OT build yet, requires a few changes.
Title: Re: Integrating with another sim
Post by: langdon on July 13, 2016, 10:10:52 am
Hi,
Not the right topic to post under I'm sure but maybe someone can offer somme advice.

In the video, I'm interpolating between two positions and orientations received from the server (multiplayer). The position info seems all ok but the orientation is really out of whack.

1 question ... in the orientation quat... what is 'w' ?

and , any suggestions what I'm doing wrong? A lot of the time it's ok but sometimes it's just really twisted..as in the video.

https://youtu.be/splgXVWNCDs

Thanks,
L
Title: Re: Integrating with another sim
Post by: bomber on July 13, 2016, 01:06:11 pm
No help here sorry
Title: Re: Integrating with another sim
Post by: cameni on July 13, 2016, 03:23:25 pm
Quaternion expresses a rotation from reference orientation. Basically, it encodes a rotation by angle around a vector, in a way that has some nice mathematical properties.
The w component is cosine of half the angle, whereas xyz is the unit rotation vector multiplied by sine of the half angle.

For interpolation between two quaternions you should look at slerp for quaternions.
Title: Re: Integrating with another sim
Post by: MiB on July 14, 2016, 02:54:51 am
Quaternion expresses a rotation from reference orientation. Basically, it encodes a rotation by angle around a vector, in a way that has some nice mathematical properties.
The w component is cosine of half the angle, whereas xyz is the unit rotation vector multiplied by sine of the half angle.

For interpolation between two quaternions you should look at slerp for quaternions.
Quite a study on quaternions from the point of geometric algebra/clifford algebra: http://vixra.org/pdf/1506.0146v1.pdf (http://vixra.org/pdf/1506.0146v1.pdf)
Title: Re: Integrating with another sim
Post by: andfly on July 14, 2016, 07:15:18 pm

In the video, I'm interpolating between two positions and orientations received from the server (multiplayer). The position info seems all ok but the orientation is really out of whack.


MAYBE    ...  I can help.
Seems like a "deja vu", an already experienced ...

http://forum.outerra.com/index.php?topic=3389.0

If, when you receive the position data, after the calculations for the iterpolation, to fix the plane's orientation using the command "rotate" of the interface geomob of outerra (or in the script or directly in the dll), you must ensure that the data that you enter in the command are "normalized."

Since version 5819 (August last year) the input values must be within the range 0-1, with different values the effects are unpredictable ...

I do not know if this is the problem ...
If you have been helpful ... I'm glad.
Title: Re: Integrating with another sim
Post by: langdon on July 16, 2016, 12:58:01 am
Thanks andfly,

Normalizing did help a bit. Still not perfect though. Obviously an error somewhere in my code but I'm going too upload it anyway. I'll figure the problem out eventually. I tried 'slerping'. That went horribly wrong. Again, something wrong with my algorithm, no doubt.

Anyway, uploading version 0.02 now. Next post will be links.

Quick question to Cameni... does the wind have a 3d vector? ie. Can I make an updraft or downdraft? There's something called a 'blip map' that glider flyers use that may be useful if I can figure it out.

L
Title: Re: Integrating with another sim
Post by: langdon on July 16, 2016, 01:07:43 am
Here we go...

The next version of the plugin.
http://www.siliconroad.com.au/ot/siliconsky_02_plugin.zip

and you'll need this OTX (inside the zip) to use the multiplayer bits:

http://www.siliconroad.com.au/ot/siliconsky_lowi.zip

This is the relevant excerpt from the readme.

------ Version 0.02 ---------------------------
Changes: 16_JUL_2016
Added multiplayer support. Rotation still glitches occasionally.
Removed wind_multiplier
Added sky_cover variables to config for easier tweaking.
Added wind gust and a turbulence hack.
Find somewhere with a thunderstorm and go for a fly/drive.

Multiplayer setup....

Go to Innsbruck Airport (LOWI)
Enter the tall red and white tower (get close to it and hit enter)
3 Biplanes and 2 trucks should spawn on the apron at the control tower end.
(Thanks to those that made the vehicles. That's way beyond my expertise!)
Exit the red and white tower and enter one of the vehicles.

Have the other player do the same thing on his/her Outerra, but of course, enter a different vehicle.
(Entering the same vehicle may have undesired effects).

The 'server' is currently running on a VPS in Australia. I'll provide the server application shortly so that it can be run locally.
IP and port can be changed in siliconsky_plugin.cfg.
For now it should be:  111.118.222.48  and port 27015

This plugin is really only meant for the hardcore Outerra followers.
Anything could go wrong at anytime so don't be disappointed when it does.
Having said that, the more people who give me feedback in the form of advice on improvements, the better it will become.
At the moment it's a bunch of hacks poorly cobbled together. What's needed now is a bit of a 'plan'.

Can multiplayer be sone somewhere other than Innsbruck?.. Yes.. all the magic is basically in the red and white tower, the plugin of course and the 2 vehicle types used (the biplane and the truck) have some special code that allow them to communicate with the plugin.
If you want to move it and your not afraid to get your hands dirty, just ask in the forum and I'll explain how.

-----------------------------------------------
Title: Re: Integrating with another sim
Post by: Uriah on July 16, 2016, 12:09:58 pm
Awesome thanks! I'm testing now  :D

I can help make simple user interface for this plugin. Once I get a handle on what you are doing and how it works I'll have a better idea of what it needs. We can put all the configuration stuff into an options menu, possibly host/join server too.

Also, you should be able to wrap the function siliconsky_send_pos_rot in C++ by getting the entered instance to avoid JS altogether, therefore being able to select spawn any aircraft at one of a number of pre-defined start positions from a menu. I am pretty sure that function is the only difference in these scripts correct?

Quote
What's needed now is a bit of a 'plan'.

Let's make a plan and move this thing forward!  8)

Regards,
Uriah
Title: Re: Integrating with another sim
Post by: SilentEagle on July 27, 2016, 10:37:18 am
I am extremely interested in the developments I have read in this thread in the last two years since I last saw the limited API.  I have written my own simulator (https://simdeveloper.wordpress.com/projects/#FlightSpaceSimulator) that can run independently from OT, just like FSX does, and it can also provide object positions and time of day.  It uses the RakNet library for networking, but it is very WIP at the moment.  I see that we cannot spawn or despawn objects with the API, but I'd still like to move forward with attempting what you have accomplished langdon.  Is your source code for the plugin available or could a few examples set me in the right direction?
Title: Re: Integrating with another sim
Post by: t0m on August 05, 2016, 04:53:41 am
Hi,
i'm trying to compile the ot-api.zip file from this thread with VC2012 under windows 7 ultimate 64bit (changed the platform toolset to v110 , resp. v110_xp). 

The include path in this zip under glm is empty and so i get a missing glm.hpp error. I tried to copy the directory tree from glm project version 0.9.7.4 and 0.9.7.6 (see https://github.com/g-truc/glm/releases) to this include directory but get a lot of compiling errors.

Can anyone give me a hint how to compile the solution inside ot-api ?

Thanks,
Tom
Title: Re: Integrating with another sim
Post by: cameni on August 05, 2016, 05:47:38 am
I reuploaded the zip - not sure how the glm got lost from there.
Title: Re: Integrating with another sim
Post by: DenisJ on August 08, 2016, 03:15:39 pm
I downloaded version 0.3, getting weird black spots on water which linger even after moving the plugin folder from Outerra directory. Also trees become weird, but this can be fixed by turning the plugin off.

(http://i.imgur.com/LuUrwzy.jpg)

(http://i.imgur.com/MtcWUgR.jpg)

UPD: Alright, disregard that, all fixed for now. Not sure what it was, probably some other program affected Outerra, which happens sometimes.
Title: Re: Integrating with another sim
Post by: Uriah on August 11, 2016, 07:09:48 pm
I have this happen too every so often, and I am running the plugin, but hadn't seen anyone else reproduce it yet. Could be the plugin doing something in IGC. Will have to look into it. Please let me know if it ever happens and you are NOT running the plugin!  ;)

Regards,
Uriah
Title: Re: Integrating with another sim
Post by: andfly on August 12, 2016, 09:00:33 pm
Please let me know if it ever happens and you are NOT running the plugin!  ;)

Regards,
Uriah

Immediately take advantage of your offer of help ...

I am days that I feel ... but I can not run the plugin!

I put in all ways ...
Outerra / Anteworld / plugins / siliconsky / siliconsky_plugin.dll, etc ..
Outerra / Anteworld / plugins / siliconsky_plugin.dll, etc ..

Loading the program fails during the "Initializing the world" and return to Windows.
It happens regardless of whether you are using the vers.01 (only weather) or vers.02 (with multiplayer).

I tried reading in eng.log files if I could find some explanation, but ... I'm not experienced enough: I find no error message or an obvious justification for the failure.

Just a curiosity: during the many tests I noticed that the interruption time is not EXACTLY the same even if it takes roughly the same time.
The eng.log file becomes more and about 3000 lines but not always the same: sometimes stops a few lines before and sometimes after a few lines continues ...

Needless to say, if I remove the plugin, it all comes back to work perfectly!

I enclose a link to a eng.log obtained from one of these boots.

https://drive.google.com/file/d/0B6114pZ3kPTgZnFFdUg2QW94czQ/view?usp=sharing

Can you help me ?

(I ... I MUST be able to use this plugin!    :'( :'( :'( )
Title: Re: Integrating with another sim
Post by: Uriah on August 15, 2016, 04:25:18 am
Langdon is working on a new version using RakNet, and prior versions are incompatible currently.

Regards,
Uriah
Title: Re: Integrating with another sim
Post by: andfly on August 15, 2016, 08:53:14 am
Langdon is working on a new version using RakNet, and prior versions are incompatible currently.

Thanks Uriah, ( and ... thanks Langdon !!! )
I'll wait.