Freeform map edges (in trunk since 15190)
Moderator: OpenTTD Developers
Freeform map edges (in trunk since 15190)
The attached patch removes the need for the map edges to be water. You can raise the land / build on it what you want.
No known issues
If you have any suggestions / comments, please let me know.
Latest patch can be downloaded from http://bugs.openttd.org/task/2541
Edit: Fixed a lot of asserts that could happen when you let a train run towards a map edge. Also the map generator is updated so it generates landscapes with land at the borders now. Attached is a screenshot that show how it works and a windows binary.
Changes in r14668_v2:
- Incorporated SmatZ changes to fix the graphical glitch at the southern borders
- Fixed a bug where terragenesis could generate tiles with a height difference of 2 between two neighbouring corners.
- Added a gui option in the map generation window to choose what borders should be water and what borders should be land.
The binary is now v2, the zip still has the same name though.
Changes in r14675_v3:
- When loading a heightmap the border now depends on the heightmap instead of always water.
- Lighthouses are only build near water
- Stations can now be built at tile 0 without errors.
- Loading old (TTD) savegames was broken, now fixed again (thanks SmatZ)
Changes in r14677_v4:
- It was impossible to terraform south-border tiles in the scenario editor
- The white dot drawn when terraforming is now drawn at the correct height for the south-border tiles.
Changes in r14677_v5:
- Lots of bugfixes of bugs reported by Progman, see http://www.tt-forums.net/viewtopic.php?p=751289#p751289 for a complete list.
- Flat tiles at the map edge with height = 0 will get flooded (to prevent maps without any water at all).
Changes in r14577_v6:
- Removed a lot of IsValidTile checks and make GetTileType return MP_VOID for tiles > MapSize()
Changes in r14685_v7:
- Fixed segfault with fences on nw border.
Changes in r14772_v8:
- Tiles at the north edges will be MP_VOID when the patch is enabled.
- Removed lots of IsValidTile calls due to the previous change.
- New patch setting (under construction) to enable/disable terraforming the map edges.
- Known issue: small graphical glitch at the north edges.
- Removed the GetTileType hack introduced in v6.
Changes in r14840_v9:
- Enabling the setting in a running game would fail most of the time.
Changes in r14840_v10:
- Fix the graphical glitch at the north edges (SmatZ)
- A bit of cleanup (removing some unneeded IsValidTile checks)
See http://www.tt-forums.net/viewtopic.php?p=754862#p754862 for the latest patch (some fixes by SmatZ) and a windows/linux binary.
Changes:
- Fix an issue were you couldn't select tiles at the north border if they were raised more than a few height levels.
- Fix a crash if rails tiles went towards an edge of the map (introduced in v10).
Changes in v12:
- MP_VOID tiles could be seen as land for newgrf files (see r14415). (thanks SmatZ)
Changes in v13:
Update to r14905
minor cleanup
No known issues
If you have any suggestions / comments, please let me know.
Latest patch can be downloaded from http://bugs.openttd.org/task/2541
Edit: Fixed a lot of asserts that could happen when you let a train run towards a map edge. Also the map generator is updated so it generates landscapes with land at the borders now. Attached is a screenshot that show how it works and a windows binary.
Changes in r14668_v2:
- Incorporated SmatZ changes to fix the graphical glitch at the southern borders
- Fixed a bug where terragenesis could generate tiles with a height difference of 2 between two neighbouring corners.
- Added a gui option in the map generation window to choose what borders should be water and what borders should be land.
The binary is now v2, the zip still has the same name though.
Changes in r14675_v3:
- When loading a heightmap the border now depends on the heightmap instead of always water.
- Lighthouses are only build near water
- Stations can now be built at tile 0 without errors.
- Loading old (TTD) savegames was broken, now fixed again (thanks SmatZ)
Changes in r14677_v4:
- It was impossible to terraform south-border tiles in the scenario editor
- The white dot drawn when terraforming is now drawn at the correct height for the south-border tiles.
Changes in r14677_v5:
- Lots of bugfixes of bugs reported by Progman, see http://www.tt-forums.net/viewtopic.php?p=751289#p751289 for a complete list.
- Flat tiles at the map edge with height = 0 will get flooded (to prevent maps without any water at all).
Changes in r14577_v6:
- Removed a lot of IsValidTile checks and make GetTileType return MP_VOID for tiles > MapSize()
Changes in r14685_v7:
- Fixed segfault with fences on nw border.
Changes in r14772_v8:
- Tiles at the north edges will be MP_VOID when the patch is enabled.
- Removed lots of IsValidTile calls due to the previous change.
- New patch setting (under construction) to enable/disable terraforming the map edges.
- Known issue: small graphical glitch at the north edges.
- Removed the GetTileType hack introduced in v6.
Changes in r14840_v9:
- Enabling the setting in a running game would fail most of the time.
Changes in r14840_v10:
- Fix the graphical glitch at the north edges (SmatZ)
- A bit of cleanup (removing some unneeded IsValidTile checks)
See http://www.tt-forums.net/viewtopic.php?p=754862#p754862 for the latest patch (some fixes by SmatZ) and a windows/linux binary.
Changes:
- Fix an issue were you couldn't select tiles at the north border if they were raised more than a few height levels.
- Fix a crash if rails tiles went towards an edge of the map (introduced in v10).
Changes in v12:
- MP_VOID tiles could be seen as land for newgrf files (see r14415). (thanks SmatZ)
Changes in v13:
Update to r14905
minor cleanup
Last edited by Yexo on 21 Jan 2009 03:20, edited 24 times in total.
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Freeform map edges
Oh, this is great! Going to try it once I have some time. Did you modify the map generator too?
Re: Freeform map edges
I've not yet modified the map generator, but I'll definitely do that (if you don't do so first )
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Freeform map edges
If you want me to...Yexo wrote:I've not yet modified the map generator, but I'll definitely do that (if you don't do so first )
For TGen it is a little change in tgp.cpp...if I recall it well, all you have to do is commenting one or two function calls in terrain normalization function (it is called normalizeHeightmap or something like that).
Re: Freeform map edges
Patch updated. I've modified to the map generator, see http://www.tt-forums.net/download/file.php?id=102995
I've attached a windows binary to the first post.
I've attached a windows binary to the first post.
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Freeform map edges
Beautiful. OTTD terrain posibilities are now really leaping forward.
What about adding a select box into the map generator taht would activate this?
What about adding a select box into the map generator taht would activate this?
Re: Freeform map edges
Very nice, someone finally did it .
Re: Freeform map edges
How well bug tested is this? I thought some algorithms required a sea level edge square to prevent wraparound, or is there a special invisible square for this?
Re: Freeform map edges
IIRC on the bottom left and bottom right edges, there's a row of invisible tiles, but not on the top left and top right edge.
Re: Freeform map edges
Ah cool, should be ok then...
Re: Freeform map edges
I have tried the patch with the water edges grf, and it seems that there's a not drawn slope between the map tiles and the usually invisible edge tiles. Here's a screenshot:Yexo wrote:- You'll get graphical glitches if you raise any tiles at the south-east or south-west edge of the map. If there is anyone with an idea of how to solve this, be my guest. I don't know where to start
- Attachments
-
- Sin nombre, 1 Ene 1960.png
- (167.75 KiB) Downloaded 546 times
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
- CommanderZ
- Tycoon
- Posts: 1872
- Joined: 07 Apr 2008 18:29
- Location: Czech Republic
- Contact:
Re: Freeform map edges
I'm not really sure what the patch is supposed to do with the grf
-
- OpenTTD Developer
- Posts: 351
- Joined: 03 Oct 2006 18:26
- Location: Prague, Czech Republic
- Contact:
Re: Freeform map edges
Hello,
I like this patch Though it doesn't compile for me: (gcc 4.3.2, amd64)
Warnings:
Errors:
edit: fixing that error is quite easy
I like this patch Though it doesn't compile for me: (gcc 4.3.2, amd64)
Warnings:
Code: Select all
src/ai/default/default.cpp: In function 'void AiStateRemoveStation(Company*)':
src/ai/default/default.cpp:3677: warning: 'tile' may be used uninitialized in this function
src/terraform_cmd.cpp: In function 'CommandCost TerraformTileHeight(TerraformerState*, TileIndex, int)':
src/terraform_cmd.cpp:192: warning: comparison between signed and unsigned integer expressions
src/terraform_cmd.cpp:193: warning: comparison between signed and unsigned integer expressions
Code: Select all
src/roadveh_cmd.cpp: In function 'Trackdir RoadFindPathToDest(Vehicle*, TileIndex, DiagDirection)':
src/roadveh_cmd.cpp:1196: error: jump to label 'found_best_track'
src/roadveh_cmd.cpp:1042: error: from here
src/roadveh_cmd.cpp:1047: error: crosses initialization of 'TrackdirBits trackdirs'
src/roadveh_cmd.cpp:1046: error: crosses initialization of 'TrackdirBits red_signals'
src/roadveh_cmd.cpp:1045: error: crosses initialization of 'TrackStatus ts'
-
- OpenTTD Developer
- Posts: 351
- Joined: 03 Oct 2006 18:26
- Location: Prague, Czech Republic
- Contact:
Re: Freeform map edges
Attached patch fixes compilation for me and probably makes those glitches disappear
(maybe a hack, maybe not working. further issue may be not marking border tiles dirty, if this patch doesn't fix all cases )
edit: fixed one case
It doesn't look good when non-black void tiles are used... maybe SPR_SHADOW_CELL could be replaced by different sprite.
(maybe a hack, maybe not working. further issue may be not marking border tiles dirty, if this patch doesn't fix all cases )
edit: fixed one case
It doesn't look good when non-black void tiles are used... maybe SPR_SHADOW_CELL could be replaced by different sprite.
- Attachments
-
- edges_r14668_clean.diff
- (57.08 KiB) Downloaded 231 times
Last edited by SmatZ on 13 Dec 2008 14:39, edited 1 time in total.
Re: Freeform map edges
I meant that the invisible edge tiles are still at height 0. There's a "cliff" between real map tiles and invisible edge tiles. The space between tiles isn't drawn (even if it was meant to be black) and that's what creates the glitches. I used the grf just to see the height of the invisible tiles.CommanderZ wrote:I'm not really sure what the patch is supposed to do with the grf
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Freeform map edges
Updated the patch, see first post for new diff and changelog. Big thanks to SmatZ for fixing the graphical glitches.
As much as possible Only currently known bug is that building a station at tile 0 gives strange results.Zephyris wrote:How well bug tested is this? I thought some algorithms required a sea level edge square to prevent wraparound, or is there a special invisible square for this?
Correct.Roujin wrote:IIRC on the bottom left and bottom right edges, there's a row of invisible tiles, but not on the top left and top right edge.
Where can I find said grf?Terkhen wrote:I have tried the patch with the water edges grf, and it seems that there's a not drawn slope between the map tiles and the usually invisible edge tiles. Here's a screenshot:
Re: Freeform map edges
Here.
I'm going to try the new version right now
Edit: I can't compile it with MinGW in windows vista.
I've never seen this error, and I can't find a solution. What can be causing it?
I'm going to try the new version right now
Edit: I can't compile it with MinGW in windows vista.
Code: Select all
[SRC] Compiling ai/ai.cpp
make[1]: execvp: g++: Invalid argument
make[1]: *** [ai/ai.o] Error 127
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
-
- Chairman
- Posts: 776
- Joined: 20 Jan 2007 12:08
- Location: Germany
Re: Freeform map edges
That looks as if there is something wrong with your gcc installation rather than with the patch (did you try compiling clean trunk? Probably the same happens). execvp is a function replacing the currently running executable by another one (I'd guess in this case the gcc frontend calling the g++ backend).Terkhen wrote:I've never seen this error, and I can't find a solution. What can be causing it?Code: Select all
[SRC] Compiling ai/ai.cpp make[1]: execvp: g++: Invalid argument make[1]: *** [ai/ai.o] Error 127
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Re: Freeform map edges
Clean trunk compilation runs with no problems at all. The same is true for every other patch I use. I think the error happens with the first file that isn't at the src folder.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: Freeform map edges
I have no idea what can be causing that error, but my patch doesn't change ai.cpp at all.
Who is online
Users browsing this forum: No registered users and 2 guests