Halftile foundations (in trunk since r11321)

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

frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Halftile foundations (in trunk since r11321)

Post by frosch »

Good evening.

Some of you were already unpatiently waiting for it, but now it is released. The patch features:
1) The halftile foundations: Build two horizontal/vertical tracks on (steep) slopes.
2) Acerbus' anti-zig-zag foundations.
Both can be seen in
halftileintroduction.png
Screenshot
(117.34 KiB) Downloaded 755 times

Before you can start playing, you will have to know some things:
Most foundations hide something behind them. More intresting is: If you click on the overlapping areas, the mouse click will be associated to the hidden tile. This is also the behaviour of trunk, but there it is not that noticeable.
But here it is more critical. See the following situation (right hand side):
steep slope
steep slope
SteepSlopeS.png (3.51 KiB) Viewed 7321 times
The lower part of the steep slope is completely hidden by the foundation. Where do you now have to click to build track there?
Remember - the hidden part will always be preferred. So imagine there would be no foundation and click where the lower part of the slope must be. Note that the (auto-)rail highlight will also be hidden.
OTOH in the same situation: If you now want to build signals on the upper track, you will have to click near the lower border of the foundation. The clickable area is relative small.
And even more; in the left hand side situation: If you have two tracks on such a steep slope and want to build signals on one of the track, both click areas are on the upper foundation. If you click on the lower part of the foundation you will already get the next track behind it.
Okay a bit tricky, but I hope if you try it, you will figure it out.
Second you will notice, that only some pixels of the track on the lower part are visible. But with fences you will discover if there is track:
With fences
With fences
FencesHelp.png (4.12 KiB) Viewed 7302 times

Now, how to install this:
1) Below (in the next post) you will find a zip with two graphic files: "halffndw.grf" and "halfselw.grf". Copy them into your "data" directory, where the original graphics are.
2) Second you will find the patch file. Read the sticky topics "Howto apply a patch" and "BuildOTTD" on how to apply it.


Savegame compatibility:
If you load a savegame from trunk, all foundations will switch to the new one. The halftiles near the coast will get flooded in the first seconds after load.
I did not increase the savegame version. By that all future versions of the patch will be compatible to this version. If you load a savegame from this patch in trunk, it will quietly do that. Previously flooded halftiles near the coast will convert back to grass. However, if you have built a track combination that is not valid in trunk (i.e. two tracks on slopes), it will fail. That means trunk will still load the savegame but will crash somewhen in between (e.g. when the invalid track combination should be drawn in a viewport, when a vehicle (even plain) will go over it, ...). However, if you remove all critical tracks, you can savely load the savegames from trunk.


If you do not like the new foundation graphics, you can load your own with an Action5 (see http://wiki.ttdpatch.net/tiki-index.php?page=Action5).
In the next post is an example grf: tmpfndw "Temperate foundations in all climates".
I extended Action5 Type 6 with a 90 sprites version. The 16 new sprites are appended at the end, so the grf is compatible with TTDP without any version checks. See "tmpfndw.grf" below for a example.


Now - enjoy it!
Last edited by frosch on 22 Oct 2007 13:17, edited 3 times in total.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Halftile foundations :)

Post by frosch »

new version. The graphics slightly changed, so you also have to download the graphics again.

Further there is now a example how to use ActionA and Action5 to replace the foundation graphics. tempfndw.grf changes the foundations of all climates to those of the temperate climate. You may want to use this grf, if you are playing with a industry grf, that changes the foundations :)
Attachments
halftile_graphics_ver2.zip
(in trunk, only purposed for archive)
(6.99 KiB) Downloaded 134 times
Halftile11296.patch
(in trunk, only purposed for archive)
(63.63 KiB) Downloaded 117 times
tempfndw.grf
Example newgrf, that replaces the foundations of all climates with the temperate foundations.
(39.42 KiB) Downloaded 135 times
Last edited by frosch on 22 Oct 2007 13:18, edited 2 times in total.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Halftile foundations :)

Post by DaleStan »

frosch wrote:2) Use 16 sprites, if you want to only load the new foundations. (see halffndw.grf for the order, though it contains the sprites for all climates)
NAK. Action 5 loads one set of contiguous sprites. You may use it to load any number of sprites into this one set, but you may not use multiple action 5s to load multiple parts of one set. If you need non-contiguous loading, then you need multiple action 5 types.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Halftile foundations :)

Post by athanasios »

I hope it will make it into the trunk soon. It is a must. Good luck.
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.
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Halftile foundations :)

Post by frosch »

DaleStan wrote:Action 5 loads one set of contiguous sprites. You may use it to load any number of sprites into this one set, but you may not use multiple action 5s to load multiple parts of one set. If you need non-contiguous loading, then you need multiple action 5 types.
Err, I forgot a point in the first post, so I clarified the NewGrf extentions.
I somehow expected problems with method 3), but now there are problems with 2). :) I just took a look at the TTDP Action5 handler and agree that the current method won't work.

However as long as noone wants to replace the graphics, I am not in the mood to spend any work on this issues.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Halftile foundations :)

Post by Acerbus »

Wow, thanks to Frosch, I seem to have my very own anti zig-zag patch :D How many people can say that?

Will build and test right now!

EDIT: I seem to have found a bug:
Sinwood Transport, 28. märts 1920.PNG
Sinwood Transport, 28. märts 1920.PNG (31.86 KiB) Viewed 6893 times
As you can see, the autorail button seems to be a bit off. This apparently only happens with the Canadian Trainset, though.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Halftile foundations :)

Post by Bilbo »

Great idea!

Well, as for the trunk acceptance, often it can help to split the patch into several parts (one containing some code cleanup, another just improved graphics - Acerbus's antizigzag, and last patch containing the foundations itself). Once the smaller patches are already in, the last part is then smaller, easier to review or maintain, etc ...

So, if it is possible to split patch into some logical parts ... you can try it to have chance of accepting the patch sooner.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Halftile foundations :)

Post by DaleStan »

frosch wrote:
DaleStan wrote:Action 5 loads one set of contiguous sprites. You may use it to load any number of sprites into this one set, but you may not use multiple action 5s to load multiple parts of one set. If you need non-contiguous loading, then you need multiple action 5 types.
I somehow expected problems with method 3),
3 is not an issue. There are many places where TTDPatch says, in essence:

Code: Select all

if (num_FOO_sprites > BAR)
    sprite = base_FOO_sprites + BAR;
else
    sprite = TTD_PROVIDED_SPRITE;
// do something with sprite
This is especially the case with type 04 (signals), for which any of 48, 112, or 240 is documented as valid, and type 07 (GUI) which has been growing new sprites one and two at a time for some time now.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Halftile foundations :)

Post by Roujin »

very nice :) if only different tracktypes were allowed on one tile, we could build a nice trace for monorail/maglev :lol:

ok, we can, but not in curves with the new halftiles. only if it were the same track type :P
Attachments
Bielebach Transport, 18th Mar 2038.png
example 1
(669.08 KiB) Downloaded 278 times
Bielebach Transport, 27th Oct 2038.png
example 2
(628.33 KiB) Downloaded 336 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
frosch
OpenTTD Developer
OpenTTD Developer
Posts: 988
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: Halftile foundations :)

Post by frosch »

Acerbus wrote:I seem to have found a bug:
Ok, the cause for this is: You have loaded a grf, that replaces the autorail icon. The new foundation sprites are inserted in a lower sprite number range, so all following spritenumbers got incremented by 16. A clean solution would be to finally create an Action5 for OTTD specific GUI icons (well actually perhaps there is already one, I am not sure).
DaleStan wrote:This is especially the case with type 04 (signals), for which any of 48, 112, or 240 is documented as valid, and type 07 (GUI) which has been growing new sprites one and two at a time for some time now.
Method 3) is different. The new sprites are not appended at the end, but interleaved.

I guess it will result in adding a new Action5 type.
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Halftile foundations :)

Post by DaleStan »

Or just appending the new sprites to the end instead.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: Halftile foundations :)

Post by Digitalfox »

r11319 -Add: halftile- and anti-zig-zag-foundations. Patch by frosch.
In trunk thanks to rubidium and frosch :D
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Halftile foundations :)

Post by Roujin »

hooray for frosch :D :D

another great contribution by you :) *bow*
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Halftile foundations :)

Post by athanasios »

I can't wait till tomorrow for the nightly! :D
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.
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Halftile foundations :)

Post by Acerbus »

Hooray for Frosch! I ain't gonna wait for the nightly, I'm gonna BOTTD myself a brand new build just to check it out!
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Halftile foundations :)

Post by Wolf01 »

great :D
thank you frosh and rubidium (and why not to Acerbus?)
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Halftile foundations :)

Post by Acerbus »

Wolf01 wrote:and why not to Acerbus?
Why me? ?(
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Halftile foundations :)

Post by Wolf01 »

frosch wrote: 2) Acerbus' anti-zig-zag foundations.
maybe this?
Acerbus
Engineer
Engineer
Posts: 94
Joined: 08 Dec 2006 21:42
Location: Estonia

Re: Halftile foundations :)

Post by Acerbus »

Wolf01 wrote:
frosch wrote: 2) Acerbus' anti-zig-zag foundations.
maybe this?
To tell you the truth, I've always been confused as to why Frosch chose to name the patch after me. I somehow never got around to asking, though :s

Not that I have anything against it though :lol:
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Halftile foundations :)

Post by Roujin »

that would be because of this post by you: http://www.tt-forums.net/viewtopic.php? ... t=#p617983

and his reaction:
Nice idea. I also did not like the zig-zag at the end, but I did not knew a way to remove it without drawing even more foundation-sprites. Thank you for pointing me on this way. I will definitely implement that.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 31 guests