In development: Water with depth

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

User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Andrew350 wrote: 28 Jan 2020 05:04 Er, I have to be brutally honest, I'm not really liking the 'flat' water idea at all :oops: It just doesn't have any character or liveliness to it, I want to see some palette animation :mrgreen:
:mrgreen:
That's why I was thinking of parameters.
The player loads a game showing the default water tiles and then selects a parameter if there is a need to see one of the depth views, perhaps to find a shallow tile to be raised to a land tile as cheaply as possible.
The whole reason I suggest going 32bpp is exactly the reason you mention: the 8bpp palette is too restrictive to get a good result here :) Your first attempt was ok, but then obviously there's the problem of redistribution, which takes that option away. As I write this I'm playing around with trying to make a "stock-alike" water sprite from scratch which blends in decently with the original shore sprites, but the palette animation cycles are a real pain to line up with their 'randomness', so we'll see if I can get a good enough result. If that works then more options may be on the table :)

I'd still lean towards going 32bpp and using the darkening effect even if this works, but that's just my preference.
Time for some technical stuff:
OpenTTD\src\tables\palettes.h sets/reserves the colours by rgb and then sets the animation sequence:

Code: Select all

Extracted from src\tables\palette.h
===================================

/** Actual palette animation tables */
static const ExtraPaletteValues _extra_palette_values = {
	/* dark blue water */
	{ M( 32,  68, 112), M( 36,  72, 116), M( 40,  76, 120), M( 44,  80, 124),
	  M( 48,  84, 128) },

	/* glittery water */
	{ M(216, 244, 252), M(172, 208, 224), M(132, 172, 196), M(100, 132, 168),
	  M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
	  M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
	  M(100, 132, 168), M(132, 172, 196), M(172, 208, 224) },
Those rgb values are valid for 8bpp and 32bpp.
It would require a patch to mess with them.
Attachments
WaterCycleAnimation.png
WaterCycleAnimation.png (2.01 KiB) Viewed 4227 times
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: In development: Water with depth

Post by Andrew350 »

wallyweb wrote: 28 Jan 2020 12:39 :mrgreen:
That's why I was thinking of parameters.
The player loads a game showing the default water tiles and then selects a parameter...
That won't really work though seeing as you can't (normally) change NewGRF parameters during a game. You'd have to pick one or the other and live with it. Also that wouldn't be an option for base sets.

Edit: unless you meant adding such an option to the game itself, like a new transparency toggle? That could be an interesting idea :)
wallyweb wrote: 28 Jan 2020 12:39 Time for some technical stuff
[snip]
Those rgb values are valid for 8bpp and 32bpp.
It would require a patch to mess with them.
There's no need to mess with internal palettes, 32bpp sprites understand opacity, thus you can (in some cases, anyway) change the hues/brightness of the action colors by adjusting the 32bpp sprite itself.

That's how my example above works; it is fully animated, but because the 32bpp sprite is darker, it makes the action colors in the mask sprite also appear darker, no palette adjustments needed :)
Last edited by Andrew350 on 28 Jan 2020 17:39, edited 1 time in total.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Andrew350 wrote: 28 Jan 2020 17:26 There's no need to mess with internal palettes, 32bpp sprites understand opacity, thus you can (in some cases, anyway) change the hues/brightness of the action colors by adjusting the 32bpp sprite itself.

That's how my example above works; it is fully animated, but because the 32bpp sprite is darker, it makes the action colors in the mask sprite also appear darker, no palette adjustments needed :)
I say go for it. :D
Can you do it within the nfo I drew up?
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: In development: Water with depth

Post by Andrew350 »

It's already done, look in the .zip file I posted above and follow jfs' instructions to encode it, and you can see for yourself :)
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Andrew350 wrote: 28 Jan 2020 17:41 It's already done, look in the .zip file I posted above and follow jfs' instructions to encode it, and you can see for yourself :)
That works with a couple of observations. :D
The coast tiles are not masked so you can see that the non-coast tiles are definitely darker.
Is it possible to mask the coast tiles as well?
For the non-coaet tiles, I don't see any differences between levels. Is this correct?
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: In development: Water with depth

Post by Andrew350 »

wallyweb wrote: 28 Jan 2020 19:18That works with a couple of observations. :D
The coast tiles are not masked so you can see that the non-coast tiles are definitely darker.
Is it possible to mask the coast tiles as well?
The coast tiles being different was just an error on my part. The way I did the 32bpp sprites was just hacky and incomplete, I've fixed that below :)
wallyweb wrote: 28 Jan 2020 19:18For the non-coaet tiles, I don't see any differences between levels. Is this correct?
No, but sort-of-yes :D The difference is somewhat hard to see especially on shallow bodies of water (due to using all 16 levels for smoothness), but there is a difference if you look closely. Again, I've slightly improved that below.


...which brings me to this, my updated dark water test GRF. This version improves the darkening effect of my last attempt by doing it "the right way", so the OpenGFX coast tiles match up better and the wave cycles aren't as blurry. I've also thrown in my still-WIP original look-a-likes, and as a bonus the GRF *should* automatically pick the right graphics depending on your chosen baseset (although I encourage you to check out both for comparison) :)
darkwater.grf
(63.67 KiB) Downloaded 151 times
darkwater_v2_source.zip
(24.68 KiB) Downloaded 138 times
I'm still not totally happy with my TTD recreation sprites (the wave cycles still obviously clash and it "flashes") but it's good enough for a concept :) Also I want to try more of a logarithmic approach to showing depth instead of linear like I'm doing now, so that depth drops quickly but levels off in the deep. As it is everything just looks like a giant tidal pool except in the most extreme depths :P
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: In development: Water with depth

Post by michael blunck »

Can't those "unused" palette entries (DOS: d7 .. e2; Win 01 .. 09, f6 .. fe) be used for additional 8bpp water animation?

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Andrew350 wrote: 29 Jan 2020 08:26 I'm still not totally happy with my TTD recreation sprites (the wave cycles still obviously clash and it "flashes") but it's good enough for a concept :) Also I want to try more of a logarithmic approach to showing depth instead of linear like I'm doing now, so that depth drops quickly but levels off in the deep. As it is everything just looks like a giant tidal pool except in the most extreme depths :P
I just messed with your nfo. :mrgreen:
I unmasked the first sprite so that it now matches the coast tiles which saves you from having to mask them.
For the remaining sprites, I commented out every second sprite. This gave me an acceptable definition between the remaining sprite depth groups.
Here is the grf ...
darkwater.grf
(16.66 KiB) Downloaded 140 times
and here is the nfo ...
darkwater.nfo
(4.78 KiB) Downloaded 137 times
michael blunck wrote:Can't those "unused" palette entries (DOS: d7 .. e2; Win 01 .. 09, f6 .. fe) be used for additional 8bpp water animation?
I never could figure out what those pink pixels were for ... :P
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: In development: Water with depth

Post by michael blunck »

@wallyweb
IIRC, those are remnants from an ancient TTD windows API.
frosch wrote: In theory we could also assign meaningful colours to the pink stuff, though I gues it would be an endless argueing what area of colours are missing from the usual palette, resp. whether it is realistic to use such colours
posting.php?mode=quote&f=68&p=1104616
Probably now is the right time to agree on it? :D

regards
Michael
Image
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: In development: Water with depth

Post by Andrew350 »

wallyweb wrote: 29 Jan 2020 14:21 I unmasked the first sprite so that it now matches the coast tiles which saves you from having to mask them.
It needs the mask sprite though, as that is what provides the palette animation. As you can see in your modified grf the shallow water is still while the rest of it moves ;)

Edit: I just looked at your nfo and you used the old one; try the updated one in my last post, it had already fixed the coast sprites and added more stuff :)
wallyweb wrote: 29 Jan 2020 14:21 For the remaining sprites, I commented out every second sprite. This gave me an acceptable definition between the remaining sprite depth groups.
Yeah that fixes the definition problem, but I also like the 'smoothness' of all 16 levels. I want both :P
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Andrew350 wrote: 29 Jan 2020 23:16 Edit: I just looked at your nfo and you used the old one; try the updated one in my last post, it had already fixed the coast sprites and added more stuff :)
Good. Somthing for me to do on a slow day tomorrow. :D
wallyweb wrote: 29 Jan 2020 14:21 For the remaining sprites, I commented out every second sprite. This gave me an acceptable definition between the remaining sprite depth groups.
Yeah that fixes the definition problem, but I also like the 'smoothness' of all 16 levels. I want both :P
Parameters? 8)
User avatar
Andrew350
Chairman
Chairman
Posts: 768
Joined: 19 Dec 2011 07:54
Location: Washington State, USA
Contact:

Re: In development: Water with depth

Post by Andrew350 »

@jfs: was your intention for these 'depth sprites' to be shown all the time, or were you thinking of including some kind of toggle, like a transparency option, to show the depth? I've been working under the assumption these sprites would always be part of the landscape, but if it was intended to be a toggle-able display then the sprites don't necessarily need to look perfectly natural, more just informative. I'm just curious because that could change which approach would be best, i.e. beauty vs. info :)
User avatar
jfs
Tycoon
Tycoon
Posts: 1749
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: In development: Water with depth

Post by jfs »

Yes my intention is they would be in use all the time.

I haven't worked on this branch for a while now (been busy playing Transport Fever 2 :) ) but one of the other things I want to add is transitions support similar to how canal and river sides are implemented.

Apart from the visual elements, what's missing is better control from map makers (and terrain generators) of how depth is generated. Possibly also a way to control erosion, either globally or even prevent/limit it on a per-tile level.
Also, some more work on industries and ships support for water depth check. Possibly also something with bridges.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: In development: Water with depth

Post by wallyweb »

Having tested Andrew350's latest, I have some observations.

Going to the lowest zoom offers the best definition of depths.
From there a player can scroll to a suitable map section and zoom in and then using the "?" tool, determine the best depth to work upon.

Going to the "original-windows" base set works ok but the "sparkles" are too regular and seem to align across the waves rather than along them.

Over all, this v2 GRF works well for both "beauty & info". :D

jfs wrote:Also, some more work on industries and ships support for water depth check. Possibly also something with bridges.
Heh! I was thinking of just this thing a couple of days ago. Patch in to the respective Action 0 Properties a "minimum_water_depth" and a "maximum_water_depth" and let the set authors deal with the rest .
Don't forget to include objects.
A note on bridges ... For cost purposes, they should only care about where the pillars meet the water. Intervening spans never touch water.

Question: How can playing Transport Fever 2 be more fun than working on this stuff? :lol:
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests