thombruce / verse

šŸš€ A universe in progress
Other
8 stars 0 forks source link

Planetary Surfaces #66

Open thombruce opened 10 months ago

thombruce commented 10 months ago

This is a ways off, but I've been thinking about it a fair bit. Related: #33, #12.

In particular, I've been thinking about Earth and how to handle the shape of the planet. Since we're working in 2D, we're limited in how we represent the world and our best approach is going to be to represent the planet surface as a rectangle (parallel sides and opposite sides of equal length).

Seen from space, the planets should still be circles. We can create this illusion with masking, perhaps with some distortion, and we will definitely be thinking about animating the planetary surface as though the surface were rotating. Essentially we move the rectangular projection left or right and repeat it, as if it were rotating around a cylinder.

That's all simple stuff... (hubristic nemesis on this one is a long time from now).

What's more complicated is picking a projection (particularly for the Earth) and mapping it out so that it is traversable not just east-west (a cylinder) nor repeating in the north-south direction (a torus) but having it such that the cardinal directions are switched when you travel over the pole.

You should be able to travel North, head over the pole and... begin heading South down the opposite side of the planet.

So, assume the entire surface of the planet is a single tile. I'm thinking about a system like this:

mercator-projection-tiles

The above uses the Mercator projection (not a final decision) but it illustrates my meaning. Travel north through Europe and over the pole and you will continue heading south through Russia and towards Australia. Each row of tiles is rotated 180 degrees and offset by half the distance of the whole...

I still don't know how we'll do this, but it sounds achievable, right?

The same will be done for Mars, the Moon, Mercury, any other local planets and moons we've mapped and we'll do the same for procedurally generated planets too.

The poles are infinitely larger than they're supposed to be, and the Mercator projection has some biasing in favour of conformal lines rather than equal-area. Alternative projections do exist: https://en.wikipedia.org/wiki/List_of_map_projections

When picking a projection, be sure to determine whether conformality is required in our maths (in which case, probably Web Mercator is best) or whether or not an equal-area or compromise map would suffice and be better representative of scales.

thombruce commented 10 months ago

One of the funny consequences of the layout I've suggested above is this...

Imagine you're standing near the "pole". You have two options:

  1. Walk over the pole - it's only a few tiles to get where you're going
  2. Walk parallel to the pole - the same destination is half the width of the planet away!

This is the consequence of any cylindrical projection that maps the world from the equator. And I'm pretty sure it's unavoidable for the kind of tiled world design I'm aiming for. Distances just become unrealistic and massively distorted as you get closer to the pole. That one location can be both a little hop away, and also many many miles.

thombruce commented 10 months ago

Projections I'm currently considering:

I wish I could say that any of the equal-area projections satisfy me, but they don't. They result in a sort of elongation of non-equatorial countries, whereby their distance North to South is entirely disproportional to their breadth East to West.

thombruce commented 10 months ago

I think the two main projections under consideration are:

The Equirectangular in particular is just shouting at me that it is perfect for my use case... equally sized tiles. That's precisely what I'm after, right?

Of course distances will be skewed, should we have need to give the distance to/from a place on the map, but... that's largely gonna go unnoticed, and if we're really so concerned about it... well, it is possible to calculate distances on a globe instead and give those (but then it's inconsistent dependent on your distance from the equator šŸ¤·ā€ā™‚ļø).

Since the world I'm intending to build is not full scale anyway, I don't think it matters if the distances are wildly off.

Especially as... this isn't an Earth-based game. I am just thinking about making the Earth a landable, explorable place is all.

thombruce commented 9 months ago

Just re-examining my map proposal. Let's make a note of this:

Screenshot 2023-11-25 113916

Though the alignment is correct towards the middle (GMT) and the edges of each grid tile, it is off at the 25% margins by... well, half the circumference of the planet. If you travel north out of Russia, you come out travelling south straight back through it.

Not what we want.

This can be corrected by also mirroring the image when it is flipped 180 degrees, however this would result in the player entering a sort of mirror version of the planet where East and West are inverted.

And that can be corrected by... teleporting the player to the appropriate location on a true map, and hiding the magic. This only works if we're very zoomed in, which the player ought to be if they're wandering on foot or by car... but what about by aircraft or spaceship? For that we might need to work with a spherical projection... šŸ¤”