Cylindrical / spherical / torus maps

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Cylindrical / spherical / torus maps

Post by mrvn »

When playing a fixed size map it would be cool if one could choose to connect one end of the map to the opposite side.

For example in a O'Neil Cylinder or Nievens Ringworld the west and east side of the map would be connected. Similar north and south could be connected (same thing just 90° rotated). This should be relatively trivial to implement since all it needs is to use map coordinates modulo size.

Connecting both west-east and north-south would give a torus or donut world. While I can't think of a way to build something like that in our universe they still are fun to play on. Having the above would allow donuts simply by selecting to connect both directions at the same time.

A much more involved change would be to allow spherical worlds. Given that tiles are squares there can't be just one north pole tile. But if you go north enough you suddenly end up going south half a turn around the world, which means all the buildings would be 180° rotated. Trying to visualize this might seem very wrong until you consider that projected onto a sphere the tiles around the poles would be compressed smaller and smaller but one could ignore that. Tiles are tiles and always the same size, you aren't viewing the map as a sphere after all.


Now imagine the fun of having a train that goes around the world. There could be an achievement for that. :)

A second feature on top of this could be to have more realistic night/day. On a sphere half the world is in shadow. On Nievens Ringworld there where shutters around the sun giving a night/day cycle with multiple bands around the ring.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Deadly-Bagel »

A sphere can't be evenly divided into squares ^^
Money might be the root of all evil, but ignorance is the heart.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by mrvn »

As said:
mrvn wrote:Given that tiles are squares there can't be just one north pole tile.
User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by MalcolmCooks »

It's not just that, there is no way that you can represent the surface of a sphere with a square grid and have it make sense. You will end up with grid lines that should be parrallel meeting each other at right angles.
That's why torus-shaped worlds are so ubiquitous in video games; they can be perfectly represented and the continuous surface feels like a spherical world.
IV 
Inserter
Inserter
Posts: 46
Joined: Thu Oct 27, 2016 2:16 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by IV  »

This has been a couple of times (including once by me :P ). The possible shapes are a torus, a cylinder and a Klein bottle. I have included the links that I could find. The second one makes a valid point: this could add a better way of balancing placement in a MP game. I would like to see such a feature.

viewtopic.php?f=3&t=28749&p=182611#p182591
viewtopic.php?f=38&t=33913&p=214920#p214920
viewtopic.php?f=6&t=37230&p=224824#p224824
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by ssilk »

Thanks for the links. I created a new list: viewtopic.php?f=80&t=38288 Karnaugh maping (Torroid, Sphere, Cylinder, Klein-Bottle)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by mrvn »

MalcolmCooks wrote:It's not just that, there is no way that you can represent the surface of a sphere with a square grid and have it make sense. You will end up with grid lines that should be parrallel meeting each other at right angles.
That's why torus-shaped worlds are so ubiquitous in video games; they can be perfectly represented and the continuous surface feels like a spherical world.
Yes, it breaks down at the poles. But you can plaster a sphere with (distorted) squares if you leave a tiny hole at the poles itself. The closer to the poles you get the more squished the squares are. But only if you draw them on a sphere while we draw them laid flat. Now imagine you leave a gap between the squares and moving from square to square jumps over that gap. Also the gap is exactly at the poles. Now the tiny hole you had to leave at the poles itself disapears since it's the gap. Moving towards the pole will jump over the pole and end up on a square on the opposite side of the sphere.

In game math terms if you are on tile (0, 0) and you go north you end up on tile (width/2, 0) but the tile is 180° rotated. Go north again and you are at (width/2, 1). So the player position needs (x, y, alpha) where alpha is 0° or 180°. I know it's not really a spherical map since tiles around the pole should be squished but hey, it's a game. It doesn't have to make perfect sense in the real world.
User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by MalcolmCooks »

Okay, I see how that would work, but I think that behaviour would be confusing.
Shiandow
Inserter
Inserter
Posts: 20
Joined: Sun Jul 03, 2016 1:50 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Shiandow »

An easier way to represent a sphere would be to divide the world up into big squares like this, and glue the correct edges together to make it into a cube. You do end up with a somewhat weird situation on the corners though, so it's not as simple as the torus. That said there's no curvature and each cell has four well defined neighbours.

You can make a similar construction for any other surface, although obviously it will only be topologically equivalent so things like distances, angles and curvature won't necessarily make sense.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Deadly-Bagel »

mrvn wrote:Yes, it breaks down at the poles. But you can plaster a sphere with (distorted) squares if you leave a tiny hole at the poles itself. The closer to the poles you get the more squished the squares are. But only if you draw them on a sphere while we draw them laid flat. Now imagine you leave a gap between the squares and moving from square to square jumps over that gap. Also the gap is exactly at the poles. Now the tiny hole you had to leave at the poles itself disapears since it's the gap. Moving towards the pole will jump over the pole and end up on a square on the opposite side of the sphere.

In game math terms if you are on tile (0, 0) and you go north you end up on tile (width/2, 0) but the tile is 180° rotated. Go north again and you are at (width/2, 1). So the player position needs (x, y, alpha) where alpha is 0° or 180°. I know it's not really a spherical map since tiles around the pole should be squished but hey, it's a game. It doesn't have to make perfect sense in the real world.
Keep in mind that the game can't exactly be inverted. A lot of logic (especially fluid) is processed depending on direction. Also consider the many thousands of items that would need flipping to achieve this, and it would be disorienting. The only way to get back would be to cross a pole again.

If I understand correctly, this isn't a sphere per se but more of a cylinder. When you reach the top of the cylinder, it drops you on the other side, facing down so to speak.
Shiandow wrote:An easier way to represent a sphere would be to divide the world up into big squares like this, and glue the correct edges together to make it into a cube. You do end up with a somewhat weird situation on the corners though, so it's not as simple as the torus. That said there's no curvature and each cell has four well defined neighbours.

You can make a similar construction for any other surface, although obviously it will only be topologically equivalent so things like distances, angles and curvature won't necessarily make sense.
Cube won't work. Look at your image, and walk down onto one of the lower 'sides'. Then walk right, off the edge of the side and onto the next side. You would expect to enter from the left side of the tile BUT YOU'RE NOT, you're now on the bottom of a tile.

Rotation issues aside, this would make for some trippy gameplay. Say you build a huge horizontal factory, then go for some ore down south. Despite the fact you left your factory behind you, it's now also to your side.
Money might be the root of all evil, but ignorance is the heart.
User avatar
OdinYggd
Fast Inserter
Fast Inserter
Posts: 200
Joined: Wed May 25, 2016 12:55 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by OdinYggd »

A 2D circle or square could probably be achieved as a mod by teleporting anything to reach the last tile on the 'perimeter' of it over to the other side while preserving its orientation and momentum.

Almost every vehicle mod will be broken by this process though, and it would confuse more than a few players.

Cylindrical maps would work similarly- make a height-bound ribbon map, and whenever the player has gone too far one direction teleport them to the sign-flipped corresponding location.

But Spheres? Yuck, square grids can only approximate the shape and not in any sensible manner.
In my mind, Steam is the eternal king of the railway.
Shiandow
Inserter
Inserter
Posts: 20
Joined: Sun Jul 03, 2016 1:50 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Shiandow »

Deadly-Bagel wrote: Cube won't work. Look at your image, and walk down onto one of the lower 'sides'. Then walk right, off the edge of the side and onto the next side. You would expect to enter from the left side of the tile BUT YOU'RE NOT, you're now on the bottom of a tile.

Rotation issues aside, this would make for some trippy gameplay. Say you build a huge horizontal factory, then go for some ore down south. Despite the fact you left your factory behind you, it's now also to your side.
That's just how sphere's work. When you build a factory along the equator and go south then yes your factory is both behind you and to your side.

I agree that it would make for some trippy gameplay (and then we haven't even started on the corners, where 3 tiles meet at right angles) but I thought that was the point of making a 'sphere' world.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Deadly-Bagel »

Torus is the best method of implementation but I really don't see the point. It's a novelty that doesn't add any gameplay value, would require a TON of development, and would likely introduce a thousand quirky logic bugs, as well as screwing with any ideas for multithreaded tick updates (if that's happening).
Money might be the root of all evil, but ignorance is the heart.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by ssilk »

Deadly-Bagel wrote:a TON of development, and would likely introduce a thousand quirky logic bugs
Say you you make the size of the map 64x64. Or 2 x 2 chunks (The is this limitation: The map must be divideable by 32, cause otherwise you need to calculate with half chunks or so!).

So the game needs just 4 chunks: x0y0, x1y0, x0y1, x1y1.

What you see, when you start the game looks like so:

Code: Select all

   Y-Position
     |        -128    -96     -64     -32      0       32      64      96     128        ------> X Position
     V
  -128        x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0  
   -96        x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1
   -64        x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0
   -32        x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1
     0        x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0             <---- Displayed chunk
    32        x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1
    64        x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0
    96        x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1    x1y1    x0y1
   128        x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0    x1y0    x0y0
So, when you are at position X=0, Y=0 and go left, you are at postion X=-1 but you see and stand on the same chunk (x1y0) as X=63.
If you are at X=32, Y=95 and go down you are at position Y=96, but technically you are acting on the same chunk, as if you are standing on Y=-96 (x1y1).

So there are several things, that need to be changed, but mainly
- calculate chunk from position.
- calculate distance between two positions.
- eventually calculate real areas. For example: The radar covers an area of 100x100 but the real area is now only 64x64
- remove/replace such code that depends on, that (for example) 64,64 is more far away from center than 0,0.

And some more, but the number of functions, that needs to be changed/added can be counted and it should be possible to estimate the effort.
This is really simple implemented - compared to the gameplay-value for multiplayer.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by mrvn »

Shiandow wrote:An easier way to represent a sphere would be to divide the world up into big squares like this, and glue the correct edges together to make it into a cube. You do end up with a somewhat weird situation on the corners though, so it's not as simple as the torus. That said there's no curvature and each cell has four well defined neighbours.

You can make a similar construction for any other surface, although obviously it will only be topologically equivalent so things like distances, angles and curvature won't necessarily make sense.
Problem arise when a corner of the cube is visible since there 3 squares are connected in a circle instead of 4. You can't draw that without distorting. One trick I've seen in other games is to put water at those places to make them unreachable. So they never get drawn. The availability of landfill excludes that option.
mrvn
Smart Inserter
Smart Inserter
Posts: 5860
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by mrvn »

ssilk wrote:And some more, but the number of functions, that needs to be changed/added can be counted and it should be possible to estimate the effort.
This is really simple implemented - compared to the gameplay-value for multiplayer.
I think multiplayer maps generally can't be fair without this feature at all. Without it there will always be a huge difference between the players on the inside and players on the outside. With an unlimited map outside players have all the resources and with a limited map inside players have more enemies while outside players have sides that are protected by the end of the world.

Those limits mean you have to place all players in roughly a circle so everyone is an outside player and has the same number of enemies and distances to them. Which makes things predictable and thereby boring.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by ssilk »

mrvn wrote:With an unlimited map outside players have all the resources and with a limited map inside players have more enemies while outside players have sides that are protected by the end of the world.
There is no in- or outside. The current map is by default "endless". If you define 2000 kilometers in each direction endless.

The question you mean is definition of what is available at your spawn point: Currently the game generates only one.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Cylindrical / spherical / torus maps

Post by Deadly-Bagel »

I kind of get his point. Unless everyone spawns around an O shape, it will be unfair between those further from centre (who only have to fight on one or two fronts) and those closer to centre (who are fighting on all fronts). You could drive around but then it's much easier to get cut off. Those on the outside also can just drive further out for new resources and encounter no resistance, while anyone with enemy players all around must fight for every deposit.

So only fair way is to start in an O but once you work out where you are you know immediately where everyone else is.

In a looped world, everyone would spawn in roughly equal distances from each other but the layout can be totally random, everyone would be fighting on all fronts and it's nice and fair.

Okay I can see the merits of this, I don't play multiplayer so hadn't considered it ^^
Money might be the root of all evil, but ignorance is the heart.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by ssilk »

This gets off-topic. But wouldn't it be enough to ensure, that the average distance between all players is the same? With such a rule purely random start positions are not possible.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Cylindrical / spherical / torus maps

Post by bobingabout »

I remember playing Settlers (The original on the Amiga, though there was an MS-DOS version too for PC).

The map wrapped, so when you went off the left, you appeared at the right, when you went off the top, you appeared at the bottom. Basically, although the map was square (It actually used hexagons, so, rhombic, or an isometric square) you didn't actually know where the edges where, because it was designed with the wrap in mind.

Having more games that do this would be pretty cool.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Ideas and Suggestions”