<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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" version="2.0">

<channel>
	<title>Cloning the classics</title>
	
	<link>http://cloningtheclassics.com</link>
	<description>A homage to the early video arcade classics</description>
	<pubDate>Wed, 18 Jun 2008 07:09:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CloningTheClassics" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="cloningtheclassics" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Asteroids: First Playable Release</title>
		<link>http://cloningtheclassics.com/classic-arcade-games/asteroids-first-playable-release/</link>
		<comments>http://cloningtheclassics.com/classic-arcade-games/asteroids-first-playable-release/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 15:45:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Asteroids]]></category>

		<category><![CDATA[Classic arcade games]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=75</guid>
		<description><![CDATA[It has been a while since I posted about cloning the arcade classic Asteroids
So I though I would post up my work in progress clone. It is about 80% finished at this point and is an actual playable arcade clone.
So what made it to this first release?

Player movement.
Player lives and death.
Asteroids, movement and splitting.
Scores.
Sound effect [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Asteroids: First Playable Release", url: "http://cloningtheclassics.com/classic-arcade-games/asteroids-first-playable-release/" });</script>]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I posted about cloning the arcade classic <a href="http://cloningtheclassics.com/asteroids/" title="Asteroids"><strong>Asteroids</strong></a></p>
<p>So I though I would post up my work in progress clone. It is about 80% finished at this point and is an actual playable arcade clone.</p>
<p>So what made it to this first release?</p>
<ul>
<li>Player movement.</li>
<li>Player lives and death.</li>
<li>Asteroids, movement and splitting.</li>
<li>Scores.</li>
<li>Sound effect for most actions.</li>
<li>Multi language support via <a href="http://translate.google.com/translate_t" title="Google Translate" onclick="javascript:pageTracker._trackPageview ('/outbound/translate.google.com');"><strong>Google Translate</strong></a></li>
<li>Flying Saucers</li>
</ul>
<p>So what is yet to come?</p>
<ul>
<li>Online high scores</li>
<li>Player explosion animation</li>
<li>Small flying saucers shooting needs to target the player</li>
<li>Play testing and tweaking</li>
</ul>
<p>Since the list of things not in the game does not stop it from being playable I have decided to do a release now and see if I can get any feedback on it. I will release the source code to Asteroids after I have finished up the remaining items on the to do list.</p>
<p>So for now you can have fun and give Asteroids v0.11 a bash.<br />
<a href="http://cloningtheclassics.com/asteroids/play-asteroids/" title="Play Asteroids"><strong>Play Asteroids</strong></a></p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Asteroids%3A+First+Playable+Release&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fclassic-arcade-games%2Fasteroids-first-playable-release%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/classic-arcade-games/asteroids-first-playable-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Eclipse And Pulpcore Tutorial</title>
		<link>http://cloningtheclassics.com/framework/eclipse-and-pulpcore-tutorial/</link>
		<comments>http://cloningtheclassics.com/framework/eclipse-and-pulpcore-tutorial/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:47:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Framework]]></category>

		<category><![CDATA[Tutorial]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[Pulpcore]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=74</guid>
		<description><![CDATA[Just a quick post about a new tutorial I have written. How to build your basic Hello World Java Applet in Pulpcore with the Eclipse IDE.
A simple step by step tutorial with some screen shots, source code and Ant build script included.
An example Java applet can be seen here Hello world demo
The source code can [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Eclipse And Pulpcore Tutorial", url: "http://cloningtheclassics.com/framework/eclipse-and-pulpcore-tutorial/" });</script>]]></description>
			<content:encoded><![CDATA[<p>Just a quick post about a new tutorial I have written. How to build your basic Hello World Java Applet in <a href="http://cloningtheclassics.com/getting-started-with-pulpcore/" title="Pulpcore and Eclipse Tutorial"><strong>Pulpcore with the Eclipse IDE</strong></a>.</p>
<p>A simple step by step tutorial with some screen shots, source code and Ant build script included.<br />
An example Java applet can be seen here <a href="http://cloningtheclassics.com/getting-started/hello-world-demo/" title="Hello world demo"><strong>Hello world demo</strong></a><br />
The source code can be found here <a href="http://cloningtheclassics.com/wp-content/uploads/2008/05/helloworld.zip" title="Hello world source code"><strong>Hello world source code</strong></a></p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Eclipse+And+Pulpcore+Tutorial&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fframework%2Feclipse-and-pulpcore-tutorial%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/framework/eclipse-and-pulpcore-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Player Movement In Classic Asteroids Arcade Game</title>
		<link>http://cloningtheclassics.com/classic-arcade-games/player-movement-in-classic-asteroids-arcade-game/</link>
		<comments>http://cloningtheclassics.com/classic-arcade-games/player-movement-in-classic-asteroids-arcade-game/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 04:43:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Asteroids]]></category>

		<category><![CDATA[Classic arcade games]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=69</guid>
		<description><![CDATA[As noted in my previous post First clone picked: Asteroids the first classic arcade game I am going to clone will be Asteroids.
In Asteroids the player controls a triangle shaped space ship. The basic controls are rotate left, rotate right and accelerate in the direction the spaceship is currently pointed.
The spaceship will then continue to [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Player Movement In Classic Asteroids Arcade Game", url: "http://cloningtheclassics.com/classic-arcade-games/player-movement-in-classic-asteroids-arcade-game/" });</script>]]></description>
			<content:encoded><![CDATA[<p>As noted in my previous post <a href="http://cloningtheclassics.com/classic-arcade-games/first-clone-picked-asteroids/" title="First clone: Asteroids"><strong>First clone picked: Asteroids</strong></a> the first classic arcade game I am going to clone will be <a href="http://cloningtheclassics.com/asteroids/" title="Asteroids Classic Arcade Game"><strong>Asteroids</strong></a>.</p>
<p>In Asteroids the player controls a triangle shaped space ship. The basic controls are rotate left, rotate right and accelerate in the direction the spaceship is currently pointed.<br />
The spaceship will then continue to travel in the direction it is pointed at as long as the engines are still on. Once the engines are turned off the spaceship will slowly come to a halt.<br />
If the player pilots the spaceship off the edge of the screen it will reappear on the other side.</p>
<p>So on paper this all sounds pretty easy. The question is how do we program this behavior?<br />
There are several properties we will need to keep track of to enable us to make our spaceship move as described above. They are as follows.</p>
<p><strong>Thrust</strong><br />
We the player activates the spaceships engines it generates thrust. This variable controls how fast the spaceship will accelerate when the engines are activated.</p>
<p><strong>Maximum Thrust</strong><br />
If the amount of thrust is not capped the players spaceship would continue to accelerate as long as the engines are active. This variable will allow us to place a cap on the maximum speed the player can move at.</p>
<p><strong>Rotation speed</strong><br />
The player can rotate their spaceship, this variable places a cap on how fast they can rotate left or right.</p>
<p><strong>Friction</strong><br />
In Asteroids there is a friction component to the players movement. If the engines are turned off the player will drift for a short distance before coming to rest. This variable controls how fast the player slows down if they do not have the engines running.</p>
<p><strong>X and Y Velocity</strong><br />
These variables control how fast and what direction the players spaceship will move in the current game update. They are calculated from the rotation variable, thrust variable, maximum thrusts variable and the friction variable.</p>
<p>So the basic flow of calculating the players movements are<br />
If the engines are on:<br />
Calculate the current x and y velocities.<br />
Cap the x and y velocities if they are greater than the allowed maximum thrust<br />
Else<br />
Apply friction to the spaceships current x and y velocities.</p>
<p>Move the spaceship by the current x and y velocities.</p>
<p>If the spaceship has left the bounds of the screen:<br />
Wrap the spaceship to the other side.</p>
<p><strong>Calculating the current x and y velocities</strong><br />
Calculating the current velocities can be achieved by constructing a <a href="http://en.wikipedia.org/wiki/Right_triangle" title="Right Angle Triangle" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');"><strong>right angled triangle</strong></a> and using<br />
<a href="http://en.wikipedia.org/wiki/Pythagorean_theorem" title="Pythagorean theorem" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');"><strong> Pythagorean theorem</strong></a> to solve for a <a href="http://en.wikipedia.org/wiki/Hypotenuse" title="Hypotenuse" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');"><strong>hypotenuse</strong></a> with a length of 1 unit. To make this a bit easier to explain I have whipped up a quick diagram in paintbrush.</p>
<p><a href="http://cloningtheclassics.com/wp-content/uploads/2008/06/pythagorean-theorem.png"><img class="alignnone size-full wp-image-70" style="float:right; border: 1px solid #ffffff" title="Pythagorean Theorem" src="http://cloningtheclassics.com/wp-content/uploads/2008/06/pythagorean-theorem.png" alt="Pythagorean Theorem" width="200" height="200" /></a></p>
<p>The red triangle is our spaceship.<br />
The pink arc is our current rotation.<br />
The black line with the arrow is our hypotenuse with a length of 1 unit.<br />
The blue line is the length we ant to solve for our x velocity.<br />
The green line is the length we want to solve for our y velocity.</p>
<p>Pythagorean theorem for a right angled triangle states that the sine of the angle of our spaceships rotation will equal the length of the blue line divided by the hypotenuse.<br />
Since our  hypotenuse is 1 we can simplify it in this case to the length of the blue line is equal to the sine of the spaceships rotation.</p>
<p>So to calculate our x velocity for 1 unit we simply do x velocity = sine(rotation)</p>
<p>For the y velocity it is a very similar deal except instead of the sine we use the cosine.<br />
Again our hypotenuse is 1 and we can simplify the equation down to y velocity = cosine(rotation)</p>
<p>We have now calculated the x and y velocity for 1 unit of travel. Since our spaceship is moving on a screen 1 unit of travel is 1 pixel. Moving by 1 pixel every game loop if not that fast. So we simply multiply them by the thrust value. Which will give us the following.</p>
<p>x velocity = sine(rotation) * thrust<br />
y velocity = cosine(rotation) * thrust</p>
<p>So we can now work out the velocity for the thrust for the spaceships current rotation. However we are missing one more part before we can use these velocities. They have not taken into account what velocity the spaceship is all ready moving at. Imagine that you fly up the screen and turn the engines off. The spaceship will gently continue to coast up the screen. You could then rotate the ship to point down and fire the engines. It would instantly take off down the screen instead of slowing down and then start to accelerate down the screen.<br />
Luckily this is very easy to take into account. We simply add the new velocities to the old velocities.</p>
<p>Old x velocity += sine(rotation) * thrust<br />
Old y velocity -= cosine(rotation) * thrust</p>
<p>Notice that I have subtracted the new y velocity from the old velocity. This is because computer screens have the (0,0) location in the top left hand side and not the bottom left hand side. So to go up you need to use subtraction and to go down you need to use addition.</p>
<p>The next step is to cap the maximum speed of the players spaceship.<br />
This is step is easy.<br />
If x velocity &gt; maximum thrust:<br />
x velocity = maximum thrust</p>
<p>If y velocity &gt; maximum thrust:<br />
y velocity = maximum thrust</p>
<p>If x velocity &lt; -maximum thrust:<br />
x velocity = -maximum thrust</p>
<p>If y velocity &lt; -maximum thrust:<br />
y velocity = -maximum thrust</p>
<p>Applying friction to a drifting spaceship is also very easy too.<br />
x velocity =  x velocity * friction<br />
y velocity = y velocity * friction</p>
<p>Finally updating the players position and then wrapping  the players spaceship around the screen is a simple task of checking if they have crossed a screen boundary and if so setting them to the other side.</p>
<p>x = (x + xVelocity);<br />
y = (y + yVelocity);</p>
<p>if(x &lt; 0)<br />
{<br />
x = getWidth();<br />
}</p>
<p>if(x &gt; getWidth())<br />
{<br />
x = 0;<br />
}</p>
<p>if(y &lt; 0)<br />
{<br />
y = getHeight();<br />
}</p>
<p>if(y &gt; getHeight())<br />
{<br />
y = 0;<br />
}</p>
<p>Finally if none of the above made any sense you can check out a basic demo of the ideas in action below. You will need <a href="http://www.java.com/" title="Java" onclick="javascript:pageTracker._trackPageview ('/outbound/www.java.com');"><strong>Java</strong></a> installed to play it. The left and right arrow key rotate the space ship and the up key turns the engines on.<br />
The full source code is also provided. You will need to download the <a href="http://www.interactivepulp.com/pulpcore/" title="Pulpcore API" onclick="javascript:pageTracker._trackPageview ('/outbound/www.interactivepulp.com');"><strong>Pulpcore API</strong></a> to build it. I used version 0.11.3 for this example. <strong><a href="http://cloningtheclassics.com/wp-content/uploads/2008/06/asteroids-movement.zip">Asteroids Movement Source Code</a></strong></p>
<p>Play the <a href="http://cloningtheclassics.com/asteroids-movement-demo/ " title="Asteroids Movement Demo"><strong>Asteroids Movement Demo</strong></a></p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Player+Movement+In+Classic+Asteroids+Arcade+Game&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fclassic-arcade-games%2Fplayer-movement-in-classic-asteroids-arcade-game%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/classic-arcade-games/player-movement-in-classic-asteroids-arcade-game/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Transition Engine</title>
		<link>http://cloningtheclassics.com/framework/transition-engine/</link>
		<comments>http://cloningtheclassics.com/framework/transition-engine/#comments</comments>
		<pubDate>Sat, 31 May 2008 14:11:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Framework]]></category>

		<category><![CDATA[Transition Engine]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=68</guid>
		<description><![CDATA[Looking back at my last post about basic scenes you will see that I plan to implement a lot of basic functionality in my classic arcade game frame work. Another feature that I would like to implement is a simple transition engine.
What is a transition engine?
When you change from one scene to another in a [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Transition Engine", url: "http://cloningtheclassics.com/framework/transition-engine/" });</script>]]></description>
			<content:encoded><![CDATA[<p>Looking back at my last post about <a href="http://cloningtheclassics.com/framework/basic-scenes/" title="Basic Scenes"><strong>basic scenes</strong></a> you will see that I plan to implement a lot of basic functionality in my classic arcade game frame work. Another feature that I would like to implement is a simple transition engine.</p>
<p>What is a transition engine?</p>
<p>When you change from one scene to another in a <a href="http://www.interactivepulp.com/pulpcore/" title="Pulpcore" onclick="javascript:pageTracker._trackPageview ('/outbound/www.interactivepulp.com');"><strong>Pulpcore</strong></a> applet it does a straight out swap between the two scenes. The old scene is gone and the new scene is shown. It would be nice to do some thing a little bit more fancy, say a side swipe, color fade or other nifty transition effect. This is where the transition engine would come in.</p>
<p>My basic design is to make a new scene called the transition scene. The transition scene would take a parameter of Itransition. Itransition would be an interface that individual classes could implement to allow them to be used as a transition.</p>
<p>In my current prototype I have implemented a very simple transition engine in this manner. My transition interface look like the following:</p>
<div class="code">
<pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> ITransition
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #993333;">void</span> initialize<span style="color: #66cc66;">&#40;</span>Scene2D scene<span style="color: #66cc66;">&#41;</span>;
   <span style="color: #993333;">boolean</span> update<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> elapsedTime<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>As you can see the interface is pretty simple. There are only two method on the interface. And initialize that takes a scene object. This is so the transition can add sprites and groups to the current scene so it is able to draw them. The other is an update function. This lets the transition be called every game loop to update the transitions progress, when the transition is complete it can signal this by returning a false flag.</p>
<p>The transition scene is also quite simple.</p>
<div class="code">
<pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TransitionScene <span style="color: #000000; font-weight: bold;">extends</span> Scene2D
<span style="color: #66cc66;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">private</span> ITransition transition;
   <span style="color: #000000; font-weight: bold;">private</span> Scene nextScene;
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> TransitionScene<span style="color: #66cc66;">&#40;</span>ITransition transition, Scene nextScene<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">transition</span> = transition;
      <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">nextScene</span> = nextScene;
      transition.<span style="color: #006600;">initialize</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;
   <span style="color: #66cc66;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> update<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> elapsedTime<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
      <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!transition.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span>elapsedTime<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
         Stage.<span style="color: #006600;">setScene</span><span style="color: #66cc66;">&#40;</span>nextScene<span style="color: #66cc66;">&#41;</span>;
      <span style="color: #66cc66;">&#125;</span>
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>So you can see that the transition scene takes and instance of an object that implements the Itransition interface and then every game loop tells the transition to update it's self and then inform it if the transition is complete. When the transition is complete it then sets the stage to the new scene.</p>
<p>What would an implemented transition look like?</p>
<p>A transition could look like any thing as long as it implements the Itransition interface. I believe this will make it flexible enough to create nearly any transition effect I can think of.<br />
I currently have a single transition effect, it is a fade the current scene to a color effect.</p>
<div class="code">
<pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FadeToColorTransition <span style="color: #000000; font-weight: bold;">implements</span> ITransition
<span style="color: #66cc66;">&#123;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">private</span> FilledSprite background;
   <span style="color: #000000; font-weight: bold;">private</span> ImageSprite foreground;
   <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">int</span> duration;
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> FadeToColorTransition<span style="color: #66cc66;">&#40;</span>CoreImage image, <span style="color: #993333;">int</span> color, <span style="color: #993333;">int</span> duration<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
      background = <span style="color: #000000; font-weight: bold;">new</span> FilledSprite<span style="color: #66cc66;">&#40;</span>color<span style="color: #66cc66;">&#41;</span>;
      foreground = <span style="color: #000000; font-weight: bold;">new</span> ImageSprite<span style="color: #66cc66;">&#40;</span>image, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">duration</span> = duration;
   <span style="color: #66cc66;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> initialize<span style="color: #66cc66;">&#40;</span>Scene2D scene<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
      scene.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>background<span style="color: #66cc66;">&#41;</span>;
      scene.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>foreground<span style="color: #66cc66;">&#41;</span>;
      foreground.<span style="color: #006600;">alpha</span>.<span style="color: #006600;">animate</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span>, <span style="color: #cc66cc;">0</span>, duration<span style="color: #66cc66;">&#41;</span>;
   <span style="color: #66cc66;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">boolean</span> update<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> elapsedTime<span style="color: #66cc66;">&#41;</span>
   <span style="color: #66cc66;">&#123;</span>
      <span style="color: #993333;">boolean</span> continueTransition = <span style="color: #000000; font-weight: bold;">true</span>;
      <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>foreground.<span style="color: #006600;">alpha</span>.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
         continueTransition = <span style="color: #000000; font-weight: bold;">false</span>;
      <span style="color: #66cc66;">&#125;</span>
&nbsp;
      <span style="color: #000000; font-weight: bold;">return</span> continueTransition;
   <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
</div>
<p>So from the code you can see the transition effect is quite short but still pretty powerful.</p>
<p>It takes the following parameters on construction. A CoreImage object which is generally a screen shot of the scene you are transitioning away from, a color to fade the image into and a duration in milliseconds for the fade to take place over. The transition then animates the alpha of the image to fade out over time and blends it with the colored background to generate the fade effect. When the image alpha is at 0 the effect is over and the transition returns a false.</p>
<p>An beneficial side effect of implementing the transition effects in this way is that you can make as many of them as you want. When you run the <a href="http://ant.apache.org/" title="Apache Ant" onclick="javascript:pageTracker._trackPageview ('/outbound/ant.apache.org');"><strong>Ant</strong></a> build script in release mode it will run the <a href="http://proguard.sourceforge.net/" title="Proguard" onclick="javascript:pageTracker._trackPageview ('/outbound/proguard.sourceforge.net');"><strong>Progaurd</strong></a> build action. One of the things Progaurd does is strip out any unused code so only the transitions that you actually use will make it the end jar file. This results in a smaller jar, less time spent waiting for the jar file to download and a better user experience when the player wants to try your game.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Transition+Engine&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fframework%2Ftransition-engine%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/framework/transition-engine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Basic Scenes</title>
		<link>http://cloningtheclassics.com/framework/basic-scenes/</link>
		<comments>http://cloningtheclassics.com/framework/basic-scenes/#comments</comments>
		<pubDate>Sat, 31 May 2008 13:13:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Framework]]></category>

		<category><![CDATA[Pulpcore]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=67</guid>
		<description><![CDATA[In Pulpcore applets are made up of a collection of scenes, scenes are where you group together common details to implement a screen. For example the code to fetch and then display the games current high score table could be contained in a single scene. The applets scenes are then played out on the applets [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Basic Scenes", url: "http://cloningtheclassics.com/framework/basic-scenes/" });</script>]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.interactivepulp.com/pulpcore/" title="Pulpcore" onclick="javascript:pageTracker._trackPageview ('/outbound/www.interactivepulp.com');"><strong>Pulpcore</strong></a> applets are made up of a collection of scenes, scenes are where you group together common details to implement a screen. For example the code to fetch and then display the games current high score table could be contained in a single scene. The applets scenes are then played out on the applets Stage object. Like a play at the theater the applet will have one stage and can have one or more scenes.</p>
<p>For my classic arcade game clones I will have a set of basic scenes that will be the same for all the cloned games. Each of these scenes will be written in a generic fashion so that each game built from this common framework of scenes will be able to quickly configure the games details like titles, high score tables and then focus on implementing the actual arcade game code.</p>
<p>There are several common scenes that will be shared across all the arcade games.</p>
<p><strong>Loading Scene</strong><br />
The loading scene is where the applet will decide on which asset file to download based on the users locale. After downloading the applicable asset file it will then transition to the main title scene.</p>
<p><strong>Title Scene</strong><br />
The title scene will display the tile of the arcade game and the main menu. The main menu will consist of the following options.</p>
<ul>
<li> Play Game</li>
<li> Highscores</li>
<li> Language</li>
<li> Credits</li>
</ul>
<p><strong>Play Scene</strong><br />
The implementation of the actual arcade game.</p>
<p><strong>Highscore Scene</strong><br />
Connects to the web server, fetches the latest high scores and displays them to the player.</p>
<p><strong>Language Scene</strong><br />
Lets the player select the language they would like the game displayed in. This scene will then take the user back to the loading scene so it can load the newly selected languages asset file.</p>
<p><strong>Credits Scene</strong><br />
Displays a big thanks to all the people who have helped out.</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Basic+Scenes&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fframework%2Fbasic-scenes%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/framework/basic-scenes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Internationalization Of Game Assets</title>
		<link>http://cloningtheclassics.com/framework/internationalization-of-game-assets/</link>
		<comments>http://cloningtheclassics.com/framework/internationalization-of-game-assets/#comments</comments>
		<pubDate>Sat, 31 May 2008 09:45:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Framework]]></category>

		<category><![CDATA[i18n]]></category>

		<category><![CDATA[Internationalization]]></category>

		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=66</guid>
		<description><![CDATA[All of the classic arcade game clones will have certain assets they need to load for the game to run. My main goal is to abstract the loading of game assets away from the calling code.
One reason for this abstraction is games are often constructed with placeholder assets. When the final asset is ready you [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Internationalization Of Game Assets", url: "http://cloningtheclassics.com/framework/internationalization-of-game-assets/" });</script>]]></description>
			<content:encoded><![CDATA[<p style="margin-bottom: 0in;">All of the classic arcade game clones will have certain assets they need to load for the game to run. My main goal is to abstract the loading of game assets away from the calling code.</p>
<p style="margin-bottom: 0in;">One reason for this abstraction is games are often constructed with placeholder assets. When the final asset is ready you can simply link the asset into the games build, update any mappings in the resource loader and it will be changed consistently through out the rest of the applet. As an added bonus if designed right it would make the <a href="http://java.sun.com/javase/technologies/core/basic/intl/" title="Java Internationalization" onclick="javascript:pageTracker._trackPageview ('/outbound/java.sun.com');"><strong>internationalization</strong></a><span> of the applet easier.</span></p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;"><span>So how doe we achieve this goal? Well first we must take a look at how </span><a href="http://www.interactivepulp.com/pulpcore/" title="Pulpcore" onclick="javascript:pageTracker._trackPageview ('/outbound/www.interactivepulp.com');"><strong>Pulpcore</strong></a><span> handles game assets and work within it's boundaries. Luckily for us Pulpcore handles assets in a very straight forward and easy manner. Game assets are either loaded from the jar file or from an assets catalog. The assets catalog is generally populated from a compressed zip file that the applet downloads at run time.</span></p>
<p style="margin-bottom: 0in;">
<p style="margin-bottom: 0in;"><span>So how does the applet know which assets go where and what files to download?</span></p>
<p style="margin-bottom: 0in;"><span>Well in a Pulpcore applets source tree there is a folder called res. Under the res folder there are two more folders called jar and zip. It is here that the applets resource assets are held.</span></p>
<p style="margin-bottom: 0in;">
<p><span>When a developer starts the build process using the default supplied </span><a href="http://ant.apache.org/" title="Apache Ant" onclick="javascript:pageTracker._trackPageview ('/outbound/ant.apache.org');"><strong>Ant</strong></a><span> build script the applets resources are processed depending on which folder they are contained in. All the assets in the res/jar folder are packaged up in the final resulting jar file with the rest of the applets class files. All the assets in the res/zip folder are packaged up into a compressed zip file.</span></p>
<p><span>When you write a Pulpcore applet you get the option to automatically load this zipped up asset file or override the existing loading scene and hand pick which asset file to load.</span></p>
<p><span>After the assets have been loaded using them in an applet is simply a case of calling the static load function on the asset type that you want to create and passing it the folder and file name of the asset.</span></p>
<p><span>Now we have the general background and some understanding on how Pulpcore handles asset files. We are now able to focus on how to abstract the loading of an individual asset from the rest of our applet.</span></p>
<p><span>My approach is to have a class dedicated to the loading of resources. It shall be called the resource class. The resource class will provide functions for loading each type of asset available, for example it will provide a method for loading CoreImage, CoreFont and Sound objects. These load functions will take an enumeration type named after the type they enumerate for example ImageResource, FontResource and SoundResource. The resource class will also have a mapping of the enumeration type to a specific directory and filename. This mapping will be implemented as a </span><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html" title="Resource Bundle" onclick="javascript:pageTracker._trackPageview ('/outbound/java.sun.com');"><strong>ResourceBundle</strong></a><span>.</span></p>
<p><span>Why do we need to map the enumeration type to a resource bundle?</span></p>
<p><span>My goal here is to make the mapping easy to find, easy to change and also be easy to  internationalize. By using a resource bundle we can provide different assets based on locale in the same compressed zip file and have the correct asset loaded for the players locale. For example you may have spoken phrases played in your applet. You would want and English player to hear the English phrases and the German players to hear the German phrases. You would be able to have both in the same zip file and have the resource bundle mappings pick the correct files to load and thus the applet would play the correct language.</span></p>
<p><span>If your asset files are small then having all your  internationalized assets in the same zip file is probably an acceptable solution with out negatively impacting on your players overall experience with your applet. However if you make extensive use of sound effect, images and other assets for your  internationalization then you will not want to make your player wait as the game downloads several megabytes of data they will never use. The solution? I would recommend breaking apart the assets into a common base and then several zip files that contain the differing assets for each locale. At load time you would be able to load the base assets, discover the players locale and pick the appropriate localized  asset file to download. This could be quickly implemented as a second overridden loading scene. By labeling each loading scene to keep the user informed of the loading process you would still be able to provide an acceptable end user experience.</span></p>
<p><span>How would you implement the resource file splitting in a easy to use way?</span></p>
<p><span>I think the best solution would be to have folders under the main zip file that would provide a tree structure for each localized asset file. Then update the Ant build script to build the assets in this way. Unfortunately at this point my Ant skills are not up to scratch to tackle this task, when the time required to manually generate the localized assets file becomes prohibitive I will learn Ant build scripts and automate the process.</span></p>
<p><span>So there you have it, a quick brain dump on abstracting resource loading away from the calling code to allow for easier use of place holder assets and internationalization.</span></p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=Internationalization+Of+Game+Assets&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fframework%2Finternationalization-of-game-assets%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/framework/internationalization-of-game-assets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>First clone picked: Asteroids</title>
		<link>http://cloningtheclassics.com/classic-arcade-games/first-clone-picked-asteroids/</link>
		<comments>http://cloningtheclassics.com/classic-arcade-games/first-clone-picked-asteroids/#comments</comments>
		<pubDate>Thu, 29 May 2008 10:01:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Asteroids]]></category>

		<category><![CDATA[Classic arcade games]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=65</guid>
		<description><![CDATA[Asteroids an arcade classic, published in 1979 by Atari. Sporting some simple black and white vector graphics,  old school sound effects and some simple physics I think Asteroids will be a good game to start with. Not too easy and not too hard.
I have been researching Java frameworks to help with the cloning of [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "First clone picked: Asteroids", url: "http://cloningtheclassics.com/classic-arcade-games/first-clone-picked-asteroids/" });</script>]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Asteroids_%28computer_game%29" title="Asteroids" onclick="javascript:pageTracker._trackPageview ('/outbound/en.wikipedia.org');"><strong>Asteroids</strong></a> an arcade classic, published in 1979 by <a href="http://www.atari.com/" title="Atari" onclick="javascript:pageTracker._trackPageview ('/outbound/www.atari.com');"><strong>Atari.</strong></a> Sporting some simple black and white vector graphics,  old school sound effects and some simple physics I think Asteroids will be a good game to start with. Not too easy and not too hard.</p>
<p>I have been researching <a href="http://java.com" title="Java" onclick="javascript:pageTracker._trackPageview ('/outbound/java.com');"><strong>Java</strong></a> frameworks to help with the cloning of Asteroids. Since my main focus is on cloning classic arcade games, it makes sense to use a framework that will take care of the details concerning rendering graphics,  collecting player input,  playing sounds and managing game assets. My research has led me to this great Java applet library called <a href="http://www.interactivepulp.com/pulpcore/" title="Pulpcore" onclick="javascript:pageTracker._trackPageview ('/outbound/www.interactivepulp.com');"><strong>Pulpcore</strong></a>. It handles all of the basics needs for a 2d rendered game implemented as a Java applet. In short Pulpcore makes a great boiler plate for my arcade game clones.</p>
<p>Even tho I am going to use a third party library for the graphical rendering, sound and input all the clones will run in a similar manner and it make sense to reuse as much of that code as possible. This leaves me to design a basic clone framework built on top of Pulpcore to handle loading the right assets, displaying generic menus, high score  entry and display screen. This then frees me to focus on cloning the game play for each arcade game and not rewriting the same high score table five times.</p>
<p>I have started to flesh out the main classes and interactions in the framework by creating some quick prototypes and using <a href="http://www.uml.org/" title="Unified Modeling Language" onclick="javascript:pageTracker._trackPageview ('/outbound/www.uml.org');"><strong>UML</strong></a> to model the ideas generated. I recommend <a href="http://staruml.sourceforge.net/en/" title="Star UML" onclick="javascript:pageTracker._trackPageview ('/outbound/staruml.sourceforge.net');"><strong>StarUML</strong></a> for drawing UML diagrams. It is free, open source and works great for me.</p>
<p>I will post some more details on the framework design as I complete it. If you are thirsty for more Asteroids information you can read the <a href="http://cloningtheclassics.com/asteroids/" title="Asteroids Overview"><strong>Asteroids Overview</strong></a> and the <a href="http://cloningtheclassics.com/asteroids/asteroids-specification/" title="Asteroids Specification"><strong>Asteroids Specification</strong></a></p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=First+clone+picked%3A+Asteroids&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fclassic-arcade-games%2Ffirst-clone-picked-asteroids%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/classic-arcade-games/first-clone-picked-asteroids/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It begins</title>
		<link>http://cloningtheclassics.com/classic-arcade-games/it-begins/</link>
		<comments>http://cloningtheclassics.com/classic-arcade-games/it-begins/#comments</comments>
		<pubDate>Wed, 28 May 2008 13:46:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Classic arcade games]]></category>

		<guid isPermaLink="false">http://cloningtheclassics.com/?p=64</guid>
		<description><![CDATA[Welcome to the launch of Cloning The Classics a website dedicated to the creation of faithful clones of classics arcade games as web playable Java Applets.
Each of the classic arcade games that I clone will feature the following.
An overview of the game. A gameplay and features specification describing what will be cloned. A web playable [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "It begins", url: "http://cloningtheclassics.com/classic-arcade-games/it-begins/" });</script>]]></description>
			<content:encoded><![CDATA[<p>Welcome to the launch of <strong><a href="http://cloningtheclassics.com/" title="Cloning the classics">Cloning The Classics</a></strong> a website dedicated to the creation of faithful clones of classics arcade games as web playable <a href="http://www.java.com" title="Java" onclick="javascript:pageTracker._trackPageview ('/outbound/www.java.com');"><strong>Java Applets</strong></a>.</p>
<p>Each of the classic arcade games that I clone will feature the following.</p>
<p>An overview of the game. A gameplay and features specification describing what will be cloned. A web playable arcade game implemented as a Java Applet and finally the source code to the clone will be released as an open source project so that other game developers can learn from my cloning attempts.</p>
<p>I will strive to make each arcade game clone look, sound and play as close to the original as able. Since these clones are being built from scratch an exact replica will not possible but they will remain faithful to the original game. If exactness is what you are after then you should probably check out an arcade game machine emulator like <a href="http://mamedev.org/" title="Multiple arcade machine emulator" onclick="javascript:pageTracker._trackPageview ('/outbound/mamedev.org');"><strong>MAME</strong></a></p>
<p>Well lets get this show on the road and clone some classic arcade games!</p>
<p><a href="http://sharethis.com/item?&wp=2.5.1&amp;publisher=dce3333f-cf9d-43d4-b2e4-8dffd1e42798&amp;title=It+begins&amp;url=http%3A%2F%2Fcloningtheclassics.com%2Fclassic-arcade-games%2Fit-begins%2F">ShareThis</a></p>]]></content:encoded>
			<wfw:commentRss>http://cloningtheclassics.com/classic-arcade-games/it-begins/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
