how to make minecraft-like lava|water physics?

New releases and general discussions.

Post » Sat Dec 18, 2010 12:32 pm

how to make minecraft-like lava|water physics and flow?
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Sat Dec 18, 2010 12:44 pm

Top down, side view?

I would imagine side view would pretty straight forward with physics. Quasiblobs? :P
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Dec 18, 2010 12:46 pm

[quote="newt":qcp8gelt]Top down, side view?

I would imagine side view would pretty straight forward with physics. Quasiblobs? :P[/quote:qcp8gelt]
side
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Sat Dec 18, 2010 6:55 pm

[quote="newt":1m3w5mm4]I would imagine side view would pretty straight forward with physics. [/quote:1m3w5mm4]
Minecraft doesn't use physics for the fluid. It's just a 3d falling sand type of "fluid" solver. Search the forums aolko, Quazi made a falling sand sim a long time ago. It's a lot of events however and it's quite cpu intensive. Your best bet is to work off of that code.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat Dec 18, 2010 11:29 pm

I think the way Notch approached water/lava in MineCraft doesn't require a lot of CPU, as he didn't go for ultra-realistic.

He has source blocks that water/lava can flow from, with a maximum distance of 8 squares from the source block.
If you have MineCraft, put a source block near the edge of the terrain, and you'll see that there is no limit to the drop, and that it either continues the 8 count or restarts it when it hits land (I forget which).

Also, it doesn't update every tick.
Far from it.
Water seems to update a few times a second when it's spreading, and lava seems to update every few seconds.

So it's not down to masses of computations, but more down to clever logic with timed updates.
And of course, you only need to update the flow of a source block if it's surrounding terrain changes.

It shouldn't be too difficult to get it working in 2D, but will probably take quite a bit of tweaking when in place (as Notch had to).

Krush.
B
2
S
2
G
3
Posts: 406
Reputation: 2,062

Post » Wed Dec 22, 2010 6:22 pm

[quote="Davioware":1wg3tryg][quote="newt":1wg3tryg]I would imagine side view would pretty straight forward with physics. [/quote:1wg3tryg]
Quazi made a falling sand sim a long time ago. It's a lot of events however and it's quite cpu intensive. Your best bet is to work off of that code.[/quote:1wg3tryg]
And that file got deleted
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Wed Dec 22, 2010 7:27 pm

Here's my attempt at creating this:

[url:14tbdh5y]http://dl.dropbox.com/u/5426011/examples3/water2.cap[/url:14tbdh5y] made in 0.99.96

It works well visually but requires a pretty much static environment. AKA it doesn't allow you to drain a body of water but it fills it nicely.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Wed Dec 22, 2010 8:55 pm

[quote="R0J0hound":3vjki96y]Here's my attempt at creating this:

[url:3vjki96y]http://dl.dropbox.com/u/5426011/examples3/water2.cap[/url:3vjki96y] made in 0.99.96

It works well visually but requires a pretty much static environment. AKA it doesn't allow you to drain a body of water but it fills it nicely.[/quote:3vjki96y]
ok
that was fast :D
how to slow down it a bit? AND what about exporting to another projects?
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Wed Dec 22, 2010 9:04 pm

You could set up an every x milliseconds event, just have to rearrange the events some.
As to the exporting... you can either study the cap and figure out whats going on, or perhaps someone could come up with a python version.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Wed Dec 22, 2010 9:08 pm

[non-construct]
So, basically what do i need to make a minecraft fork?
---
Knowledge of java? I think its difficult to learn + non-visual + additional libraries for graphics...
any suggestions/alternatives?
[/non-construct]
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 6 guests