phpvms icon indicating copy to clipboard operation
phpvms copied to clipboard

Custom "Universe"? support.

Open ajh123 opened this issue 1 year ago • 6 comments

Is your feature request related to a problem? Please describe. Some virtual airlines may be based on non-earth worlds. This could be like other planets like Mars or other game worlds. A custom "Universe" (probably needs a better name) could be used to allow these.

Describe the solution you'd like A custom "Universe" will hold information like maps/weather sources, countries, currencies, fuels. Maybe they could add extra languages on top of the base ones. Modules (addons) can define their own "Universes" similar to how Awards can be. By default there will be the "Earth" one.

When dealing with maps the "Universe" will have access to the Leaflet.js instance so they can add their own layers, so they can be compatible with wherever they get their data from. The "Universe" could return custom countries / currencies, fuels as a list.

The admin of the site can choose which "Universes" they want enabled. This will combine the data from the enabled "Universes". On the map view a Layers control will be visible to allow the user to change their "Universe" (if there is more than one enabled).

Finally, there needs to be a way to safely migrate data from a non-"Universes" setup to an "Universes" setup.

Describe alternatives you've considered Diving into each appropriate PHP file and manually changing variables, external API URLs, map sources, ... ? This will have to be done anyway to implement the "Universe". The "Universe" will become a wrapper for this data. A "Universe" would be a simpler way to do this (once implemented).

Additional context I do know basic PHP so I can program some of this but we need to figure out the best way to do it.

ajh123 avatar Jun 09 '23 13:06 ajh123

Also I want to create a module similar to the ACARS one for the game (which is Minecraft with a planes mod) I'm using. How could I do that?

ajh123 avatar Jun 09 '23 15:06 ajh123

It's an interesting idea!

Regarding leaflet, you can change the layers yourself by modifying the template, so that might be covered. In terms of ACARS... does Minecraft have an API? I'm not familiar with it. There is a REST API in phpvms, so you'd need to build a client to get the data from Minecraft and then send it to the API

nabeelio avatar Jun 09 '23 16:06 nabeelio

It's an interesting idea!

Regarding leaflet, you can change the layers yourself by modifying the template, so that might be covered. In terms of ACARS... does Minecraft have an API? I'm not familiar with it. There is a REST API in phpvms, so you'd need to build a client to get the data from Minecraft and then send it to the API

On it's own Minecraft does not have an ACARS API but I can create a Minecraft mod which can gather the data in it's own way. Minecraft has a lot of Java methods which I could use (also I could use a Mixin to get information that does not have an API). Also what which REST API endpoints do you think that I need, it seems like most of them are GET requests? Edit: And for Leaflet it would be possible to do it already, but having an API which automatically loads the layers from modules would be a more simpler way to do it. Some layers might be more complicated like Dynmap in Minecraft, so playing with the JavaScript would get messy.

ajh123 avatar Jun 09 '23 16:06 ajh123

I haven't really documented the API for posting, but it's pretty straight forward... the endpoints are all in the routes and the inputs are in the app/http/requests service. I can tell you the flow/document them further if you end up trying to write something.

nabeelio avatar Jun 09 '23 18:06 nabeelio

I haven't really documented the API for posting, but it's pretty straight forward... the endpoints are all in the routes and the inputs are in the app/http/requests service. I can tell you the flow/document them further if you end up trying to write something.

That would be appreciated, as I will start the client mod once I know what I need.

ajh123 avatar Jun 09 '23 18:06 ajh123

I'm not sure I'll get time to document this on the docs site, but the full flow is in the unit tests: https://github.com/nabeelio/phpvms/blob/dev/tests/AcarsTest.php#L440

Basically you call prefile. you can add the route Then update to put it into a flying state. Then you can send position updates/update fields. Or send log lines (like light on or something)

nabeelio avatar Jun 12 '23 15:06 nabeelio