Freeform map edges (in trunk since 15190)

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
SirXavius
Transport Coordinator
Transport Coordinator
Posts: 302
Joined: 28 Jun 2006 18:25
Location: Florida

Re: Freeform map edges

Post by SirXavius » 14 Dec 2008 17:01

:bow: Damn, you young guys are pretty smart! It causes me to reminisce about my youth spent in front my Commodore PET, programming 4K programs in BASIC. And no one to know how good i was at it!! :lol:

I'm watching this thread with great interest, esp. in relation to its final Inclusion! Keep perfecting and expanding it!

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Freeform map edges

Post by Terkhen » 14 Dec 2008 19:34

I tried to patch it with TortoiseSVN (instead of msys patch command) and it worked fine. First time I need to do it, it's strange :? .

The patch is looking great. Good work! :D

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Freeform map edges

Post by Yexo » 14 Dec 2008 19:47

Terkhen wrote:I tried to patch it with TortoiseSVN (instead of msys patch command) and it worked fine. First time I need to do it, it's strange :? .

The patch is looking great. Good work! :D
Did you try v2 or v3? I just uploaded a new version to the first post.

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Freeform map edges

Post by Terkhen » 14 Dec 2008 21:55

I was trying v2. It's strange, but v3 gives the same error even when patched with TortoiseSVN. It compiles without problems in linux, but I can't understand why not with msys and mingw. Unfathomable errors like these ones make me ask myself why I even like computers to begin with :|

User avatar
stevenh
TTDPatch Developer
TTDPatch Developer
Posts: 759
Joined: 24 Jul 2005 05:07
Location: Canberra, Australia
Contact:

Re: Freeform map edges

Post by stevenh » 15 Dec 2008 04:27

I still don't understand how little changes like this can make such a big difference (in a good way)... This is an awesome patch and I love it.

Does this have any effect on the issues of building industries, etc... close to make edges? It would then make sense to me to lessen all those restrictions?

Well done Yexo, it's a great idea.

dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: Freeform map edges

Post by dihedral » 15 Dec 2008 06:33

i am really impressed - this is a very nice patch Yexo :-)
i just hope it is something the devs will like and perhaps see it one day in trunk - until then, lets do the best we can to get it ready for that!
personal suggestion would be a openttdcoop.dev game with it, to find as many bugs as we can - you know how that works, more eyes see more glitches :-P

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Freeform map edges

Post by Yexo » 15 Dec 2008 16:24

I'm happy so many of you like this patch :)
stevenh wrote:Does this have any effect on the issues of building industries, etc... close to make edges? It would then make sense to me to lessen all those restrictions?
I haven't changed any limits of building industries and I don't think changing those belong in this patch, as those limits can be changed by newgrf's.
dihedral wrote:personal suggestion would be a openttdcoop.dev game with it, to find as many bugs as we can - you know how that works, more eyes see more glitches :-P
I'd like it if we could organize that. As you say, more eyes spot more bugs :)

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Freeform map edges

Post by Terkhen » 16 Dec 2008 21:02

I managed to compile v4 (it was something weird with my MinGW installation :? ). This is looking great :D

Anyways: I found a bug while trying to do something stupid! :D
Attachments
Brendingbury Transport, 29th Feb 1960.png
Brendingbury Transport, 29th Feb 1960.png (41.8 KiB) Viewed 1972 times

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Freeform map edges

Post by Yexo » 16 Dec 2008 21:30

That's more of a feature ;)

Seriously, the only bug there is that the message is a bit odd, but that's already marked in the code as todo.

Tanoh
Engineer
Engineer
Posts: 14
Joined: 26 Sep 2008 14:37

Re: Freeform map edges

Post by Tanoh » 17 Dec 2008 15:11

Cool patch.

The edges look a bit weird though, maybe do as some other games and make doted lines along the edge that's too high.

Something like this (I'm no GIMP expert though. :lol: )
Attachments
dotted_lines.png
dotted_lines.png (11.32 KiB) Viewed 1834 times

michael blunck
Tycoon
Tycoon
Posts: 5269
Joined: 27 Apr 2005 07:09
Contact:

Re: Freeform map edges

Post by michael blunck » 17 Dec 2008 15:44

I like the edges as they are now (plain black), so it looks as if it´s a segment cutted out of the landscape. If you need a special border, why don´t stay with water? :P

regards
Michael
Image

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: Freeform map edges

Post by PhilSophus » 17 Dec 2008 15:58

michael blunck wrote:I like the edges as they are now (plain black), so it looks as if it´s a segment cutted out of the landscape. If you need a special border, why don´t stay with water? :P
I agree, having the (non-usable) map edges look like a continuation of the map makes only sense for water edges, IMHO.

Having the map edge look like a vertical cut through the underground, though, may look appealing, but may be hard to implement with the way how graphics output works in OpenTTD.

Just leaving it black, doesn't look that bad, either. Anything artificial, like dotted lines, definitely looks weird, IMHO.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Freeform map edges

Post by Progman » 17 Dec 2008 16:41

I used the Version v4 and got these warnings: (on amd64)

Code: Select all

/home/progman/openttd/trunk/src/heightmap.cpp: In function 'void FixSlopes()':
/home/progman/openttd/trunk/src/heightmap.cpp:400: warning: comparison between signed and unsigned integer expressions
/home/progman/openttd/trunk/src/heightmap.cpp:405: warning: comparison between signed and unsigned integer expressions
If you build a railtrack at the north-west edge it segfaults if some time is passes until the world generated fences at the railtrack.
fences.png
Segfault with fences
fences.png (6.01 KiB) Viewed 1786 times
And I'm not sure if it is a bug or feature but if you delete all water on the map by rising the map you don't get it back. Maybe it should come back if you lower the map at the edges (and maybe depending on the edge settings at map generation.)

Dont know if a drop-box with all 16 possibilites of water edges is a good way to select which edge should have waters and which not. Maybe there should be checkboxes/buttons to enable/disable water on this edge during map creation. There should also be a random setting.

If you play a big map (512^2) with flat, smooth land and the lowest water amount and without any water edges it happends that there are some small water lakes at the edges with an unrealistig amount of light houses.
lighthousesparty.png
A lot of light houses near edge lakes
lighthousesparty.png (27.87 KiB) Viewed 1803 times
If you have autorail activated and moves the mouse outside the map the autorail white track is jumping around the edge, it looks strange.

If you try to build a station at the south-east or south-west edge it shows a location which is not possible (don't know it it is in trunk too).
buildedge.png
Building a station at the south corner
buildedge.png (15.22 KiB) Viewed 1798 times
About the dotted lines at the south borders, I suggest only use borders for the sea level and for the corners itself, maybe in gray or brown. So you can easily see how height the tiles at the edges are.

If you generate a subtropic map, it asserts with:

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:193: TropicZone GetTropicZone(TileIndex): Assertion `tile < MapSize()' failed.
(depending on the edge setting)

You cannot build industries at the north edges, you must have a space of 2 tiles, but this restriction is dropped for industries at the south edges.

Build a harbor at one of a north edge and it asserts with the following message if you try to delete it again:

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:70: TileType GetTileType(TileIndex): Assertion `tile < MapSize()' failed.
It also asserts with this error message if you build the harbor one tile away of the (north) edge and pointing to the edge (so the ships cannot reach the harbor).

Bug or Feature: You cannot build a depot at the edge pointing to the edge.
Last edited by Progman on 17 Dec 2008 17:04, edited 1 time in total.

User avatar
Zephyris
Tycoon
Tycoon
Posts: 2826
Joined: 16 May 2007 16:59

Re: Freeform map edges

Post by Zephyris » 17 Dec 2008 16:55

As a related patch I think it will be important to revise lighthouse and oil rig placement, prehaps putting them only in/on the edge of "large" pieces of water, though I'm not sure what algorithm you could use to do this...

Progman
Engineer
Engineer
Posts: 76
Joined: 15 Jul 2006 12:55
Contact:

Re: Freeform map edges

Post by Progman » 17 Dec 2008 17:34

And another bug: If you place a town (3x3 road layout) in the scenario editor near the edge and increase the size it sometimes asserts (depending on start location of the town):

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:70: TileType GetTileType(TileIndex): Assertion `tile < MapSize()' failed

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Freeform map edges

Post by Yexo » 18 Dec 2008 00:50

Progman wrote:I used the Version v4
Thanks a lot for testing it.
and got these warnings: (on amd64)

Code: Select all

/home/progman/openttd/trunk/src/heightmap.cpp: In function 'void FixSlopes()':
/home/progman/openttd/trunk/src/heightmap.cpp:400: warning: comparison between signed and unsigned integer expressions
/home/progman/openttd/trunk/src/heightmap.cpp:405: warning: comparison between signed and unsigned integer expressions
Fixed.
If you build a railtrack at the north-west edge it segfaults if some time is passes until the world generated fences at the railtrack.
I think I already fixed this, most likely just after I uploaded v4.
And I'm not sure if it is a bug or feature but if you delete all water on the map by rising the map you don't get it back. Maybe it should come back if you lower the map at the edges (and maybe depending on the edge settings at map generation.)
I'm not sure what the expected behavior is in this case. Normally water is only restored by flooding from neighbouring tiles, but as soon as there are no tiles with water left this is a problem. Other opinions on the best solution here?
Dont know if a drop-box with all 16 possibilites of water edges is a good way to select which edge should have waters and which not. Maybe there should be checkboxes/buttons to enable/disable water on this edge during map creation. There should also be a random setting.
I'll add a random setting. Again, I'm not sure on the best solution here. 16 items for the dropdown box may be a bit much, but I don't like to split it into 4 checkboxes either.
If you play a big map (512^2) with flat, smooth land and the lowest water amount and without any water edges it happends that there are some small water lakes at the edges with an unrealistig amount of light houses.
I've changed the lighthouse building so lighthouses are only build near an edge with water (also if there is only a little bit water), but the total number of lighthouses also needs to be reduced. I'll see what I can do here.
If you have autorail activated and moves the mouse outside the map the autorail white track is jumping around the edge, it looks strange.
Same behavior can be seen in trunk.
If you try to build a station at the south-east or south-west edge it shows a location which is not possible (don't know it it is in trunk too).
Same in trunk, so this can be reported to FS.
About the dotted lines at the south borders, I suggest only use borders for the sea level and for the corners itself, maybe in gray or brown. So you can easily see how height the tiles at the edges are.
For now I'll just leave the plain black. I don't like the dotted lines for the whole border, but maybe drawing foundations would be better.
If you generate a subtropic map, it asserts with:

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:193: TropicZone GetTropicZone(TileIndex): Assertion `tile < MapSize()' failed.
(depending on the edge setting)
Fixed
You cannot build industries at the north edges, you must have a space of 2 tiles, but this restriction is dropped for industries at the south edges.
Fixed
Build a harbor at one of a north edge and it asserts with the following message if you try to delete it again:

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:70: TileType GetTileType(TileIndex): Assertion `tile < MapSize()' failed.
It also asserts with this error message if you build the harbor one tile away of the (north) edge and pointing to the edge (so the ships cannot reach the harbor).
Both fixed.
Bug or Feature: You cannot build a depot at the edge pointing to the edge.
Feature :)
Progman wrote:And another bug: If you place a town (3x3 road layout) in the scenario editor near the edge and increase the size it sometimes asserts (depending on start location of the town):

Code: Select all

openttd: /home/progman/openttd/trunk/src/tile_map.h:70: TileType GetTileType(TileIndex): Assertion `tile < MapSize()' failed
Fixed.


I've uploaded the new version the to first post. Still todo:
- South edges:
1) Keep them black
2) Draw lines
3) Change the black to foundations (or something that looks like that)
- Add a random option for the border that'll be water.
- Reduce the amount of lighthouses build when there is not so much water at the borders.

SmatZ
OpenTTD Developer
OpenTTD Developer
Posts: 351
Joined: 03 Oct 2006 18:26
Location: Prague, Czech Republic
Contact:

Re: Freeform map edges

Post by SmatZ » 18 Dec 2008 01:21

Yexo wrote:
And I'm not sure if it is a bug or feature but if you delete all water on the map by rising the map you don't get it back. Maybe it should come back if you lower the map at the edges (and maybe depending on the edge settings at map generation.)
I'm not sure what the expected behavior is in this case. Normally water is only restored by flooding from neighbouring tiles, but as soon as there are no tiles with water left this is a problem. Other opinions on the best solution here?
I like that behaviour Progman suggested. It behaves the same in SimCity 2000 (IIRC).

Is there any reason for keeping MP_VOID tiles?
Image

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

Re: Freeform map edges

Post by Yexo » 18 Dec 2008 01:43

SmatZ wrote:
Yexo wrote:
And I'm not sure if it is a bug or feature but if you delete all water on the map by rising the map you don't get it back. Maybe it should come back if you lower the map at the edges (and maybe depending on the edge settings at map generation.)
I'm not sure what the expected behavior is in this case. Normally water is only restored by flooding from neighbouring tiles, but as soon as there are no tiles with water left this is a problem. Other opinions on the best solution here?
I like that behaviour Progman suggested. It behaves the same in SimCity 2000 (IIRC).
So all tiles at the map edges that are flat at height 0 should be flooded? I'll try to implement that tomorrow.
Is there any reason for keeping MP_VOID tiles?
Yes, it's the most simple way for detecting map edges: basically if IsValidTile(tile + TileXY(-1/0/1, -1/0/1)) fails you're at an edge. It may be possible to remove them but I think that's not worth the effort (and totally outside the scope of this patch).

User avatar
Zephyris
Tycoon
Tycoon
Posts: 2826
Joined: 16 May 2007 16:59

Re: Freeform map edges (v5)

Post by Zephyris » 18 Dec 2008 11:45

I like the idea of foundation-like graphics at the edge, but some dedicated "earthy" foundation graphics would also be nice, would you like me to draw some :) ?

User avatar
nicfer
Director
Director
Posts: 529
Joined: 03 May 2005 20:50
Location: Somewhere in a country called Argentina

Re: Freeform map edges (v5)

Post by nicfer » 18 Dec 2008 12:29

How about using the temperate slope foundations? They would not look that bad and there would be no work on graphics side.
Sorry for my english I am argentinian
TTO don't crashes in Windows XP; XP crashes TTO

Formerly known as UnderBuilder.

MyMiniCity

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests