Multi-Level Water: An Idea

Multi-Level Water: An Idea

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Multi-Level Water: An Idea

Post by Argh »

Multi-level water has been on the MTR list for some time now; I have an idea, but I will be the first to confess that I'm not sure how to go about all of this, otherwise I'd just implement it into World Builder and have done with it.

Basically, my idea is this: make a change to the current map format, allowing water zones to be drawn.

Instead of treating water as a function of height, treat it as zones.

There would be three types of zone, drawn with RGB on an image, drawn at the same scale as the heightmap.

Once water zones have been drawn, the engine would read the resulting image, and then perform the following, with a combination of shaders and effects:

1. If the zone is R255, then it's a "pond" zone. It would use jK's bump water shader, or be treated as normal by the older shaders.

2. If the zone is any value of G, this is an "ocean" zone. It would use jK's bump water with waves, or be treated as normal by the older shaders. If an ocean zone is defined using a gradient, then this gives the direction of the "prevailing current", and this can then be used as a river.

3. If the zone is any value of blue, this is a "stream" zone. Stream zones are the most complicated, for obvious reasons. Streams would need to be set up to detect and perform the following:

1. Stream zones need to use a formula to bring their heightmap values down near the center of the stream, so that they create streams that look realistic (obviously, it would be bad if they were just decals).

2. Streams would need to detect which way to depict "flowing". A gradient of blue should be used, to give the engine / map compiler a vector to flow along. Some sort of cutoff should be used (say, a difference of 128 in the grayscale value) so that the engine knows that a given area defines a new vector (so that we can do streams that twist and turn, for example).

3. Streams would need to be able to show a bit of turbulence where they adjoin "pond" or "ocean" zones. Perhaps this means that wherever a zone is blue something / green something, for example, that this is a "turbulence" area.

4. Streams never effect movement, and are strictly for looks.

All zones except for streams are "filled" with water, by taking the top pixel of the heightmap and making the water quads hit the nearest heightmap pixel that was at that height or higher (obviously, map makers would have to be careful to set up the zones to all be in areas surrounded by higher values of height, or it would bork).

The pathfinder treats those areas as water zones, all tests that depend on this would check against the presence of water, instead of checking for a height of zero. Obviously, this approach would forbid creating new water, but it wouldn't forbid getting rid of old water by raising the land level underneath.

I know it's a lot to ask of a RTS engine, but there's an idea of a way to actually solve this, that wouldn't involve a lot that's new, other than the turbulence areas.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Multi-Level Water: An Idea

Post by KDR_11k »

The first problem with changing anything about the water is that all code just assumes water is at 0.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Multi-Level Water: An Idea

Post by Argh »

Yeah, I know. It'd be a major problem, making the pathfinder and everything else check for collisions vs. water zones- it'd be another typemap, pretty much.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Multi-Level Water: An Idea

Post by Beherith »

If streams never effect movement, shouldnt they be better off feature/lua drawable?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Multi-Level Water: An Idea

Post by Argh »

Well, my thought was that they're be pre-built by the engine, for speed purposes. Dunno, that part is just blue-sky musing, frankly.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Multi-Level Water: An Idea

Post by REVENGE »

Your idea (including implementation) has already been discussed in FR, MTR, etc. Nobody wants to do it. :P
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Multi-Level Water: An Idea

Post by KDR_11k »

Argh wrote:Well, my thought was that they're be pre-built by the engine, for speed purposes. Dunno, that part is just blue-sky musing, frankly.
If it's just a static map feature you slap it into a drawlist and call it a day. Of course you get your first issues when the map gets deformed...
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Multi-Level Water: An Idea

Post by AF »

The whole thing falls apart once you ralise terrain is deformable. A volcano with a pond at its summit that gets blown in half by a nuke would result in water in a magic containment vessel.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Multi-Level Water: An Idea

Post by Tobi »

Of course you could consider it mutually exclusive features.

If you disable map deformation in your mod you could safely make fake water volumes using some LUA trickery.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Multi-Level Water: An Idea

Post by Argh »

Well, yeah, I kinda assume that map deformation is off, because you guys all know what I think about that feature.
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Multi-Level Water: An Idea

Post by REVENGE »

AF wrote:The whole thing falls apart once you ralise terrain is deformable. A volcano with a pond at its summit that gets blown in half by a nuke would result in water in a magic containment vessel.
Code the water to splash and spill over. :lol:
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Multi-Level Water: An Idea

Post by AF »

REVENGE wrote:
AF wrote:The whole thing falls apart once you ralise terrain is deformable. A volcano with a pond at its summit that gets blown in half by a nuke would result in water in a magic containment vessel.
Code the water to splash and spill over. :lol:
Easier said than done
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Multi-Level Water: An Idea

Post by REVENGE »

AF wrote:
REVENGE wrote:
AF wrote:The whole thing falls apart once you ralise terrain is deformable. A volcano with a pond at its summit that gets blown in half by a nuke would result in water in a magic containment vessel.
Code the water to splash and spill over. :lol:
Easier said than done
Exactly. XD
Post Reply

Return to “Feature Requests”