Round Earth in Openttd

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
agentw4b
Traffic Manager
Traffic Manager
Posts: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Round Earth in Openttd

Post by agentw4b » 24 Dec 2017 16:22

Do somebody repair a game for a round Earth please :-)

Just the train when it arrives at the edge of the map, appears on the other side.
Owner and admin of servers:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 697
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Round Earth in Openttd

Post by Gwyd » 24 Dec 2017 16:59

This is a very interesting concept, but I think it'd be more useful if you could go between/link maps

Transportman
Tycoon
Tycoon
Posts: 2690
Joined: 22 Feb 2011 18:34

Re: Round Earth in Openttd

Post by Transportman » 24 Dec 2017 21:47

Gwyd wrote:This is a very interesting concept, but I think it'd be more useful if you could go between/link maps
You could play on a bigger map and have the same result. Linking maps while keeping them separate is not possible, as calculations would still need to be done for both maps (although drawing and stuff is not needed for one of them).

I do recall that there is a patch or NewGRF that would create industries at the map edge where you could drop all cargoes and get all cargoes back, mimicking such a link.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML

User avatar
kamnet
Moderator
Moderator
Posts: 6766
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Round Earth in Openttd

Post by kamnet » 26 Dec 2017 14:15

Design your maps or scenarios using polar projection? :)

agentw4b
Traffic Manager
Traffic Manager
Posts: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Round Earth in Openttd

Post by agentw4b » 26 Dec 2017 18:20

kamnet wrote:Design your maps or scenarios using polar projection? :)

Earth is Flat ? :?:
Owner and admin of servers:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

User avatar
Drury
Tycoon
Tycoon
Posts: 2151
Joined: 09 Dec 2008 16:20
Skype: yes
Location: Slovakia
Contact:

Re: Round Earth in Openttd

Post by Drury » 26 Dec 2017 23:08

agentw4b wrote:
kamnet wrote:Design your maps or scenarios using polar projection? :)

Earth is Flat ? :?:
Yes ! :!:
Attachments
N0m7OHA.jpg
(62.83 KiB) Not downloaded yet
Image

Only dumb people quote themselves, and only the truest retards put such quotes in their forum signatures
-Drury

agentw4b
Traffic Manager
Traffic Manager
Posts: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Round Earth in Openttd

Post by agentw4b » 31 Dec 2017 16:28

Drury wrote:
agentw4b wrote:
kamnet wrote:Design your maps or scenarios using polar projection? :)

Earth is Flat ? :?:
Yes ! :!:

I made it .
viewtopic.php?f=60&t=82397
Owner and admin of servers:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

User avatar
Redirect Left
Tycoon
Tycoon
Posts: 6578
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Round Earth in Openttd

Post by Redirect Left » 31 Dec 2017 19:40

agentw4b wrote: Just the train when it arrives at the edge of the map, appears on the other side.
That'd be an interesting way to play. Certainly should be possible (with a lot of editing / patching). Although you'd need to make sure you had tracks setup at the other side of the map. It'd be hard to make sure you have properly aligned tracks at the other side of the map.
Image
Worst Behaved IRC Member of 2008, 2009 & 2010 - Go Me!

User avatar
Leanden
Tycoon
Tycoon
Posts: 2621
Joined: 19 Mar 2009 19:25
Location: Kent

Re: Round Earth in Openttd

Post by Leanden » 31 Dec 2017 21:48

Getting track/roads to match either side would be the simple part.

Rewriting the pathfinder to crossover the map edges to the other side would be the challenge
Image

User avatar
Redirect Left
Tycoon
Tycoon
Posts: 6578
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Round Earth in Openttd

Post by Redirect Left » 01 Jan 2018 00:23

Leanden wrote: Rewriting the pathfinder to crossover the map edges to the other side would be the challenge
Hmm. Would probably require a pathfinder specifically wrote for this purpose, clone another one then edit it to your needs. Not sure it'd work with a normal 'earth' in openTTD after modification, with any sort of efficiency.
Image
Worst Behaved IRC Member of 2008, 2009 & 2010 - Go Me!

User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 697
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Round Earth in Openttd

Post by Gwyd » 01 Jan 2018 02:40

What if the map actually wrapped around, so at the left, the right would start again. This would mean old pathfinders work... Maybe. This is why I dont do patches.

User avatar
Redirect Left
Tycoon
Tycoon
Posts: 6578
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Round Earth in Openttd

Post by Redirect Left » 01 Jan 2018 04:52

Gwyd wrote:What if the map actually wrapped around, so at the left, the right would start again. This would mean old pathfinders work... Maybe. This is why I dont do patches.
I suspect that'd be more patching than just making the train appear at the other side, more graphic stuff in my experience takes more work.
Image
Worst Behaved IRC Member of 2008, 2009 & 2010 - Go Me!

User avatar
Drury
Tycoon
Tycoon
Posts: 2151
Joined: 09 Dec 2008 16:20
Skype: yes
Location: Slovakia
Contact:

Re: Round Earth in Openttd

Post by Drury » 01 Jan 2018 05:17

Gwyd wrote:What if the map actually wrapped around, so at the left, the right would start again. This would mean old pathfinders work... Maybe. This is why I dont do patches.
When you see this done in a game (like in Civilization games), what they actually do is just have a regular rectangular map and teleport things from one side to the other at the edges (which is the original suggestion anyways), it's just made to look seamless by rendering the edge bits from the other side when needed. There isn't really a magical way to have looping maps without this workaround.
Image

Only dumb people quote themselves, and only the truest retards put such quotes in their forum signatures
-Drury

agentw4b
Traffic Manager
Traffic Manager
Posts: 155
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: Round Earth in Openttd

Post by agentw4b » 02 Jan 2018 10:24

Round Earth should, of course, only be one of the choices. If you can do this, it will be great.:-)
Owner and admin of servers:Experimental games 01 (92.63.57.152:3979), Experimental games 02 (92.63.57.152:3879), Experimental games 03 (92.63.57.152:3779), Experimental games 04 (92.63.57.152:3679), Experimental games 05 (92.63.57.152:3579).
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS

raidho36
Engineer
Engineer
Posts: 3
Joined: 05 Apr 2017 02:26

Re: Round Earth in Openttd

Post by raidho36 » 25 Jan 2018 00:10

Redirect Left wrote:
Leanden wrote: Rewriting the pathfinder to crossover the map edges to the other side would be the challenge
Hmm. Would probably require a pathfinder specifically wrote for this purpose, clone another one then edit it to your needs. Not sure it'd work with a normal 'earth' in openTTD after modification, with any sort of efficiency.
No it would literally require no modification. Pathfinder works over abstract graphs which don't care about space-time geometry, and a piece of rail going to the other side of the map over the edge is not in any way different from a piece of rail simply going from left to right in an ordinary fashion. Same logic applies to rails that loop over the edge of the map - loops are already well handled in ordinary maps.

GiaNN
Engineer
Engineer
Posts: 6
Joined: 29 Oct 2015 15:54

Re: Round Earth in Openttd

Post by GiaNN » 16 Mar 2018 16:48

raidho36 wrote:
Redirect Left wrote:
Leanden wrote: Rewriting the pathfinder to crossover the map edges to the other side would be the challenge
This is not at all complicated, I wrote it some years ago not for OpenTTD. All you need is the access of the map (be it read or write) to be wrapped in a function. The function translates any false coordinates to correct coordinates. Then make sure all scripts always use this function and everything rolls just fine without big changes of the core code, yet the game "world" becomes infinite beyond the edges.

if you request data for position X,Y and X and/or Y is a negative value exiting the map in the top or a larger than the map size number exiting in the bottom, than add or subtract the value from map size until a valid positive value is the result. depending on if the map is using 0,0 as first coordinate, or 1,1 doesn't matter for the concept. So for explaining and understanding, I now assume the first tile is identified as [1,1], in programming this more likely will be position 0,0.

hence, in the case we are using a map size 1024x1024:

requesting coordinate [-20,1300] (both X and Y are outside the map range) the function simply results in returning values for [1004,276]

or requesting coordinate [500,4000] (Y is outside the map but X is not) results in returning values for [500,928]
in the last example the value 4000 is 3 times outside the world so 3 times 1024 was subtracted.

or maybe more simple to understand assuming we again have a map size of 1024x1024 tiles:

requesting the coordinate [-1,-1] should result in accessing the data for [1023,1023] and requesting ccordinate [1025,1025] will result in accessing the data of [1,1]

In this virtually visualised example (not from OpenTTD), it works the same way, the lower corner is closer to the upper corner. the left corner is closer to the right corner.
Image

The pathfinder should now automatically find a shorter route to a location outside the map if that same location inside the map is further away.

Eddi
Tycoon
Tycoon
Posts: 7414
Joined: 17 Jan 2007 00:14

Re: Round Earth in Openttd

Post by Eddi » 23 Mar 2018 03:39

while this approach would generally work, you get two main problems here:
  1. the world you produce isn't actually "round" but "toroidal"
  2. the map generator is not equipped to make sure the map border is "smooth" enough to connect both sides, unless you force map edges to be water
and then you need to find all the places where it currently checks that it *doesn't* cross the map borders
You might not exactly be interested in Ferion, but if you are, have fun :)

Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 2 guests