Freeform map edges (in trunk since 15190)
Moderator: OpenTTD Developers
Re: Freeform map edges (in trunk since 15190)
congratulations
Re: Freeform map edges (in trunk since 15190)
A logical enhancement, appreciate it (though I won't be able to use it 'til the cargodest build hit r15190, I guess)
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Freeform map edges (in trunk since 15190)
Very nice and congratulations.
See the photo of a game that I made in ttdPatch long time ago hope it gives you ideas.
See little water plane landing on top of the mountain.
See the photo of a game that I made in ttdPatch long time ago hope it gives you ideas.
See little water plane landing on top of the mountain.
- athanasios
- Tycoon
- Posts: 3138
- Joined: 23 Jun 2005 00:09
- Contact:
Re: Freeform map edges (in trunk since 15190)
Congratulations.
I was surprised it hit trunk so quickly, but it deserved it.
I was surprised it hit trunk so quickly, but it deserved it.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.
I prefer to be contacted through PMs. Thanks.
"If no one is a fool I am also a fool." -The TTD maniac.
I prefer to be contacted through PMs. Thanks.
Re: Freeform map edges (in trunk since 15190)
Awesome! Amazing work guys!
That's CP 1564, a Montreal Locomotives Works built locomotive
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Freeform map edges (in trunk since 15190)
Great patch, thanks.
For those who are trying freeform map edges in the latest nightly, go to advanced settings, and then in the 'construction' menu node, 'Enable terraforming the tiles at the map borders'.
cheers,
Andy
For those who are trying freeform map edges in the latest nightly, go to advanced settings, and then in the 'construction' menu node, 'Enable terraforming the tiles at the map borders'.
cheers,
Andy
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
-
- Tycoon
- Posts: 1395
- Joined: 12 Jun 2004 00:37
- Location: United Kingdom of Great Britain and Northern Ireland
- Contact:
Re: Freeform map edges (in trunk since 15190)
It'll certainly help heightmaps - having spain surrounded by water on all sides is a little... unrealisitic.
Re: Freeform map edges (in trunk since 15190)
While this works fine for me when generating a new map, it only works properly on two edges of the map when loading a heightmap (specifically the bottom two eges don't have any sea, but they still slope down to zero height). I'm running r15297. Note I can raise the edges back up manually, so I suppose it's a problem with the heightmap loading rather than the new feature itself.
Please don't shoot me if this is a known issue but I couldn't see anything form skimming the last couple of pages from this thread.
I very much like this new feature though!
Please don't shoot me if this is a known issue but I couldn't see anything form skimming the last couple of pages from this thread.
I very much like this new feature though!
- Zhall
- Tycoon
- Posts: 1237
- Joined: 17 Jul 2007 01:36
- Skype: moonray_zdo
- Location: Teh matrix, duh.
- Contact:
Re: Freeform map edges (in trunk since 15190)
push through to 6.4!
Formerly known as Sapphire United.
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Learn Openttd
Learn Planetary Annihilation
Learn Orbit
Whose poo?
Re: Freeform map edges (in trunk since 15190)
uhm... huh?Sapphire united wrote:push through to 6.4!
What exactly do you want?
- belugas
- OpenTTD Developer
- Posts: 1507
- Joined: 05 Apr 2005 01:48
- Location: Deep down the deepest blue
- Contact:
Re: Freeform map edges (in trunk since 15190)
Poor you... You still fail to understand how it worksSapphire united wrote:push through to 6.4!
a) It would not be 6.4, it would be 0.6.4
b) if 0.6.4 would eventually come out, it will be bug fixes ONLY.
c) I can positively point out that there will be no 0.6.4, since there will be a 0.7.0. One day.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
Re: Freeform map edges (in trunk since 15190)
Hello,
I am just adjusting the more heightlevels patch to the freeform map edges patch. What makes me trouble are slopes at the map edges.
Example: Consider a 256x256 map. z(x,y) is the height at position (x,y). Let z(154,255)=22, z(155,255)=22, z(156,255)=21. So (155,255) has slope NE. If you scroll southeast, you have to paint the black area properly in order to avoid glitches resulting from areas of the map still being displayed where now black area has to be painted.
My idea to deal with this is assigning points outside the map a height as well, based on the heights at the map edges. Then, I can paint black tiles with the correct slope there. For example, for the tiles mentioned above (y now is any number > 255), z(154,y)=22, z(155,y)=22, z(156,y)=21. This way, any tile southeast of the map at y position 155 would be a Slope NE. Same for the areas northeast, northwest and southwest of the map. I wrote an alternative TileHeightOutsideMap function as follows:
Based on this concept of heights outside map, I can rewrite the painting code in viewport.cpp for tiles outside map as follows:
I am pretty sure that this works, except for one problem. The drawing procedure for the black tile called some lines later unfortunately ignores the slope and paints the tile like if it is flat. See attached screenshot for what I mean.
I think, what we would need here, are just black images for the slopes NE, SW, NW, SE (and/or make the painting code paint them ). What I unfortunately not know is how to implement them. If I get it right, the solution originally implemented in the freeform map edges patch for the problem I described above is the following code:
So you simply paint: For each tile in the black area, one black tile per height level of that tile. I don't think that painting that many images is resonable with more height levels.
So: Can anyone help solving the problem I described above?
I am just adjusting the more heightlevels patch to the freeform map edges patch. What makes me trouble are slopes at the map edges.
Example: Consider a 256x256 map. z(x,y) is the height at position (x,y). Let z(154,255)=22, z(155,255)=22, z(156,255)=21. So (155,255) has slope NE. If you scroll southeast, you have to paint the black area properly in order to avoid glitches resulting from areas of the map still being displayed where now black area has to be painted.
My idea to deal with this is assigning points outside the map a height as well, based on the heights at the map edges. Then, I can paint black tiles with the correct slope there. For example, for the tiles mentioned above (y now is any number > 255), z(154,y)=22, z(155,y)=22, z(156,y)=21. This way, any tile southeast of the map at y position 155 would be a Slope NE. Same for the areas northeast, northwest and southwest of the map. I wrote an alternative TileHeightOutsideMap function as follows:
Code: Select all
static inline uint TileHeightOutsideMap(int x, int y)
{
if (x < 1) {
if (y < 1) {
return TileHeight(TileXY(1, 1));
} else if (y < (int)MapMaxY()) {
return TileHeight(TileXY(1, y));
} else {
return TileHeight(TileXY(1, (int)MapMaxY()));
}
} else if (x < (int)MapMaxX()) {
if (y < 1) {
return TileHeight(TileXY(x, 1));
} else if (y < (int)MapMaxY()) {
return TileHeight(TileXY(x, y));
} else {
return TileHeight(TileXY(x, (int)MapMaxY()));
}
} else {
if (y < 1) {
return TileHeight(TileXY((int)MapMaxX(), 1));
} else if (y < (int)MapMaxY()) {
return TileHeight(TileXY((int)MapMaxX(), y));
} else {
return TileHeight(TileXY((int)MapMaxX(), (int)MapMaxY()));
}
}
}
Code: Select all
} else {
// We are outside the map => paint black
tile_info.tile = 0;
tile_info.tileh = GetTileSlopeOutsideMap(tile_info.x, tile_info.y, &tile_info.z);
tile_type = MP_VOID;
}
I think, what we would need here, are just black images for the slopes NE, SW, NW, SE (and/or make the painting code paint them ). What I unfortunately not know is how to implement them. If I get it right, the solution originally implemented in the freeform map edges patch for the problem I described above is the following code:
Code: Select all
} else {
if (!_settings_game.construction.freeform_edges || (TileX(tile) != 0 && TileY(tile) != 0)) {
if (x_cur == ((int)MapMaxX() - 1) * TILE_SIZE || y_cur == ((int)MapMaxY() - 1) * TILE_SIZE) {
uint maxh = max<uint>(TileHeight(tile), 1);
for (uint h = 0; h < maxh; h++) {
DrawGroundSpriteAt(SPR_SHADOW_CELL, PAL_NONE, ti.x, ti.y, h * TILE_HEIGHT);
}
}
ti.tile = tile;
ti.tileh = GetTileSlope(tile, &ti.z);
tt = GetTileType(tile);
}
}
So: Can anyone help solving the problem I described above?
Re: Freeform map edges (in trunk since 15190)
Have you already tried if this works? It would by far be the simplest solution.ic111 wrote:So you simply paint: For each tile in the black area, one black tile per height level of that tile. I don't think that painting that many images is resonable with more height levels.
Unfortunatly I don't think I can, the code to fix this in the freeform map edges patch was written by SmatZ.So: Can anyone help solving the problem I described above?
Re: Freeform map edges (in trunk since 15190)
First thanks for your answer, although you couldn't give me the informations I need.
Well, I mainly meant resonable in terms of efficiency. If I get it right, the freeform edges algorithm would paint <heightlevel> images for each black tile?
And as I already have implemented an adapted algorithm (more things had to be changed for the more heightlevels patch, e.g. the selection of the to-be-updated tiles), I think providing / painting images for sloped tiles (they are basically what I am missing so far) would be easier and better.
I will have a closer look on how I can do this soon.
Well, I mainly meant resonable in terms of efficiency. If I get it right, the freeform edges algorithm would paint <heightlevel> images for each black tile?
And as I already have implemented an adapted algorithm (more things had to be changed for the more heightlevels patch, e.g. the selection of the to-be-updated tiles), I think providing / painting images for sloped tiles (they are basically what I am missing so far) would be easier and better.
I will have a closer look on how I can do this soon.
Re: Freeform map edges (in trunk since 15190)
I thought it only does that for the tiles at the south edge, so only for tiles with coordinates (MaxX, ?) and (?, MaxY). If that's true, it isn't a problem at all to do that for some more heightlevels.ic111 wrote:First thanks for your answer, although you couldn't give me the informations I need.
Well, I mainly meant resonable in terms of efficiency. If I get it right, the freeform edges algorithm would paint <heightlevel> images for each black tile?
User-defined background color?
Hi everyone!
I’m building a new map to play on, and the first time I use the feature to build to the edges. But one thing bothers me: the black background. I really get depressed when I’m in the edge areas. Could there be a feature to select another background color like in my screenshot? I find it much more friendly there. (There was a NewGRF which made everything to water, but it’s not working anymore.)
Regards. GojkoG
I’m building a new map to play on, and the first time I use the feature to build to the edges. But one thing bothers me: the black background. I really get depressed when I’m in the edge areas. Could there be a feature to select another background color like in my screenshot? I find it much more friendly there. (There was a NewGRF which made everything to water, but it’s not working anymore.)
Regards. GojkoG
- Attachments
-
- Background-Color.png
- (335.57 KiB) Not downloaded yet
Re: Freeform map edges (in trunk since 15190)
the way the edge is drawn was changed when more heightlevels was introduced, so the existing newgrfs don't work anymore. it is not anymore a special black sprite drawn as a tile, but the grass/dirt sprite with an all-black recolour map
but it should be possible to make a newgrf again, which just replaces this recolour map.
but it should be possible to make a newgrf again, which just replaces this recolour map.
Re: Freeform map edges (in trunk since 15190)
Thanks for the hint, Eddi.
Since I figured out how NewGRFs work, I might find a way. I now understand that the sprites 3924 to 39.. are paited beyond the edge depending on the edge tile. Now I have to find how to apply a palette on these over-the-edge tiles.
Since I figured out how NewGRFs work, I might find a way. I now understand that the sprites 3924 to 39.. are paited beyond the edge depending on the edge tile. Now I have to find how to apply a palette on these over-the-edge tiles.
Re: Freeform map edges (in trunk since 15190)
the palette used for the map border is: action 5 type 18 (https://newgrf-specs.tt-wiki.net/wiki/Action5 – https://github.com/OpenTTD/OpenTTD/blob ... alette.nfo), or if you use NML, you need a "replacenew" block with type "OTTD_RECOLOUR" (https://newgrf-specs.tt-wiki.net/wiki/N ... ew_sprites)
Re: Freeform map edges (in trunk since 15190)
Thank you again, Eddi. But I don’t get it to work in my NFO file. So I guess I do something wrong.
Am I right that I have an Action 5 type 18 line followed by a recolor sprite (https://newgrf-specs.tt-wiki.net/wiki/RecolorSprites)?
I want to change every color index to color 99 from the Windows palette (light blue). (https://newgrf-specs.tt-wiki.net/wiki/P ... s#Palettes)
What do I do wrong here? GRFcodec doesn’t complain.Unfortunately the wiki doesn’t explain type 18.
Am I right that I have an Action 5 type 18 line followed by a recolor sprite (https://newgrf-specs.tt-wiki.net/wiki/RecolorSprites)?
I want to change every color index to color 99 from the Windows palette (light blue). (https://newgrf-specs.tt-wiki.net/wiki/P ... s#Palettes)
What do I do wrong here? GRFcodec doesn’t complain.
Code: Select all
10 * 3 05 18 01
11 * 257 00 99 99 99 99 99 . . . 99 (256 times "99")
Who is online
Users browsing this forum: No registered users and 39 guests