r/truegamedev • u/VortexCortex • Feb 14 '14
Marching Liquid Squares - Efficient tiling with two boundary shapes: Liquids & Squares
62
Upvotes
r/truegamedev • u/VortexCortex • Feb 14 '14
3
u/VortexCortex Feb 15 '14 edited Feb 15 '14
Thanks for the interest. I had a few minutes at lunch so I updated the image.
I fixed a couple of typos, and made a better example graphic to show what's going on more clearly.
The pseudo code is now agnostic to order of operations (since C didn't like it). I also removed possible undefined behavior for some languages where shifting by negative values isn't allowed, and explained what further optimizations could be done to make it screaming fast.
I changed some terminology to describe a more general purpose use case so it's easier to tell what the system is trying to achieve, i.e., why one would use this in place of traditional marching squares.
Also, someone asked about the copyright at the bottom: That's really just a footer for my design doc which is copyright (CC3 by), but yet unreleased in totality. The example code is so short it would fall under fair use, especially if you changed any of it or renamed the vars, optimized it, etc. Posting it to imgur counts as publishing publicly and means I accepted their license for redistribution. In other words: Feel free to use the algorithm. You can't invent math, I just discovered this particular algorithm and explained the way some numbers naturally work together: It's just math, and math is free.
2
u/professorlava Mar 06 '14
I'm a bit confused. I'm seeing tiles that look identical at least superficially. (D2,D3),(E1,E3). What's the deal?
And I'm not really familiar with marching squares in a 2D sense (ironically) but rather a 3d sense, where empty space is obviously air. In a 2d context, I am not sure what to think about empty space, since it isn't necessarily a side scroller. Any insight?
2
u/[deleted] Feb 15 '14
Very nice!
0
u/[deleted] Feb 14 '14
[deleted] — view deleted comment