Terraria-style Fluid Dynamics

Get help using Construct 2

Post » Tue Feb 07, 2012 3:58 pm

For those who haven't played Terraria, this video shows how fluid physics work in Terraria. It doesn't show things like air pockets, but still.

Long story short, I can imagine doing something like this could be somewhat complex, especially without "Offset Collision" conditions that Classic has. And I personally am not sure where to start with something like this, though I would really like to be able to create proper fluid dynamics, even if they're blocky fluids.

So, yeah. Any ideas? I imagine some of you smart fellows might take this request as a challenge, heh.

Edit: Hell, if any of you guys somehow take it one step further and do proper fluid dynamics like in that "Where's my water?" game on the iOS, that would be awesome as well. I'm really curious as to how those developers managed to pull it off. Probably asking a bit much, but, one can hope. Candescence2012-02-07 16:01:33
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Tue Feb 07, 2012 4:15 pm

did something like that on cc some month ago
waterSim.exe
Basically it's an algorithm called "cellular automata".
It's Array based:
Foreach cell that have water, check the surrounding bottom cell and transfer water if empty.
My example handle communicating vessels (which makes it a bit more complicated, you don't transfert water anymore but mass, and you put exces on top), terraria doesn't.
But anyway it's pretty heavy in a large scale, event in cc.Yann2012-02-07 16:17:12
Last edited by Yann on Sun Sep 14, 2014 10:13 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Feb 07, 2012 9:15 pm

There's an article about CAs for water & fire in the book "Game Programming Gems 3". Get the book or ask the author Tom Forsyth (tomf_at_muckfoot.com) for a PDF.

Found it:
http://home.comcast.net/~tom_forsyth/papers/cellular_automata_for_physical_modelling.htmlCross_2012-02-07 21:16:22
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Wed Feb 08, 2012 6:55 am

Well, that's fascinating. That being said, I imagine it would require two main things: Arrays/XML files, and being able to save arrays/XMLs. And C2 can only do arrays, but not save them. So... Yeah. A bit of a problem.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Wed Feb 08, 2012 9:36 am

The main issue really is CPU if you plan to work on big worlds like Terraria.
I don't know why you would need xml though.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Feb 08, 2012 10:59 am

Well, to actually save stuff, like changes to tiles, and whatnot. Probably the only file format to hold data like that would work with HTML5, it's not like we're gonna be using ini files. :p

Arrays for storing tile data during runtime, XMLs for saving them. That works.Candescence2012-02-08 11:00:46
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Thu Feb 09, 2012 11:57 am

CSV ? :D
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Jun 26, 2013 2:06 pm

Virus !!!!!!!!!!!!!!!!
B
1
Posts: 4
Reputation: 162


Return to How do I....?

Who is online

Users browsing this forum: Lof, Yahoo [Bot] and 28 guests