Quantcast

Jump to content

» «
Photo

[SA|DOC] water.dat

27 replies to this topic
steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#1

Posted 22 August 2005 - 08:27 PM Edited by steve-m, 22 August 2005 - 09:25 PM.

Been doing lots of testing with the water recently, and posting here and there, now it's time to collect all the info in a separate topic.

The water.dat is a plain text file that defines the water tri- and rectangles in SA, the file water1.dat is old and not used by the game.

The water.dat file starts with the word "processed" in the first line, followed by the water shape definitions, one per line. A water shape definition consists of 3 or 4 corner points, and a parameter
CODE
Point1 Point2 Point3 [Point4] Param

with the points consisting of 7 floats each and the parameter being an integer value. One corner point is built as follows:
CODE
X Y Z F1 F2 F3 F4

X, Y, Z: coordinate
F1:water current speed along X axis
F2:water current speed along Y axis
F3:unknown, influences waves, maximum is 1.0
F4:wave height

The parameter at the end of each line defines the water type, and can have a value from 0 to 3:
Parameter: 0 1 2 3
Visible: no yes no yes
Shallow: no no yes yes
Param 4 seemed to be identical with 0, I think they just repeat when higher than 3. Params 0 and 1 are used for ocean, which are infinitely deep, and 2 and 3 for pools, that are only a few meters. 0 and 2 have invisible water, so they can be used with own water textures, probably animated (like the stream). Water animals seem to appear for all 4.

All values are separated by simple whitespaces, no commas or anything. Water shapes can be disabled by the use of a '#' character at the beginning of the line, just as in other map files.

Water can only be defined for the normal map area (+/- 3000 on X and Y axis). This area is surrounded by a hardcoded, infinite ocean, with a water surface at 0.0 and a seabed at -70.0 (Z axis). If you define a water shape along the border, the outer corner points will automatically be moved to a level of 0.0, possibly resulting in odd water slopes.

It it possible to define several layers of water, so theoretically a skyscraper with a pool in each floor wouldn't be impossible. You can even define water shapes at a level below zero, I've only tested until -80.0, but I guess -100 won't work anymore.

Very important note: All X and Y coordinates of corner points must be even, rounded numbers (like 1234.0), otherwise the game will crash when you approach the water.

The corner points should be defined in the order NE-NW-SE-SW, or also SW-SE-NW-NE:
CODE
#  2---1   3---4
#   \       \  
#    \       \  
#     \       \
#  4---3   1---2


Hope this helps, awaiting your contributions.

Edit: Updated, many thanks to JKM biggrin.gif

BenMillard
  • BenMillard

    aka Cerbera

  • Members
  • Joined: 22 Jun 2002
  • None

#2

Posted 23 August 2005 - 03:10 PM

I've just had a look at this file and it uses a weird character to seperate each water shape.

CODE

It seems to be either a Carriage Return or a Line Feed character, instead of the normal Windows convention of both characters being used. It meant that CFG Studio crashed when I tried to open it. sad.gif

Does the file still work when these are replaced with the normal pair of characters for a standard Windows new line?

DexX
  • DexX

    Black Hat

  • Feroci Racing
  • Joined: 16 May 2002

#3

Posted 23 August 2005 - 04:35 PM

it uses 4 spaces, like this; " ", its not one character.

@ steve excellent work, suprised you didnt pin it.

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#4

Posted 24 August 2005 - 12:12 PM

@Cerb: I'm editing all text files with UltraEdit, and on opening the water.dat it asks me whether to convert to DOS format. And yes, they used a single line feed (0x0A) character to separate them. But I checked, normal Windows linebreak works as well.

@dexx: Erm, because there are already way too many topics pinned? What we need would be an overview topic, with links to all the documentations, grouped by game. Or a wiki. tounge.gif

DexX
  • DexX

    Black Hat

  • Feroci Racing
  • Joined: 16 May 2002

#5

Posted 24 August 2005 - 09:09 PM

QUOTE (steve-m @ Aug 24 2005, 07:12)
@dexx: Erm, because there are already way too many topics pinned? What we need would be an overview topic, with links to all the documentations, grouped by game. Or a wiki. tounge.gif

This is a start-
Maps -> Directory

dertyjerzian
  • dertyjerzian

    I have a custom member title. I call it "Solid Snake"

  • BUSTED!
  • Joined: 08 Jun 2005

#6

Posted 24 August 2005 - 09:51 PM

QUOTE (ashdexx @ Aug 24 2005, 16:09)
This is a start-
Maps -> Directory

I second that, was wondering about a directory for this section. I'm still new here, but that lil page of links there would be very handy, especially when it expands and maybe gets some tables or another easier to rad format..


OT:
Seems if you make a small, very small like 4x4, patch of water, the water is not solid. Well water isn't solid, but you know what I mean tounge.gif This also might be because I have an entire 6000x6000 square of water under it canceling the "physical" part, not sure. But my 4x4 cube is visible and pretty as hell, just not solid. (doesnt need to be, just an observation)

Also, to affirm for stripped game users, the crash on unrounded numbers being used is in fact true. You might get a box of water there, and you might start game near it, but heading away from it will crash the game the moment you turn around. ( I was playing with my fountain, trying to find ways...)

santehnik
  • santehnik

    Disabled

  • Members
  • Joined: 18 Oct 2004

#7

Posted 16 November 2005 - 04:22 PM Edited by santehnik, 16 November 2005 - 07:15 PM.

Hi.
I have a problem.Im adding a layer of water but it are added on 0 Z cordinate but need on 6.362.
Can somebody say me what's the problem ???
CODE
-3000.0 3000.0 706.362 0.0 0.00000 1.0 15.0    3000.0 3000.0 6.362 0.0 0.00000 1.0 15.0    3000.0 -3000.0 6.362 0.0 0.00000 1.0 15.0    -3000.0 -3000.0 6.362 0.0 0.00000 1.0 15.0  1

This is my code but water on 0 Z !!!
Help me please smile.gif

Added at 21.13 (gmt +2)

Sorry for troubeling im fix this bug via changing x & y cordinates to 2000 it's normal for me smile.gif thanx to all

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#8

Posted 23 July 2006 - 08:50 AM

Sorry for bumping a very old topic, but since I don't see to see any maps around with small sections of water, I guess no-one really cracked this yet.

I'm working on the water in the pools I made for my Myriad lots and I used this line:

QUOTE
processed
-3000.0 -3000.0 0.0 0.0 0.0 0.0 0.0 3000.0 -3000.0 0.0 0.0 0.0 0.0 0.0 -3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 1
-649.0 -174.0 8.0 0.0 0.0 0.0 0.0 -649.0 -157.0 8.0 0.0 0.0 0.0 0.0 -659.0 -174.0 8.0 0.0 0.0 0.0 0.0 -660.0 -157.0 8.0 0.0 0.0 0.0 0.0 3



The squares in those lines don't show 'cause I copy/pasted this from notepad.

Now all I have is a surface (not a box) of water, without physical effects, that crashes randomly even though I used even numbers.

I hope someone can help me...

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#9

Posted 23 July 2006 - 01:22 PM

649 and 157 are even numbers? That's new to me. tounge.gif Also, the points don't seem to be in the right order.

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#10

Posted 23 July 2006 - 09:59 PM

euhm... blush.gif ...oops

I guessed by even you meant it should end 0, like 57.0 in stead of 57.2, but yeah, even... I got it.

When you say the order should be NE-NW-SE-SW, do you mean the NE of the model,or the NE of the map? Also, what about when it's the NE of the model, but you had to rotate your model to fit it into the lot structure?


steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#11

Posted 23 July 2006 - 11:46 PM

Points are always in absolute world coordinates, there is no way to attach them to objects or anything. So yea, no matter how you rotate your lot, you have to know its final position on the map - in Max you'd rotate it, move it to the right position, and then find the coords for the water poly.

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#12

Posted 27 July 2006 - 11:00 AM Edited by mickarrow, 27 July 2006 - 04:54 PM.

I hate even numbers sneaky2.gif

user posted image

Is there really no way around this? Now it looks like my pool has a leak somewhere smile.gif .


Also, even though I used parameter 3, it's just a surface. There's no depth.

Edit:: I just checked parameter 1 (ocean) too, but still just a surface. Dertyjerzian might be right when he said that an undergoing ocean cancels out the physical effect.

Next test: cutting a whole in the ocean where my pool is. suicidal.gif

-------------------------
Edit::

Test completed:

Apart from missing 2 large chunks of ocean, I defenitaly got a hole where the pool water should be.

user posted image


An, idd, removing the underlaying water gives back the 'physical' effects of the above water.

user posted image


As for the skyscraper theory: It is possible to have different pools above each other, but they will use only a moving texture and have no swim-ability.
(Maybe if the different levels of water are further appart?? But I doubt it.)


---------------------

Edit::

I checked my code, and it seems I forgot 2 -'s, so it showed 3000 in stead of -3000. So now the 2 missing pieces of ocean are back.


New problem:

user posted image

The different pieces of ocean I had to make to cut a hole in it, do not match.
It seems only the 2 big ones (the previous missing ones) have got waves, while the 2 smaller ones don't ( the strip you see in the 2nd pic.)
Can this be 'caused by the fact that I made them run right upto the point where my elevated pool is (+ 8 on the Z-axis)?

Here's the code I use:
processed
3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 -3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 1
-572.0 -206.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 -572.0 -224.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -224.0 0.0 0.0 0.0 0.0 0.0 1
3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 -560.0 -206.0 0.0 0.0 0.0 0.0 0.0 3000.0 -224.0 0.0 0.0 0.0 0.0 0.0 -560.0 -224.0 0.0 0.0 0.0 0.0 0.0 1
3000.0 -224.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -224.0 0.0 0.0 0.0 0.0 0.0 3000.0 -3000.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -3000.0 0.0 0.0 0.0 0.0 0.0 1
-560.0 -206.0 8.0 0.0 0.0 0.0 0.0 -572.0 -206.0 8.0 0.0 0.0 0.0 0.0 -560.0 -224.0 8.0 0.0 0.0 0.0 0.0 -572.0 -224.0 8.0 0.0 0.0 0.0 0.0 3
[/QUOTE]

--------

Edit::
I was think it might have to do with the fact that now the different squares don't share points. Pffff....up tot the next test.

If anyone wants to join in the fun, be my guest...

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#13

Posted 27 July 2006 - 11:40 PM Edited by mickarrow, 28 July 2006 - 11:31 AM.

Yeah, double post, I know turn.gif
I didn't feel like editing an overedited post even more, plus I got the test results.

If you want to add, let's say, a pool with working (swimeable) water, you'll have to make sure there's no existing water running under your pool. You'll have to make a gap in the ocean where you want your pool to be.

Now, for different pieces of ocean to work correctly (read: smooth transition between pieces) after you made the gap, you'll have to define each point of the grid you made. (It sounds harder then it is)


Below is an example:
(Don't mind the triangles, I only used Zmod as a reference example)
Look at the points.


Bad example:

user posted image


Good example

user posted image


If you use the Bad example, you'll get what I encountered in my 4th pic of my previous post.


-----------------

UPDATE::

GREAT NEWS!! biggrin.gif

I just found out rounded numbers are NOT necessary on the Z-axis.
However, the number before the comma still needs to be an even number. But seeing you can work after the comma now, that's not really an issue anymore.

Good example: 20.0 16.0 6.415
Bad example: 20.0 16.0 7.0

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#14

Posted 28 July 2006 - 05:55 PM

Well, Myriad will have no water below the landmasses of course, so people won't need to cut holes into the ocean. But I did test multiple layers of water, and they did work back then, maybe there's a minimum distance.

And yes, rounded/even numbers only for X and Y, you should've read the first post more carefully. tounge.gif

As for those illustrations of a water gap and 8 rectangles around it, I'm pretty sure you can also cut that down to 4 parallelograms.

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#15

Posted 28 July 2006 - 07:20 PM

QUOTE
But I did test multiple layers of water, and they did work back then, maybe there's a minimum distance.


I guess so. 'Cause my water (8 on the Z-axis) didn't work while the ocean (0 on the x-axis) ran underneath it. It did so when I cut a hole in the ocean.


QUOTE
Well, Myriad will have no water below the landmasses of course,


Why not? If it's possible, and someone makes a lot that could use it, why not do it. It's not as if the water.dat is going to slow the game down. I was planning to cut out the ocean where the islands are, so people could in any case, mimimum distance or not, have swimable water.


QUOTE
And yes, rounded/even numbers only for X and Y, you should've read the first post more carefully.


You know, I really should have suicidal.gif tounge2.gif It would've saved me some testing.


QUOTE
As for those illustrations of a water gap and 8 rectangles around it, I'm pretty sure you can also cut that down to 4 parallelograms.


I know, but that wasn't the point of the illustrations. It was to show how to avoid my previous problem.

ocram88
  • ocram88

    Mapper & Mission Scripter

  • Members
  • Joined: 16 May 2004

#16

Posted 28 July 2006 - 10:11 PM

water.dat is a nice topic^^

here an old max script of me for the water.dat of SA

Click

steve-m
  • steve-m

  • Feroci Racing
  • Joined: 26 Jul 2002

#17

Posted 29 July 2006 - 12:49 PM

QUOTE (mickarrow @ Jul 28 2006, 21:20)
QUOTE
Well, Myriad will have no water below the landmasses of course,


Why not? If it's possible, and someone makes a lot that could use it, why not do it. It's not as if the water.dat is going to slow the game down. I was planning to cut out the ocean where the islands are, so people could in any case, mimimum distance or not, have swimable water.

What I meant was, we would only have water where it's actually visible, not unnecessarily hidden under the landscape as in the test version (as you said in your last sentence). Just like in the original games.

sueey
  • sueey

    KILLA7 = sueey

  • Members
  • Joined: 31 Jul 2005

#18

Posted 29 July 2006 - 01:11 PM

good doc,let me see the doc!Support the poster!

mickarrow
  • mickarrow

    ---

  • Members
  • Joined: 04 Feb 2004

#19

Posted 19 August 2006 - 08:50 AM

@ Steve-M: I've been importing all the coordinates I wrote down into a new water.dat for MI, and I found out that the game only uses cubes, rectangles and triangles. Also triangles, but as far as I can tell, at least one corner must be 90.
I know you mentioned this in your first post, but afterwards you talked about parallellograms, but then none of the corners is 90 . I've also noticed that if you've written down a random 4-corner shape, the game tends to snap it to the outer world ocean bounderies, or at least make it fit the straight corner rule.

Anyone knows if this is correct? Or am I totally missing something here? biggrin.gif

Gforce
  • Gforce

    "Segregate and Rearrange" "The Hills"

  • Feroci Racing
  • Joined: 17 Sep 2003
  • United-Kingdom

#20

Posted 15 September 2006 - 11:24 PM

i recently decided to play about with how the water works ingame SA.

i found that the water plane size must be in increments of 4.

i tried numbers 38,42 and 46 and the game eventually crashed in the surrounding area of the water, sometimes (using the bad numbers) you can actually jump in the water and it acts just like any other alpha plane with a dummy col and the player will not swim but get close to one boundaries of the water and the game crashes out.

one other thing i found out is that you can create a water plane directly over another water plane but you need to use a z-axis distance between the 2 planes above 10 on each corner of the upper plane.

BenMillard
  • BenMillard

    aka Cerbera

  • Members
  • Joined: 22 Jun 2002
  • None

#21

Posted 17 September 2006 - 01:38 PM Edited by Cerbera, 17 September 2006 - 04:23 PM.

Mickarrow, nice demos but please use [code] tags around data samples:
CODE
processed
3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 -3000.0 3000.0 0.0 0.0 0.0 0.0 0.0 3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 1
-572.0 -206.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -206.0 0.0 0.0 0.0 0.0 0.0 -572.0 -224.0 0.0 0.0 0.0 0.0 0.0 -3000.0 -224.0 0.0 0.0 0.0 0.0 0.0 1
...
Makes the message easier to follow and makes any words used in the sample (such as "processed") clearly part of the sample. smile.gif

Since there's a few people happily playing with water effects, maybe someone would like to test if any cullzones affect water? Turning off the special effects when underwater would be very useful for the MISA tunnel system.

(EDIT)
QUOTE (SteveM @ Aug 22 2005, 21:27)
The parameter at the end of each line defines the water type, and can have a value from 0 to 3:
Parameter: 0 1 2 3
Visible: no yes no yes
Shallow: no no yes yes
The Parameter looks a lot like a flag value to me. The above could be written as:
  • 0 = (None)
  • 1 = Visible
  • 2 = Shallow
  • 4 = (Undefined)
  • 8 = (Undefined)
So, a value of 3 is 1 + 2 which is why it produces Visible + Shallow water. A value of 4 wouldn't use 1 or 2, so it behaves like 0. Makes sense?

(Strictly speaking, data tables should be written so their headers go across the tops of the columns.)

BenMillard
  • BenMillard

    aka Cerbera

  • Members
  • Joined: 22 Jun 2002
  • None

#22

Posted 09 February 2007 - 03:00 AM

Following up with more findings, so hopefully the bump is OK

Comments
  • You can have as many comment lines as you like between the processed section label and the first line of data.
  • Comments at the ends of data lines are fine. Even putting a comment at the end of the final data line is fine.
  • If you put commented lines between data lines you can get very, very strange side effects in-game. For examples, these rectangles which meet the game boundary got split into triangles:
    user posted image
    1280 x 1024, 106kB.

    Removing the comment lines which were between data lines fixed the problem. So if you experience weirdness then check where your comments are. smile.gif
Water Types
  • 0 = Ocean: infinite depth, invisible surface.
  • 1 = Ocean: infinite depth, visible surface.
  • 2 = Pool: 6 units deep, invisible surface.
  • 3 = Pool: 6 units deep, visible surface.
If you stack pool water less than 4.6 units apart, you'll get a smooth transition when diving between them. This enables you to make deeper pools and lakes without making them infinite depth.

The space beneath pool water does not get dark, unlike the space below ocean water. This means you can have tunnels beneath pool water right down to -100z and still have normal light levels.

Cullzones
As far as I can tell, cullzones have no effect on water.

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#23

Posted 07 November 2011 - 12:16 AM

Sorry for the super major bump here but has anyone ever experienced the water disappearing as you approach? I added 1 water plane to the default dat and whenever i approach the ocean it begins to disappear! I even tried deleting the ocean under my water plain to no avail. i have used numerous different codes and all the same result. Delete the line and the problem is gone. sad.gif

ThePrince
  • ThePrince

    Moroccan Modder

  • Members
  • Joined: 28 Oct 2011

#24

Posted 07 November 2011 - 06:08 PM

this should be on tutorial section .. icon14.gif

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#25

Posted 07 November 2011 - 10:13 PM

The prince! My hero!!!!

There is a lot of good info. Whenever i add a water plane to my default dat the water develops this problem but if i delete one and then add mine it works fine. tounge.gif

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#26

Posted 08 March 2012 - 05:14 PM Edited by kal-el5676, 08 March 2012 - 06:34 PM.

Working with water dat is simply put a nightmare. Editing existing water now ALWAYS causes the water to disappear.

Sometimes deleting other water box's is necessary.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Members
  • Joined: 10 Jan 2005
  • European-Union

#27

Posted 08 March 2012 - 06:51 PM

QUOTE (kal-el5676 @ Thursday, Mar 8 2012, 17:14)
Working with water dat is simply put a nightmare. Editing existing water now ALWAYS causes the water to disappear.

Sometimes deleting other water box's is necessary.

Can't confirm. Maybe you lost the overview.
Just take care by importing and exporting.
And important is that the water plane size must be in increments of 4 like Gforce montoined
Or do you think it have a limit for the inserted lines?

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#28

Posted 08 March 2012 - 07:17 PM

Indeed. After adding a water box and getting glitches i played with the values to no avail. Afterwards i deleted a default water box and it works. Any number over the default number of water box's causes major glitches in my game.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users