Tmktahu / IPS

Repo for the Independent Positioning System for the game Starbase.
GNU General Public License v3.0
15 stars 1 forks source link

IPS - Transmitter Station Replacement #7

Open Tmktahu opened 3 years ago

Tmktahu commented 3 years ago

The transmitters for IPS are currently hardcoded, but in the future we may want to change them or even make them dynamic. I need to figure out if this is possible with the mathematical method I used to calculate coordinates.

Fang's Method has specific requirements regarding the first 3 transmitter stations.

Because of this, we can't just easily swap out transmitter coordinates and have it work. The fourth transmitter station is the easiest to swap out since its coordinates are calculated based on the first three. But even then, the 4th station coordinate requires a selection between 2 possible coordinates.

Swapping the first station is the big problem since it functions as the origin point of the coordinate grid. If you get too far from the first station, then you need to define a new origin point. And by defining a new origin point, you need to define the x-axis all over again, and the second station, and the third, ect. Plus the whole grid changes initial rotation.

While it is possible to automatically do all of these calculations, it would require professional chips. We may get them before we get transmitters, in which case we could theoretically make this whole process automatic. But it would be an extensive system.

A better way may be to do the calculations external to the game and then define different origin points and constants related to them. Then you would flip between origin points dynamically and offset the resulting coordinates to fit the grid as a whole. But, that whole system will be much too large to exist in IPS by itself. It will need to be a separate module dedicated towards managing the origin point and current constants.

TODO:

IronGremlin commented 3 years ago

Thoughts about dynamically switching transmitters:

Within the bounds of this paradigm, and ISAN's paradigm, dynamic station switching has some serious constraints.

Pre-recording multiple sets of origins and swapping between them starts to get somewhat untenable pretty quickly just due to YOLOL constraints - memory chips only have so many fields, and the world is very big. A memory chip per 10k kilometer sphere or so starts to get funky pretty fast, and the logistics of making that information available to users and encoding it in a way that let's them inject the module into their system starts to overrun the bounds of reasonable installation difficulty.

There's also just no real practical way to encode frequency and message per station as a matter of convention.

Either you need to express station names in terms of literal co-ordinates using somewhat regular spacing, and just give up on being implementation agnostic altogether, or you end up with some truly bizarre and unreadable message names purely due to the amount of information they'd need to encode about their positioning relative to other points in the names themselves, and there is no other way to communicate information to listeners.

So I think we're more or less forced into a system that can dynamically acquire transmitters and establish their position relative to known reference points.

Tmktahu commented 3 years ago

I hadn't even thought about the implications of frequency and message. Hard coding all that information does step into a ridiculous level of setup per region.

But I'm not sure dynamically acquiring transmitters is even possible. Through methods we have access to right now, you can't calculate a transmitter's coordinates with just the distance between transmitter and receiver. You need the distance between transmitters as well.

But, you might be able to do it via spherical coordinates. Theoretically you could use the ship's current orientation to define a plane and then use the transmitter's ability to rotate and search in specific directions to get the 2 angles necessary to define the coordinates of a transmitter station in spherical space. Then you could easily perform rotations on the spherical coordinates to bring the grid in line with the desired orientation, and then convert the spherical coordinates to euclidean.

But to do all that, you would first need to measure the ship's current pitch/yaw/roll relative to the correctly rotated grid. And we'd need professional chips of course.

And even after all that, I'm not sure I could take the newly calculated transmitter coordinates and plug them into Fang's Method. It would have to involve shifting the mathematical origin point, rotating the grid to match Fang's requirements, calculating and setting the required constants, and then calculating the required rotations to re-align the output coordinate grid with the desired coordinate grid.

It might be possible. But it would definitely require a large module to do. There would be calibration time involved and at least 3 memory chips for coordinate calculation constants + intermediary variable storage between scripts.

IronGremlin commented 3 years ago

So, I am fairly sure I am missing something really major here, but -

Dynamically acquiring an arbitrary shape of four points would be super hard, but swapping over to the same shape oriented the same way in a new location would use all the same math, wouldn't it?

Please stop me here if I am missing some fundamental piece of why this is hard, but it seems like you could save a lot of pain by just being very careful about how you constructed and placed the next set of transmitters.

Tmktahu commented 3 years ago

@IronGremlin yes you are correct. If transmitter stations were placed in groups of 4 that were identically spaced from each other and perfectly rotated to match the same orientation, then nearly all the math would be identical.

It is possible... but it would take some doing. I'd have to have help setting up stations and transmitters in the correct positions. Plus I would need a good number of people since it's probably going to be 1 transmitter per station. So with current station limits you would need 2 people to place enough stations.

Though, I am curious about more than 1 transmitter per station. If they allow it, I wonder if you could make a station 'wide' enough to get enough distance between 4 transmitters to work in the math. Receiver signal strength is in meters and goes down to the thousandth decimal. I wonder how close 4 transmitters could be to each other to provide solid coordinate calculation.