<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jop Wielens &#187; corn pops</title>
	<atom:link href="http://www.interactionfigure.nl/tag/corn-pops/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.interactionfigure.nl</link>
	<description>Actionscript experiments and general weirdness</description>
	<lastBuildDate>Wed, 14 Jul 2010 14:31:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CornPops Challenge live on MiniClip</title>
		<link>http://www.interactionfigure.nl/2009/cornpops-challenge-live-on-miniclip/</link>
		<comments>http://www.interactionfigure.nl/2009/cornpops-challenge-live-on-miniclip/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 11:30:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Digital Outlook]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[corn pops]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[miniclip]]></category>

		<guid isPermaLink="false">http://www.interactionfigure.nl/?p=17</guid>
		<description><![CDATA[This is a rebuild post from last year. The game went live at the end of August 2008. Still going strong though Big day yesterday, the game I’ve been working on for pretty much the whole of August has gone live on Miniclip. It’s an advergame we built at Digital-Outlook for the Corn Pops cereal. [...]]]></description>
			<content:encoded><![CDATA[<p>This is a rebuild post from last year. The game went live at the end of August 2008. Still going strong though <img src='http://www.interactionfigure.nl/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Big day yesterday, the game I’ve been working on for pretty much the whole of August has gone <a title="CornPops Challenge on Miniclip" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.miniclip.com');" href="http://www.miniclip.com/games/corn-pops-challenge/en/">live on Miniclip</a>. It’s an advergame we built at <a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.digital-outlook.com');" href="http://www.digital-outlook.com/">Digital-Outlook</a> for the Corn Pops cereal.</p>
<p style="text-align: center;"><img src="http://www.interactionfigure.nl/images/cornpops_mainpage.jpg" alt="CornPops on the main page" width="290" height="214" /><img src="http://www.interactionfigure.nl/images/cornpops_endscreen.jpg" alt="Endscreen with me in it" width="290" height="214" /></p>
<p>This was my most advanced game to date, involving a lot of physics. Building it had extreme ups and extreme downs, it really was the summer of physics for me. A nice little bonus was that I have a cameo in the end screen wearing a mullet wig…</p>
<p>I opted to build the engine myself instead of using one of the readily available Flash physics engines like <a onclick="javascript:pageTracker._trackPageview('/outbound/article/box2dflash.sourceforge.net');" href="http://box2dflash.sourceforge.net/">Box2D</a>. The main reason was that I just really like to know how it works and find great joy in figuring out these difficult math &amp; physics problems.</p>
<p>If you ever want to build an engine like this yourself you might want to check out these useful links:</p>
<ul>
<li><a onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" href="http://en.wikipedia.org/wiki/Elastic_collision">Elastic collision</a> on Wikipedia.</li>
<li><a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.phy.ntnu.edu.tw');" href="http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=4">2D collisions</a> explained by Fu-Kwun Hwang</li>
<li><a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.tonypa.pri.ee');" href="http://www.tonypa.pri.ee/vectors/tut01.html">Ball vs line collisions</a> in Flash</li>
<li><a onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" href="http://en.wikipedia.org/wiki/Verlet_integration">Verlet integration</a> on Wikipedia</li>
</ul>
<p>I think one of the main things that caused a lot of gray hairs was the fact that the engine can work well for 15 seconds and then all of a sudden something happens that makes the ball go through something it shouldn’t go through. You really learn to debug properly.</p>
<p>In a nutshell this is how it works:</p>
<ul>
<li>define your objects. Walls are a bunch of vectors that go between 2 points. They don’t move. A ball is basically a point with a radius. It also gets a mass for ball to ball collisions. And a rag doll is a bunch of points that need to stay together using Inverse kinematics.</li>
<li>Once it is all defined you go through your list of objects checking if a collision is about to happen in this frame, the collision detection. You basically want to find out the time within this frame that the collision happens. Let’s say the first collision happens at ‘t=0.4′ (t=0 is the start of the frame, t=1 is the end of the frame). Then you move everything up to t=0.4 in the frame.</li>
<li>Now comes big step number two, the collision handling. You need to deal with different style collisions in a different way. The options I had in this game were ball-ball, ball-line or point-line. You pick the right one and then you deal with the collision adjusting the speed from the objects in collision.</li>
<li>Once that is done I have a look if another collision will happen after t=0.4. If so repeat the 2 points above until you’ve reached t=1 and you move onto the next frame.</li>
</ul>
<p>Now go and enjoy the game over at <a title="CornPops" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.miniclip.com');" href="http://www.miniclip.com/games/corn-pops-challenge/en/">Miniclip </a> <img class="wp-smiley" src="../wp-includes/images/smilies/icon_smile.gif" alt=":-)" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactionfigure.nl/2009/cornpops-challenge-live-on-miniclip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
