<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How To Make a &#8220;Falling Sand&#8221; Style Water Simulation</title>
	<atom:link href="http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/feed/" rel="self" type="application/rss+xml" />
	<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/</link>
	<description>A blog about web development, software business, and WordPress</description>
	<lastBuildDate>Tue, 22 May 2012 04:00:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: TenCashMan</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-198682</link>
		<dc:creator>TenCashMan</dc:creator>
		<pubDate>Tue, 13 Mar 2012 01:23:10 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-198682</guid>
		<description>Ok, I tried to make another falling sands kinda game for PC (c++ and allegro) and I am running into alot of trouble.

Sand doesn&#039;t fall down correctly going to the... right side. It stacks up and flows down one layer at a time, but it works fine going to the right side.
Also sometimes when it goes to the right side, it forms &quot;cacti&quot; so to speak. The water will sometimes start going in random directions before falling the down.

It&#039;s probably pretty hard to look at, but here is the if statements for when water should move.
http://pastebin.com/ZSP71r8S

I would appreciate any help.</description>
		<content:encoded><![CDATA[<p>Ok, I tried to make another falling sands kinda game for PC (c++ and allegro) and I am running into alot of trouble.</p>
<p>Sand doesn&#8217;t fall down correctly going to the&#8230; right side. It stacks up and flows down one layer at a time, but it works fine going to the right side.<br />
Also sometimes when it goes to the right side, it forms &#8220;cacti&#8221; so to speak. The water will sometimes start going in random directions before falling the down.</p>
<p>It&#8217;s probably pretty hard to look at, but here is the if statements for when water should move.<br />
<a href="http://pastebin.com/ZSP71r8S" rel="nofollow">http://pastebin.com/ZSP71r8S</a></p>
<p>I would appreciate any help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jānis Elsts</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-198263</link>
		<dc:creator>Jānis Elsts</dc:creator>
		<pubDate>Tue, 21 Feb 2012 09:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-198263</guid>
		<description>Just try it and see how it plays. That&#039;s probably the best advice I can give.</description>
		<content:encoded><![CDATA[<p>Just try it and see how it plays. That&#8217;s probably the best advice I can give.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TenCashMan</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-198257</link>
		<dc:creator>TenCashMan</dc:creator>
		<pubDate>Tue, 21 Feb 2012 03:10:38 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-198257</guid>
		<description>I would like to say thanks a lot for this post!
I have been looking for something like this!

With this post I was able to put together a small falling sands app for the psp!
Thanks man!

Also, In some falling sands games (well, most actually) you see particles have random left and right movements as they fall, would it be wise to implement that into the program?</description>
		<content:encoded><![CDATA[<p>I would like to say thanks a lot for this post!<br />
I have been looking for something like this!</p>
<p>With this post I was able to put together a small falling sands app for the psp!<br />
Thanks man!</p>
<p>Also, In some falling sands games (well, most actually) you see particles have random left and right movements as they fall, would it be wise to implement that into the program?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-171433</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Thu, 14 Jul 2011 08:59:59 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-171433</guid>
		<description>Ah, now I see it. 

One possible way to fix the problem would be to only allow a sand particle to move left/right if both the corresponding diagonal &lt;em&gt;and&lt;/em&gt; horizontal neighbours are empty:

&lt;pre lang=&quot;java&quot;&gt;
if ((x &gt; 0) &amp;&amp; (sand[x - 1][y + 1] == 0) &amp;&amp; (sand[x - 1][y] == 0)) {
	left = true;
}

if ((x &lt; (WIDTH - 1)) &amp;&amp; (sand[x + 1][y + 1] == 0) &amp;&amp; (sand[x + 1][y] == 0)) {
	right = true;
}
&lt;/pre&gt;

(I haven&#039;t tried this myself.)</description>
		<content:encoded><![CDATA[<p>Ah, now I see it. </p>
<p>One possible way to fix the problem would be to only allow a sand particle to move left/right if both the corresponding diagonal <em>and</em> horizontal neighbours are empty:</p>
<pre lang="java">
if ((x > 0) &#038;&#038; (sand[x - 1][y + 1] == 0) &#038;&#038; (sand[x - 1][y] == 0)) {
	left = true;
}

if ((x < (WIDTH - 1)) &#038;&#038; (sand[x + 1][y + 1] == 0) &#038;&#038; (sand[x + 1][y] == 0)) {
	right = true;
}
</pre>
<p>(I haven't tried this myself.)</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: shpen</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-171420</link>
		<dc:creator>shpen</dc:creator>
		<pubDate>Wed, 13 Jul 2011 18:47:38 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-171420</guid>
		<description>I&#039;m actually going from top to bottom, but bottom to top still causes the same problem.

Maybe you can take a look at my source and help me figure out what&#039;s wrong:
http://dl.dropbox.com/u/77961/GameTemplate.java

Also, here&#039;s a jar which will show you what the problem looks like:
http://dl.dropbox.com/u/77961/SandTest.jar

Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;m actually going from top to bottom, but bottom to top still causes the same problem.</p>
<p>Maybe you can take a look at my source and help me figure out what&#8217;s wrong:<br />
<a href="http://dl.dropbox.com/u/77961/GameTemplate.java" rel="nofollow">http://dl.dropbox.com/u/77961/GameTemplate.java</a></p>
<p>Also, here&#8217;s a jar which will show you what the problem looks like:<br />
<a href="http://dl.dropbox.com/u/77961/SandTest.jar" rel="nofollow">http://dl.dropbox.com/u/77961/SandTest.jar</a></p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-171396</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Wed, 13 Jul 2011 06:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-171396</guid>
		<description>Hmm, I don&#039;t see how that could happen. If you&#039;re iterating left to right, bottom up, the entire lower line should fall down &quot;at once&quot;, from the perspective of the simulation.</description>
		<content:encoded><![CDATA[<p>Hmm, I don&#8217;t see how that could happen. If you&#8217;re iterating left to right, bottom up, the entire lower line should fall down &#8220;at once&#8221;, from the perspective of the simulation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shpen</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-171380</link>
		<dc:creator>shpen</dc:creator>
		<pubDate>Wed, 13 Jul 2011 01:38:06 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-171380</guid>
		<description>I&#039;m having problems with creating an even falling pattern. Because I am iterating through each sand particle one by one, from left to right, the sand tends to fall to the left, since a slot on the left is opened before one on the right. Is there any way to fix this and cause an even falling pattern?</description>
		<content:encoded><![CDATA[<p>I&#8217;m having problems with creating an even falling pattern. Because I am iterating through each sand particle one by one, from left to right, the sand tends to fall to the left, since a slot on the left is opened before one on the right. Is there any way to fix this and cause an even falling pattern?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: White Shadow</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-148927</link>
		<dc:creator>White Shadow</dc:creator>
		<pubDate>Tue, 21 Dec 2010 23:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-148927</guid>
		<description>True, but I suspect performance would suffer if you copied the entire world (twice!) every frame.</description>
		<content:encoded><![CDATA[<p>True, but I suspect performance would suffer if you copied the entire world (twice!) every frame.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-148859</link>
		<dc:creator>Grant</dc:creator>
		<pubDate>Tue, 21 Dec 2010 21:19:38 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-148859</guid>
		<description>Whoops! Instead of &quot;...but modified the copy array...&quot;, it should read &quot;...but modifies the copy array...&quot;</description>
		<content:encoded><![CDATA[<p>Whoops! Instead of &#8220;&#8230;but modified the copy array&#8230;&#8221;, it should read &#8220;&#8230;but modifies the copy array&#8230;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant</title>
		<link>http://w-shadow.com/blog/2009/09/29/falling-sand-style-water-simulation/comment-page-1/#comment-148857</link>
		<dc:creator>Grant</dc:creator>
		<pubDate>Tue, 21 Dec 2010 21:18:41 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/?p=1295#comment-148857</guid>
		<description>There is a very easy fix for the &quot;teleporting&quot; problem. Before the main loop (updating every tile), copy the entire world into a &quot;copy&quot; array. Then, whenever a particle is updated, it gets its information about the world from the original array, but modified the copy array. At the end of the main loop, you copy every value from the &quot;copy&quot; array into the origininal array. The reason it works is: every particle gets its information from a non-updated array! No particle can influence another particle DURING the updating process!</description>
		<content:encoded><![CDATA[<p>There is a very easy fix for the &#8220;teleporting&#8221; problem. Before the main loop (updating every tile), copy the entire world into a &#8220;copy&#8221; array. Then, whenever a particle is updated, it gets its information about the world from the original array, but modified the copy array. At the end of the main loop, you copy every value from the &#8220;copy&#8221; array into the origininal array. The reason it works is: every particle gets its information from a non-updated array! No particle can influence another particle DURING the updating process!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

