Page 1 of 3

Empty Tile GRF

Posted: 27 Dec 2011 16:07
by Pyoro
Sorry for no tag, but I have no idea if this little thing works in TTDP or not. In fact, I basically have no idea what I was doing at all, but it seems to "work" and I haven't found any other GRF that does this (doesn't mean much, I'll admit ^^), so might as well post it here. Just in case ;)

Point was to get a "empty" NewObjects tile to build on slopes. Picture is probably self explaining what for. Should work regardless of climate, but it's not "tile-sensitive" (always a desert-grass tile even when build on sand, no snow, always the green toyland tile etc).

Re: Empty Tile GRF

Posted: 27 Dec 2011 16:16
by NoWa
Good idea, i like it. :D
Cold you make different fence tiles?
After testing it:
Maybe it could be more cheaper than now. Maybe. :D

Re: Empty Tile GRF

Posted: 28 Dec 2011 15:32
by Pyoro
Thx for testing :D

Cheaper? I'm not even sure that's possible. Tile itself costs next to nothing, it only gets "expensive" when build on slopes because of the foundations. No idea though if that prize can be influenced for just one grf.

And on fences - I can't draw and I can't code, so ...probably no ;)

...I did however manage to make a second "version" that actually includes two tile types depending on climate (normal: grass/snow, arctic: grass/snow, tropical: grass/desert, toyland: normal/snow).
Guess that's about it then ^^

Re: Empty Tile GRF

Posted: 28 Dec 2011 16:18
by FooBar
There's no need to have two separate objects for that. You can also have the game determine automatically what terrain to use.
In fact the NML tutorial has an example on how to code that: http://www.tt-wiki.net/wiki/NMLTutorial/Object_slopes

Re: Empty Tile GRF

Posted: 28 Dec 2011 16:31
by Pyoro
That's actually where I c&p the code from, pretty much ;)
Didn't quite get that part to work, I'll admit *cough* - I assume the game would've decided what tile to place? Since it's only deco anyway I'd say leaving the decision to the player is fine as well. ^^

Re: Empty Tile GRF

Posted: 28 Dec 2011 17:55
by FooBar
It's your grf, so it's up to you what you want to do with it :)

Anyways, feel free to comment in the NML Tutorial topic on what you in particular don't understand from that part of the tutorial. That way we may be able to improve it in a way that you do understand!

Re: Empty Tile GRF

Posted: 30 Dec 2011 22:16
by Ovenbaked
I love this idea. simple, but very useful.
The cost is the issue, but that comes with building on a slope.

Re: Empty Tile GRF

Posted: 28 Aug 2012 15:18
by Pyoro
Currently playing a game that disallows towns from building roads I found this GRF rather useful to invisibly prevent cities from growing along roads they're not supposed to, but obviously it doesn't look too good on sloped terrain to have foundations everywhere ...
...which is why I quickly made a new batch of these simple GRFs, all containing one object with 4 views (thx to the great NML tutorial ;) ).
First is pretty much the same as the old one: normal, snow, desert and water on foundations.
Second is a sloped normal ground and a sloped terrain sensitive tile (unfortunately no transitions though), plus SE and SW coastal tiles as it's rather beyond me how to detect and draw coastal tiles properly and I needed some of those for my current game ^^.
Third are simply some field tiles on foundations as I got annoyed with cities destroying all farm land. ;)

Re: Empty Tile GRF

Posted: 28 Aug 2012 18:39
by Bob_Mackenzie
I can find a use for them :)

Re: Empty Tile GRF

Posted: 29 Aug 2012 11:50
by Pyoro
Good to hear :)

Bit of playing with them actually quickly found me annoyed by #3 being rather limited, so I made another version with more farming related sprites, including references to some FIRS animals (obviously those will only load properly when playing with FIRS).
Example of a rather dirty sheep farm:
farm.png
farm.png (27.63 KiB) Viewed 16019 times
Also tried to find a sensible use for that fake water tile. Elevated city pools perhaps? ^^;
pool.png
pool.png (45.94 KiB) Viewed 16019 times
Either way, new version attached ;)
€: deleted. Didn't work as hoped ^^

Re: Empty Tile GRF

Posted: 29 Aug 2012 11:54
by planetmaker
Why don't you combine it all into one NewGRF?

Re: Empty Tile GRF

Posted: 29 Aug 2012 12:26
by Pyoro
Mh, no particular reasons, except that I personally slightly prefer to only have in-game what I actually use - as it's just a bit of c&p here's an all-in-one version.

Also, completely misunderstood how referencing to sprites works, so no more FIRS sprites in this. Wouldn't have worked in almost all cases anyways ^^;

Re: Empty Tile GRF

Posted: 29 Aug 2012 12:33
by planetmaker
Pyoro wrote:Mh, no particular reasons, except that I personally slightly prefer to only have in-game what I actually use - as it's just a bit of c&p here's an all-in-one version.

Also, completely misunderstood how referencing to sprites works, so no more FIRS sprites in this. Wouldn't have worked in almost all cases anyways ^^;
Well, there's a limit of 63 NewGRFs per game. Having one for each object or vehicle would quickly exhaust that. If you want to restrict availability of not-to-be-used objects, use a NewGRF parameter to offer a choice of which objects become available.

As with respect to referencing: in this particular case it's not easy. On the other hand, FIRS is licensed under the GPL. Thus should you adopt that and adhere to that licensing scheme as well, you'd be free to just grab and copy the related code and sprites and incorporate them here. That'd even supply those independent of the presence of FIRS within a game.

Re: Empty Tile GRF

Posted: 29 Aug 2012 13:15
by Pyoro
Mh, makes sense. I had that limit somewhat higher in memory as I personally never came across it, but with only 63 it definitely makes more sense as one grf.

And yes, I briefly considered that, but I'd say it's beyond the scope of this grf - actually, I should've done that as something separate from the beginning probably ^^;

Re: Empty Tile GRF

Posted: 14 Sep 2012 12:20
by Pyoro
One last(?) version to clean up this mess; everything neatly packed into one GRF and 9 objects -
objects.png
objects.png (59.27 KiB) Viewed 15711 times
- and while I said "clean up", this (as can be seen) comes with some glitches. Coastal tiles are especially unfriendly to flat terrain. Water, that pile of coal and concrete are flat tiles, but don't have foundations (WAD: allows to neatly cut off hills as seen in the picture. Either way, they're just in to not waste these views ;) ).
Also, some trees aren't drawn correctly in the purchase menu and they'll stay the same for all climates, so they really only make sense for temperate climates (and maybe arctic). And, one last glitch, building bridges over the trees is allowed, but will of course glitch with bridges only 1-2 tiles high ... can look pretty good with higher bridges though ;)

Could maybe have a bit more variation for the trees, or maybe sloped farm tiles, but altogether I consider this done :)

Re: Empty Tile GRF

Posted: 14 Sep 2012 16:37
by Bob_Mackenzie
I for one will be using this...

A version with the GFX trees would be nice...

Re: Empty Tile GRF

Posted: 14 Sep 2012 16:47
by planetmaker
Bob_Mackenzie wrote:I for one will be using this...

A version with the GFX trees would be nice...
If you do it right [TM] you use whatever trees the user uses (by just referencing the base set trees)

Re: Empty Tile GRF

Posted: 14 Sep 2012 17:15
by Pyoro
I'd never claim to do anything right, but that for one should work, yes. Probably. Hopefully. At least it does for me. ^^;

Currently trying to figure out steep slopes, and coast tiles apparently might not work the way they're supposed to though I haven't really been able to reproduce this.

Re: Empty Tile GRF

Posted: 14 Sep 2012 17:35
by planetmaker
If you're writing in NML, base_sprite_no is the flat ground tile of the tile type you're looking for (for many cases, not all, might fail for coasts):

Code: Select all

spritelayout company_land_layout(base_sprite_no) {
	ground {
		sprite: base_sprite_no + slope_to_sprite_offset(nearby_tile_slope(0, 0));
	}
}
And you don't have to worry about the actual slope.

Re: Empty Tile GRF

Posted: 14 Sep 2012 18:38
by Pyoro
Alright, thanks, I'll take a look at that. :)

Also, I've again been too naive with coastal tiles - they don't work as hoped, at least not for any nightly at least from 24448 onwards. Only works for some revs around 24110 - 24309. I guess the sprite numbers changed somewhere in-between ...