# Fluid Simulation Like In Creeper World 1 And 3

This topic is 856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I'm looking into 'unusual' tower defense games and creeper world 1 and 3 stand as such.

They are strategy/tower defense where you fight a very tar like fluid.

Here's the game's page (gameplay video included in trailer): http://knucklecracker.com/creeperworld3/cw3.php

I'm looking into tips on how to implement that kind of fluid.

I was thinking of a 2D grid of which I have two copies and do sort of back and forth (double buffering) between them, spreading the fluid according to some rule (each tile = average of all neighbours). I whipped a prototype up in few minutes and it's so-so.

But I'm still looking for tips or resources on how to implement that well, in particular:

• data structure and the algorithm itself
• two hostile to each other fluids (there is a mechanic where you can create your own fluid that kills the enemy fluid but otherwise acts the same)
• tar-like physics, not water-like, but most preferably behaviour adjustable by few (many) parameters to the simulation
• ability to arbitrarily modify/add/remove fluid and for the rest to adapt to that, move into unoccupied place, etc.

##### Share on other sites
There's basically two parts:
1. Figure out the edge tiles.
2. Figure out how to grow the edge tiles.

For #1 you can just scan the whole grid every frame, and any creep that borders non-creep is an edge tile. For #2 there's a lot of options, but I'd do a percentage thing. Pick a percent based on the material viscosity. Every frame, grow X% of the edge tiles in some random direction, perhaps weighted on the number of adjacent edges. Counterfluid is just fluid that considers other fluid to be empty space (but possibly weighted differently). These kinds of things are always more about fiddling with stuff until you get something satisfactory.

You'll need a smarter algorithm for #1 on extremely large grids, but you'd be surprised how far it can go. With stuff like decreeping bombs, doing things densely like that will save you a lot of headache.

1. 1
2. 2
3. 3
Rutin
20
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013178
×