Cylindrical / spherical / torus maps
Moderator: ickputzdirwech
Cylindrical / spherical / torus maps
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.
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.
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Cylindrical / spherical / torus maps
A sphere can't be evenly divided into squares ^^
Money might be the root of all evil, but ignorance is the heart.
Re: Cylindrical / spherical / torus maps
As said:
mrvn wrote:Given that tiles are squares there can't be just one north pole tile.
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Cylindrical / spherical / torus maps
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.
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.
Re: Cylindrical / spherical / torus maps
This has been a couple of times (including once by me ). 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
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
Re: Cylindrical / spherical / torus maps
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Cylindrical / spherical / torus maps
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.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.
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.
- MalcolmCooks
- Filter Inserter
- Posts: 253
- Joined: Mon Apr 06, 2015 8:32 pm
- Contact:
Re: Cylindrical / spherical / torus maps
Okay, I see how that would work, but I think that behaviour would be confusing.
Re: Cylindrical / spherical / torus maps
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.
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.
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Cylindrical / spherical / torus maps
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.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.
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.
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.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.
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.
Re: Cylindrical / spherical / torus maps
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.
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.
Re: Cylindrical / spherical / torus maps
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.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.
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.
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Cylindrical / spherical / torus maps
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.
Re: Cylindrical / spherical / torus maps
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!).Deadly-Bagel wrote:a TON of development, and would likely introduce a thousand quirky logic bugs
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
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Cylindrical / spherical / torus maps
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.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.
Re: Cylindrical / spherical / torus maps
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.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.
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.
Re: Cylindrical / spherical / torus maps
There is no in- or outside. The current map is by default "endless". If you define 2000 kilometers in each direction endless.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.
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Cylindrical / spherical / torus maps
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 ^^
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.
Re: Cylindrical / spherical / torus maps
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...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Cylindrical / spherical / torus maps
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.
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.