water vs earth

Posted By: slowglider

water vs earth - 08/10/08 19:28

i want to make a digging simulater but now i want to know if there is water ore not because if you build a hill and you make a hole in it there is no water in the hole but out of there there is and if the water is rising the hill gets unter water so the hole to but if the water is getting down there is still water in the hole

now am i seaching for some algoritme, ideas, tips, code, enz.

i ones made my own but its was very heavy and not perfect

every help is welcome

slowglider
Posted By: Michael_Schwarz

Re: water vs earth - 08/11/08 08:25

what?
Posted By: TigerTao

Re: water vs earth - 08/11/08 12:12

What I think he means is that he wants to find a way for when a hill with a hole on top is submerged in water and the water drains away, the water in the hole is left behind.

I can think of a 2D method but a 3D method could be quite complicated.
Posted By: slowglider

Re: water vs earth - 08/11/08 17:57

yes tigertao is right i am not realy good in engilsh so thx

please post your idee mostly 2d can be don in 3d to because if you look from top view its almost the same

more ideas ore comments are welcome
Posted By: Joozey

Re: water vs earth - 08/12/08 00:42

I think it's not the algorithm that causes a problem for 3D, it's the way you want to display it. The "graphic behaviour" of water can't be done as easy in 3d as you would do it in 2d.
Posted By: Trooper119

Re: water vs earth - 08/12/08 17:28

Alright, normally I would leave this kind of post alone but this idea really intrigues me. One question needs to be answered before I can really help you out though. What scale are you looking for. I think others were saying 2d and 3d are a big difference was because if you used particles you could do it easily. But only a small number of particles could be done this way before it got out of control and takes up all your CPU's power. So are we talking a small pond, a lake, ocean, what?

Also what kind of deformation speeds are we looking at here? If calculations need to be done quickly due to a large area being changed quickly some techniques can't be done.

Are you doing an RTS and doing a top-down view? Or are you just saying that for reference? Are you using a box or mesh for the water, or particles, or something else? Also how accurate does this need to be, does it just need to look nice or are we simulating real water here?

Based on what you said I'll give my best idea a foot forward. What I would suggest is if you are using particles all you need to do is give them some physics, tell them to fall until something obstructs them and bounce with a certain trajectory (according to what the normal of what the water contacts with) and that would solve your problem easily, however is computer intensive with massive volumes of particles.
Probably over a large area, if you aren't looking for super accurate results you could combine blocks of water with particles of water, I'll go into more detail:
You have a box that is serving as your water, this, for whatever reason you decide, is told to lower because of the water going somewhere else. Either a invisible box, or a bunch of rays will lower with the water to look for for obstructions for the water. You take water particles and bounce them off this obstruction for a small distance, if it hits water, it expands the water by a extremely small amount, if it hits land, it records the distance it moved, and bounces again, if it doesn't move a certain amount and hasn't hit water it creates its own water block of the water in the area. Every water droplet (particle) will either create its own water box or find its way to an existing block of water when it can't move anymore.
Things to watch out for: The water droplets "contribution" to the water supply it finds has to be really small. All the particles of water formed during a drop in the main water box has to have a smaller "contribution" then what is dropped by the main water box, otherwise an infinite loop will arise.

I really hope this is a main part of your game because unless your designing a small field to put this in (and can use the particle method), this could take up a lot of effort to make. Otherwise I suggest that unless you have a large amount of programming experience and want to do this on a large scale, this just isn't a smart use of resources for a minimal part of a game.

Good luck,
Trooper119
Posted By: slowglider

Re: water vs earth - 08/12/08 18:21

thx for your post

i want to make a 3d rts style dike(nl:dijk)creator simulater

the idea was to create a sort off logorithime that calulate when the see is going down and up

this hasnt be done every single frame but maby every 1/2 sec so you wont notice

i know that is is going to be very cpu heavy so i want to create somthing like 1km * 1km so the terain while be somthing like 1000*1000
my first try did use al my cpu whiteout any thing in my lvl because rts style cost alot of ai so cpu

i didnt want to use traces i have 2 terains above each other white the same size en vertex only differnet texure's
i use vec_for_mesh and vec_to_mesh to calulate the distance from each other

btw i didnt want to use pshycic because i dont like it

about the 2d:
if you do it like pic1 it could be easyer then when calutated then pic2

pic1

pic2

i was more looking for pic2

but now there the dijk is getting higher but the water stays the same even if i would drain everything below the dijk white a water pomp in to the sea(water)

slowglider
Posted By: Trooper119

Re: water vs earth - 08/12/08 21:14

For that particular issue, why don't you just lower the water? It should work just fine, my example was for creating puddles from a pre-existing large water body. If your just raising and lowering things, moving the water should work just fine. Why doesn't that work?
Posted By: DJBMASTER

Re: water vs earth - 08/13/08 16:24

When the water rises and it's level is above the "DIJK" (whts that?), does he want the water to flow over the "DIJK" and down the slope, onto the land?

So a sort of waterfall is created? I'd say particles is the way to go for that.
Posted By: slowglider

Re: water vs earth - 08/13/08 17:49



this is before the player starts in the lvl


now the player has build a dijk (hill,somthing that make sure the water isnt getting to the other side) still the water is there


now the player has build a water pomp and is pomping out the water behind the dijk

small link white a demo but isnt working
http://boxstr.com/files/3146889_27xir/water.cd.zip
Posted By: MrGuest

Re: water vs earth - 08/14/08 01:49

i don't think you'll need to calculate with traces of the water height, if you just stored a global water height, then have an array 100*100 to store the water height in those areas, then:
if(global_water_height < node.water_height){
do some pumping... isn't that the effect you're trying to achieve? :\
Posted By: DJBMASTER

Re: water vs earth - 08/14/08 09:53

hmmm, is the "dijk" always going to be put in the same place or can the player choose where to put it?

If it is only in one place then you can use 2 models for either side of the water, and then lower/raise them.
Posted By: slowglider

Re: water vs earth - 08/14/08 17:40

the dijk can be put everywhere and the white other size different shape etc. because the player change the terain en then i calulate the difference

mrguest i have somthihng like that but i dont know how to calucate if there is water ore not and because teh dijk nomraly has realy not normal shape but just every shape there is posible

and i want more then 100*100 lets say 1000*1000 and higher

thx slowglider
Posted By: testDummy

Re: water vs earth - 08/15/08 19:53

*dynamically resize water entities
*split water entities -> two from one
---than remove one on side of ditch
*join water entities -> one from two
---remove extra
*tile system
---raise lower terrain in chunks
---smooth chunks for hills / ditches (ramp procedure)
---save out to hmp / mdl format
*system to store water entity chunk states (with tile system)
---3d bounding checks (cube, etc.)
---on raise
------if intersection
----------split water entity
----------two from one
----------scale / translate two water entities
Other than that:
Quoting Michael_Schwarz.
Quote:
what?

Posted By: Pappenheimer

Re: water vs earth - 08/15/08 23:04

Okey, I can't resist, too, to solve this question! smile

My suggestion:
- 2 big identical terrains: one for the ground, one for the water.
- 2 times: one before pumping, one after starting to pump

- the dike is build by rising the vertices of the ground terrain, until they are above the water terrain
- when the dike is closed/complete, the water vertices test whether the corresponding vertices of the ground is under it, and if it id, it is written in a list
- then you have to place a pump on the dike with the direction from land to ocean, this pump should have two parts, each part on one side of the dike: one part for the 'in' side (the land), one part for the 'out' side (the ocean)
- now, each vertex of the water traces to the pump; when it reaches the pump at its out side, it is written in a list of the 'ocean vertices', vice versa
in case it doesn't reach the pump, but the ground terrain is in its way, it traces to each vertex of the 'ocean vertices' until it reaches one of them, then it is written into the 'ocean list', if it doesn't reach any of that vertices, it traces to the 'land vertices' until it reaches one of them, and it can be added to the list.

Now, you have to lists of vertices which you can tread depending it belongs to the ocean or to the to be drained land side!
© 2024 lite-C Forums