Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Pages: 1 ... 3 4 [5]

Author Topic: INTERNATIONAL SPACE STATION  (Read 67282 times)

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: INTERNATIONAL SPACE STATION
« Reply #60 on: November 17, 2022, 05:18:54 pm »

Hi KW71,

Thank you!   :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: INTERNATIONAL SPACE STATION
« Reply #61 on: November 18, 2022, 04:55:09 pm »

Quote
by the way here is the HTML code snippet to get ISS position ..that you can use inside vehicle_config.html for instance of the tatra
Not only have I failed to include Curl in the plugin but I'm also unable to talk to a website or server...
The solution that I luckily found comes from the discovery of the formidable Dr. T.S.Kelso's CelesTrak site, created way back in 1985.
Perhaps precisely because of its longevity, the site can communicate satellite data by responding to a simple "Http Request" in addition to the more current "Https Request" (protected by SSL encryption) as required by almost all WEB sites...........

And now, as usual, I take the opportunity to ask the usual question ...
I think I've read that you can call an HTML file execution from a template script with any key combination...
How you do it ?
I only knew the "T" key method, which calls the configuration...

Hi andfly
yes I also do the Http request ...just I do it in javascript with the fetch function....which i learned from this fantastic  programming tutorials (see video below)
About the "usual question" I will answer you in the following days providing an example code that you can run and edit...because if I just post the code without testing it first it mught just result in wasting your time.
So I'll be back soon with news on this for you  ;)

 

« Last Edit: November 18, 2022, 04:57:28 pm by fly77 »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: INTERNATIONAL SPACE STATION
« Reply #62 on: November 19, 2022, 04:01:13 am »

Hi andfly
yes I also do the Http request ...just I do it in javascript with the fetch function....which i learned from this fantastic  programming tutorials (see video below)
About the "usual question" I will answer you in the following days providing an example code that you can run and edit...because if I just post the code without testing it first it mught just result in wasting your time.
So I'll be back soon with news on this for you  ;)

Thank you very much   :D
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: INTERNATIONAL SPACE STATION
« Reply #63 on: November 19, 2022, 09:37:03 am »

Hi andfly ! I got your http request code compiled and working !
I made it slightly more general so that you can pass any valid http URL to the plugin  .

The only downside is that it seems to take about 1 sec to get the data in the case of http://celestrak.org/NORAD/elements/gp.php?CATNR=25544&FORMAT=TLE
and during this time outerra freezes...will try if there are sites that have a faster http response.. Also I will find a way to do the same via the plugin for https requests ...such as
https://api.wheretheiss.at/v1/satellites/25544
which return json data, which is very convenient



Code: [Select]

header file
-----------
#pragma once
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#define WIN32_LEAN_AND_MEAN
#include <HTTPRequest.hpp>
#pragma comment(lib, "ws2_32.lib")


ifc_fn coid::charstr httpGETrequest(coid::charstr URL);

cpp file :
-------

ifc_fn coid::charstr simplugin::httpGETrequest(coid::charstr cURL) {
std::string v;
char* result = nullptr;
const char* cURL = URL.c_str();
// you can pass http::InternetProtocol::V6 to Request to make an IPv6 request
http::Request request{cURL };
const auto response = request.send("GET");
v = std::string{ response.body.begin(), response.body.end() }; //  the result
return v.c_str();
};



« Last Edit: November 19, 2022, 09:44:42 am by fly77 »
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: INTERNATIONAL SPACE STATION
« Reply #64 on: November 19, 2022, 09:49:20 am »

hmm actually the 1 sec or so time for the request seems to depend on the used   http request library  https://github.com/elnormous/HTTPRequest
since it happens also with other hhtp sites like for instance this simple test site   http://www.posttestserver.com/
That seems to me a long delay...will see if the same delay occurs with the fetch function from inside HTML but I had the impression its much faster..lets see
freezing outerra isn't really a choice for most applications.  :'(


« Last Edit: November 19, 2022, 09:53:00 am by fly77 »
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: INTERNATIONAL SPACE STATION
« Reply #65 on: November 19, 2022, 10:16:55 am »

tested the http request to my chat server  http://fly77-outerra-chat-server.glitch.me/  via the plugin and via the popup HTML page...
again with the plugin the usual freezing of outerra at each request happens..

while doing the same request via fetch from the HTML window every 2 secs...no freezing nor stuttering at all.

maybe using  a http library in the plugin means some windows calls are made and outerra freezes while windows does its thing...while when fetch is called from within the outerra HTML browser
no windows calls are made and so outerra doesn't need to wait for anything expect for the data to arrive.
I don't know.



« Last Edit: November 19, 2022, 10:48:36 am by fly77 »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: INTERNATIONAL SPACE STATION
« Reply #66 on: November 19, 2022, 08:20:01 pm »

Well, I share your disappointment
I chose this Http-Request project for its simplicity and ease of implementation with the plugin.
I hadn't even noticed the program pause waiting for the answer because it happened only once, when the model was installed, and when the additional models were loaded.
While waiting for the completion of the various loads and the positioning of the space station, a second block goes unnoticed.
But I was aware of it because this simple implementation of Http-Request acts in a "synchronous" way, that is, it waits for the completion of the operation before giving back control to the normal program flow.
To have a more performing performance, and not to notice that the call is taking place, you should look for a project that produces an "asynchronous" call.
This does not mean that the request for data takes place in a shorter time, only that, once the request is made, the control is immediately returned to the main flow of the program, the data is downloaded only when it becomes available and the user does not he notices all this "underground" work because the program shows no interruptions.
Ideal, famous and now ultra-tested, it would be the CURL project (it can work asynchronously and with SSL encryption) but we have found that it is not easy to include in the Outerra plugin.
Perhaps, with patience, another Http-Request project could be found that possesses these characteristics and is easier to implement ...

I take this opportunity to congratulate you on the speed of development of your Multiplayer project which is already beginning to produce tangible results.

Good work!   :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: INTERNATIONAL SPACE STATION
« Reply #67 on: November 20, 2022, 02:19:30 am »

Thanks andfly also for the appreciation and the clarification whats causing the http request delay. Yes curl would be a nice option. I will try again if I manage to get it working in the plugin. I've not forgotten your request about bringing up html menus with new action keys. I will respond when I'm ready
Logged
Pages: 1 ... 3 4 [5]