Page 1 of 1

Patch: Raising max. height to 127

Posted: 21 Jul 2007 00:50
by Bilbo
So, to complement http://www.tt-forums.net/viewtopic.php?f=33&t=33208 with some sort of patch ....

I have written patch that will allow heights from 0-127 instead od 0-15. (with possible future extension to -128 .. 127 for sea depth patch)

So I split type_height in _m to _m.type and _me.height. This increase memory usage for map by 11%, but seem to work.
First sort of preview, loading works, saving works too, but the high hills gets broken in savegames. High terrain technically work, but there is heap of bugs and glitches, so lot of work need to be done to bring this to usable state.

Known bugs/issues:
* tiles with height>15 are screwed when saving
* terraforming uphill get very slow once you start raising "too large peak" (like to raise 30 high peak to 31 height). Seems the terraformer is recursive (and ridiculously slow for large peaks). There were some recursion limits which I don't know how they were computed. I guessed how much larger they need to be for 127 height. Seem to work somewhat, but maybe it is still too small or large
* many graphical glitches with tiles of height over 15 (I have no idea why).
* parts of gui and config system still think 15 is maximum height
* Very high hills show with same colors on minimap -> all colors over height 27 are the same, somebody need to invent what colors to use ...
* Planes fly too low
* Land generation (terragenesis) won't use any values >15

What works:
Tiles can actually be between 0-127 and behave well for road vehicles and trians.
Loading savegames work (Saving is still buggy)

Seems that it will be more difficult than previously anticipated, so any help (fixing any of that bugs or finding yet unknown bugs is welcome :)

Re: Patch: Raising max. height to 127

Posted: 21 Jul 2007 10:19
by thgergo
I have tried this patch, keep up good work Bilbo! :bow:
Works good up to 20-24 height levels , if you doesnt use any very tall buildings on the mountain tops. After thsoe period of height levels, I have got massive glitches, even on the ground :) I have raised the height again, the glitches became even more wierd(maybe after height level32?), the z-coordinates of the tiles are calculated again from zero. And the planes are funny too, they float on the ground at extra heights, and they jump up to the runway from the ground :roll:
This looks bugfree ingame, except the massive glitches :wink: I would like to see this in trunk after those will have been fixed :mrgreen:

Re: Patch: Raising max. height to 127

Posted: 22 Jul 2007 18:15
by Grolsch
Screens would be interesting ;)

Re: Patch: Raising max. height to 127

Posted: 23 Jul 2007 15:19
by Bilbo
Development of this patch is temporarily put on hold.

Of course, anybody can fix the bugs and test the patch in meantime - once development resumes, I'll collect and merge the fixes.

Reason: See here:
http://www.tt-forums.net/viewtopic.php? ... 60#p611260

Re: Patch: Raising max. height to 127

Posted: 25 Jul 2007 13:58
by xyz
Hi

This patch jus gave me an idea, if you combine it with the bigger maps patch and the day-length patch it could be use to create an MMORTS based on OPENTTD.

And about
Bilbo wrote:Development of this patch is temporarily put on hold.
Of course, anybody can fix the bugs and test the patch in meantime - once development resumes, I'll collect and merge the fixes.
Reason: See here: l viewtopic.php?f=33&t=33262&p=611260#p611260
Don’t force someone to like your work.

Re: Patch: Raising max. height to 127

Posted: 25 Jul 2007 14:13
by CobraA1
Hmmm ... I guess I stop making any new patches till I receive some feedback or response on the ones I put there already.
You're in a forum. Nobody is - or should be - forced to talk about stuff they don't want to talk about. There is no rule, written or implied, that states that people have to talk about your stuff.

Re: Patch: Raising max. height to 127

Posted: 25 Jul 2007 15:45
by xyz
by the looks of it your patch made it to the nightly builds:
r10665 truelight 2007-07-23 21:30:36 +0200 (Mon, 23 Jul 2007) 4 lines
-Codechange: replace magic 15 with MAX_TILE_HEIGHT (bilbo)
-Codechange: replace magic 13 with MAX_SNOWLINE_HEIGHT (bilbo)
-Codechange: assure _map_height_bits is always of correct size (Rubidium)

Re: Patch: Raising max. height to 127

Posted: 25 Jul 2007 15:53
by Bilbo
xyz wrote:by the looks of it your patch made it to the nightly builds:

...
Err. ... no. Only some small part of it, that will make the code cleaner. But the actual code to raise the max height is not in, as it is currently way too much buggy to even consider adding it to trunk. I'll update the patch to not include the part that is already in trunk once I get home ...

Re: Patch: Raising max. height to 127

Posted: 25 Jul 2007 20:11
by NukeBuster
Bilbo, you're doing a great job with your patches. I really enjoy reading the topics and watching the progress. I hope you will be patient enough for all patches to be evaluated by the devs.

Re: Patch: Raising max. height to 127

Posted: 26 Jul 2007 00:20
by athanasios
xyz, CobraA1: Gentlemen, Bilbo is not trying to force anyone. He means that if no one is interested in certain of his patches then why should he continue on them wasting his time? They will not be of any use. (Except for himself in single player mode). He 'd better spend his precious time on patches that will make it into the trunk and we are going to use them.

Re: Patch: Raising max. height to 127

Posted: 26 Jul 2007 00:25
by Bilbo
athanasios wrote:xyz, CobraA1: Gentlemen, Bilbo is not trying to force anyone. He means that if no one is interested in certain of his patches then why should he continue on them wasting his time? They will not be of any use. (Except for himself in single player mode). He 'd better spend his precious time on patches that will make it into the trunk and we are going to use them.
Well, some of my patches are usable in multiplayer too, as they preserve network compatibility. Like the vehicle commands, configurable console limits, more than 22 opened windows ... well, the console is planned to be rewritten, so after that I assume the first one will be accepted after I modify it for new code and second one may become obsolete ... well, I'll see :)

Re: Patch: Raising max. height to 127

Posted: 26 Jul 2007 03:18
by Bilbo
Ok, I've updated this patch for newer trunk and also fixed wrong array size of map colors, see first post for it.

Rest of the bugs still remain ...

Re: Patch: Raising max. height to 127

Posted: 04 Dec 2007 11:38
by SmatZ
Bilbo wrote: * many graphical glitches with tiles of height over 15 (I have no idea why).
The map is 2D. Everything is optimised so it doesn't draw more than it actually needs.
Making map higher would need to scan wider area for anything that can be displayed at given pixel, eg. it would need bigger area to scan in ViewportAddVehicles() etc.
I am afraid this would need huge rewrite of rendering functions, but you are welcome to give it a try ;-)

Re: Patch: Raising max. height to 127

Posted: 04 Dec 2007 18:42
by Bilbo
B. N. SmatZ! wrote:
Bilbo wrote: * many graphical glitches with tiles of height over 15 (I have no idea why).
The map is 2D. Everything is optimised so it doesn't draw more than it actually needs.
Making map higher would need to scan wider area for anything that can be displayed at given pixel, eg. it would need bigger area to scan in ViewportAddVehicles() etc.
I am afraid this would need huge rewrite of rendering functions, but you are welcome to give it a try ;-)
Hmmm ... I probably could just increase the lookup limit from 15 times tile height to 127, but I guess there would be some performance degradation ...

Still, maybe the patch could work so that height will be artificially limited to say 31 - still usable increase, there are enough reasonable colors for minimap for 32 levels, and there is room for further expansion in case someone will solve the glitches. And there are still levels -1 to -128 available for possible deep water patches or other uses.

Re: Patch: Raising max. height to 127

Posted: 19 Feb 2009 11:45
by Bilbo
I'd like to inform people who stumble upon this topic and then complain in PM about the patch not working/being for old OpenTTD version.

Look at this thread:

http://www.tt-forums.net/viewtopic.php?f=33&t=40844

Other people have taken off the idea from where I've left it and there is working patch (still with some known bugs, but with much less of them than my patch in this thread) in that thread for current OpenTTD version.

Consider this topic a bit obsolete.

Re: Patch: Raising max. height to 127

Posted: 19 Feb 2009 13:23
by dihedral
let me have a wiled guess: Alain sent you a pm asking you if you could update your patch?