<?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>ThomasPurnell.com</title>
	<atom:link href="http://www.thomaspurnell.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thomaspurnell.com</link>
	<description>Development of Web, Integration and Games Software</description>
	<lastBuildDate>Wed, 21 Dec 2011 02:06:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>LD22: Mountain (Hand wavy version)</title>
		<link>http://www.thomaspurnell.com/ld22-mountain-hand-wavy-version/</link>
		<comments>http://www.thomaspurnell.com/ld22-mountain-hand-wavy-version/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 13:19:04 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=222</guid>
		<description><![CDATA[Mountain (play here) is a game about sharing experiences with others while you play alone. This pit is filled with about 60 people&#8217;s shared failures and abusive language. I&#8217;m pretty pleased about it.]]></description>
			<content:encoded><![CDATA[<p>Mountain (<a href="http://thomaspurnell.com/ld22" title="Mountain" target="_blank">play here</a>) is a game about sharing experiences with others while you play alone.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/lights.png"><img src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/lights-300x175.png" alt="" title="lights" width="300" height="175" class="aligncenter size-medium wp-image-223" /></a></p>
<p>This pit is filled with about 60 people&#8217;s shared failures and abusive language. </p>
<p>I&#8217;m pretty pleased about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ld22-mountain-hand-wavy-version/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LD22: Mountain</title>
		<link>http://www.thomaspurnell.com/ld22-mountain/</link>
		<comments>http://www.thomaspurnell.com/ld22-mountain/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 08:49:18 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=206</guid>
		<description><![CDATA[Click here to play &#8220;Mountain&#8221; Woohoo. Ludum Dare 22 was a happy fun time for everyone. 48 hours to singlehandedly make a game from scratch around a theme that is not announced until the beginning of the competition. This Ludum Dare was themed &#8216;Alone&#8217;, which I understand was pretty unpopular with a good deal of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountainhome.png"><img class="aligncenter size-medium wp-image-215" title="It's further than you think" src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountainhome-300x178.png" alt="" width="300" height="178" /></a></p>
<p><a href="http://thomaspurnell.com/ld22/">Click here to play &#8220;Mountain&#8221;</a></p>
<p>Woohoo. Ludum Dare 22 was a happy fun time for everyone. 48 hours to singlehandedly make a game from scratch around a theme that is not announced until the beginning of the competition. This Ludum Dare was themed &#8216;Alone&#8217;, which I understand was pretty unpopular with a good deal of LDers, but then there always seems to be a group angry with whatever theme <span style="text-decoration: line-through;">our glorius leader <a href="http://www.ludumdare.com/compo/author/pov/">PoV</a></span> the people choose.</p>
<p>This Ludum Dare I decided to make an effort to use Unity, mostly to finally see how it actually works and also to make the game more accessible to the &#8216;I don&#8217;t like to download games&#8217; crowd, even though I will have lost my beloved Linux LD comrades votes.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain5.png"><img class="aligncenter size-medium wp-image-208" title="Sarah leaves some important advice" src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain5-300x175.png" alt="" width="300" height="175" /></a></p>
<p>Given that I&#8217;m quite unfamiliar with Unity I decided to keep the game fairly simple, and decided to make use of a number of canned scripts and functionality, such as the bog-standard first-person-camera with collision detection and predefined keyboard+mouse controls.</p>
<p>So I decided to make a dangerous mountain to climb alone. An initial test showed that climbing a large low poly mountain was both easy and boring, so I spent some time thinking about how to better meet the theme, make the game more challenging and try and add something a little unusual or interesting to what might otherwise be an extremely mediocre offering.</p>
<p>I&#8217;d heard about some kind of message system in Demon Souls, a game I haven&#8217;t played, where players can leave messages warning other players of traps and dangers in the vicinity, and often lie in these messages to mislead other players. Sounds like a great idea to me. I also wanted to make the game a lot more difficult to encourage some kind of communication between players beyond obscenities and gibberish, so I wrapped the mountain in almost total darkness and made the messages players leave illuminate their surrounding area, allowing for players to create a trail of lights up the mountain, showing where the dangers are hidden. The player can only leave a message at the spot they die, so even if they decide to write nonsense or query my parentage, their message will help illuminate whatever obstacle was responsible for their demise and so help other players better navigate the mountain. So I whipped up a database back-end and spent some quality time with the Unity documentation for dealing with web streams.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain2.png"><img class="aligncenter size-medium wp-image-209" title="A popular spot" src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain2-300x175.png" alt="" width="300" height="175" /></a></p>
<p>In terms of gameplay, I managed to achieve my goal. The Mountain isn&#8217;t particularly difficult to navigate, but does have some pretty mean, unfair areas. The graphics do their job, but aren&#8217;t particularly exciting, and the white text on the sometimes white background can become impossible to read. Audio was left until the last minute and really suffers as a result, the music was written in less time than it takes the track to play, and I didn&#8217;t have time to record or create any ambient or event noises that probably could have added a good deal of atmosphere to the game.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain3.png"><img class="aligncenter size-medium wp-image-210" title="This is exactly the kind of response I was looking for" src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain3-300x176.png" alt="" width="300" height="176" /></a></p>
<p>As it is, Mountain is a slow stroll to the top of the hill through a swarm of sometimes offensive messages, but for me it&#8217;s an enjoyable stroll, and seeing evidence of other players passing through the environment makes me happy.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain4.png"><img class="aligncenter size-medium wp-image-211" title="Never Forget." src="http://www.thomaspurnell.com/wp-content/uploads/2011/12/mountain4-300x175.png" alt="" width="300" height="175" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ld22-mountain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ludum Dare 22 prep</title>
		<link>http://www.thomaspurnell.com/ludum-dare-22-prep/</link>
		<comments>http://www.thomaspurnell.com/ludum-dare-22-prep/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 04:36:11 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/ludum-dare-22-prep/</guid>
		<description><![CDATA[Not a lot of people play my ludum dare entries. This may be due to their inherent crappiness, but is also due to my bad code or sometimes my inability to produce a game that doesn&#8217;t require the use of an installer. So for LD22 I&#8217;m going to have a go at using unity3d, which [...]]]></description>
			<content:encoded><![CDATA[<p>Not a lot of people play my ludum dare entries. This may be due to their inherent crappiness, but is also due to <a href="http://www.thomaspurnell.com/ludum-dare-19-disc-over-y/">my bad code</a> or sometimes my inability to produce a game that doesn&#8217;t <a href="http://www.thomaspurnell.com/ludum-dare-21-infall/">require the use of an installer</a>. </p>
<p>So for LD22 I&#8217;m going to have a go at using <a href="http://www.unity3d.com">unity3d</a>, which will give me the option of generating a web version. Honestly though I expect I&#8217;ll still end up creating a downloadable game because at the end of the day I just don&#8217;t really like games embedded in webpages, which I find difficult to experience any sense of immersion with. Unity will at least make it fairly easy for me to churn out an untested Mac version though, which might win me a few plays from the undernourished Mac gaming crowd.</p>
<p>But. Unity doesn&#8217;t produce Linux executables. Although it is not completely impossible to run a unity game in Linux, it probably is not going to be worth the substantial effort to coax wine into running a 48 hour game. So this will be the my first LD where I have not targeted Linux, but given that almost no-one actually plays my entries anyway, it probably is not a great loss to the penguin loving world, but it does make me a little sad.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ludum-dare-22-prep/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ludum Dare 21: INFALL</title>
		<link>http://www.thomaspurnell.com/ludum-dare-21-infall/</link>
		<comments>http://www.thomaspurnell.com/ludum-dare-21-infall/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 23:42:33 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[panda3d]]></category>
		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=167</guid>
		<description><![CDATA[Last month I entered another Ludum Dare competition, LD21. The theme was &#8216;Escape&#8217;. I decided to interpret this as &#8216;Escape from an anomalous gravity well in a clapped out spaceship with almost no fuel&#8217;. My entry, available here, is INFALL. This is the first game I&#8217;ve written that I was genuinely excited to play. The [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I entered another <a title="Ludum Dare" href="http://www.ludumdare.com" target="_blank">Ludum Dare</a> competition, LD21. The theme was &#8216;Escape&#8217;. I decided to interpret this as &#8216;Escape from an anomalous gravity well in a clapped out spaceship with almost no fuel&#8217;. My entry, <a title="Infall at Ludumdare.com" href="http://www.ludumdare.com/compo/ludum-dare-21/?uid=1789" target="_blank">available here,</a> is INFALL.</p>
<p>This is the first game I&#8217;ve written that I was genuinely excited to play. The whole time I was writing this some part of my inner-child-brain was already planning all the awesome asteroid dodges and grav-well slingshot manoeuvres I was going to make the first time I played it.</p>
<p style="text-align: center;"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/09/system.png"><img class="size-medium wp-image-179 aligncenter" title="The System" src="http://www.thomaspurnell.com/wp-content/uploads/2011/09/system-300x225.png" alt="The System" width="300" height="225" /></a></p>
<p><strong>The Plan</strong></p>
<p>If there is one thing the world needs, it&#8217;s another space game. A space game with lots of rocks. I just have a thing for rocks floating in space. Rather than spending a good deal of time trying to come up with a game concept, the idea of having to escape a gravity well whilst navigating a dense asteroid field sprang fully formed into my mind. I realise that the premise isn&#8217;t entirely original or likely to win any narrative awards, but not crashing into things is a time honoured computer game tradition which has made for plenty of great games.</p>
<p>So once I&#8217;d settled on a struggle against gravity and floating space debris, I decided it was time to finally come out of the closet and admit my love of pandas. <a title="Panda3D" href="http://www.panda3d.org" target="_blank">Panda3D</a> is a 3D all-in-one-even-makes-tea game engine I&#8217;ve dabbled with in the past, but never finished a game with. I like Panda because of its excellent <a href="http://www.python.org" target="_blank">Python</a> bindings, and Python is, for me at least, a really excellent rapid development language, which given the 48 hour time limit of Ludum Dare makes a whole lot of sense. 3D engines (usually) need 3D models, and I decided that my familiarity with <a href="http://www.blender.org">Blender</a> was sufficient to put together some space rocks and a ship, coupled with my <a title="GIMP" href="http://www.gimp.org">GIMP</a> mastery for texturing. Audio would be made by either blowing into a microphone or created in any of the <a title="Ubuntu Studio" href="http://ubuntustudio.org/">100+ audio programs</a> I have installed but have only opened once.</p>
<p><strong>Decisions</strong></p>
<p>Right from the start I knew I wanted to make this game first person 3D. I could have gone third person and made the game a 2D Thrust style game, but I really wanted to try and have the player (who in all likelihood is only going to play this competition entry once or twice) care about not colliding with any of the in-game obstacles. I personally feel a lot more invested in the outcome of a game when it&#8217;s presented in first person view, rather than the extra level of abstraction that comes from identifying with a player character visible on-screen. But I didn&#8217;t want to go with the static cockpit view that a lot of first-person vehicle games do. The player is not the ship, the player is the pilot sat in the near-useless ship careening down a gravity well, so I decided to try and create a feeling of separation between the player character and ship by having the mouse control the direction of view and requiring that the player look around the cockpit in order to successfully navigate to a victorious escape from the well. This required having some important reason to look anywhere other than directly forward, and so I decided on display screens around the cockpit that would show the player essential information, but would require them to turn away from the main window to view, and so outside the players forward field of view I added an overhead map of the system and a screen showing the distance required for the player to &#8216;escape&#8217; the gravity well.</p>
<p style="text-align: center;"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/09/plan.png"><img class="size-full wp-image-178 aligncenter" title="plan" src="http://www.thomaspurnell.com/wp-content/uploads/2011/09/plan.png" alt="" width="421" height="340" /></a></p>
<p>&#8216;Realistic&#8217; Newtonian physics were chosen because besides being the easiest for me to model, I really wanted to be able to slingshot around the gravity-well, and space-sims without Newtonian physics just feel like arcadey flight-sims without a floor to land on. I also didn&#8217;t want the ship to be particularly responsive, forcing the player to think about how they manoeuvre to avoid incoming rocks, and also to try and create situations where a player slowly realises that their escape attempt has failed and are dragged back down into the gravity-well. I also hoped that this would add some degree of a learning curve for any players that played the game a few times.</p>
<p>Audio was kept simple. I hoped to create a close tense atmosphere through limiting audio to the sounds you might realistically expect to hear aboard a space faring vessel and forego the star-wars &#8216;sounds in space&#8217; phenomena. Given the limited fuel supply, this would result in a totally silent ship once all fuel was spent and the player is committed to their vector as a helpless passenger. I did decide that I&#8217;d include an &#8216;ominous hum&#8217; that would increase in volume with proximity to the anomaly, but this was my only &#8216;cheat&#8217; against sound in a vacuum.</p>
<p>Also, black-holes are hard to represent convincingly, so I decided to make a weird purple planetoid as the source of the gravity-well.</p>
<p><strong>Building The Assets</strong></p>
<p>So with a reasonably detailed plan in hand I jumped into creating my media assets. I wanted to reverse the order of my previous Ludum Dare entries and get straight into making some art assets that I was reasonably happy with to see how things looked together, rather than writing a game and throwing some graphics in at the end if there is any time left. First up was the ship cockpit (complete with comfy space chair). This iteration saw the chair upholsterer get flushed out the airlock.</p>
<div id="attachment_174" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/09/chair1.png"><img class="size-medium wp-image-174 " title="First version of cockpit with chair" src="http://www.thomaspurnell.com/wp-content/uploads/2011/09/chair1-300x225.png" alt="First cockpit view" width="300" height="225" /></a><p class="wp-caption-text">First version of cockpit with chair</p></div>
<div id="attachment_175" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/09/rock3.jpg"><img class="size-medium wp-image-175 " title="Rock" src="http://www.thomaspurnell.com/wp-content/uploads/2011/09/rock3-300x225.jpg" alt="Rock" width="300" height="225" /></a><p class="wp-caption-text">It&#39;s a low poly rock. Not a lot else to say</p></div>
<div id="attachment_177" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/09/anomaly1.png"><img class="size-medium wp-image-177 " title="The Anomaly" src="http://www.thomaspurnell.com/wp-content/uploads/2011/09/anomaly1-300x225.png" alt="The Anomaly" width="300" height="225" /></a><p class="wp-caption-text">The source of all your gravity related woes</p></div>
<p>&nbsp;</p>
<p><strong>Writing The Game</strong></p>
<p>Besides a few learning issues with displaying content on the in-cockpit monitors, writing the game went very smoothly. Having the art assets available at this point made dealing with issues of scale and position a breeze. The physics came together nicely and [relatively] soon I had a playable version of the game. Inexplicably I decided at this point that the game really needed music. I blame the hours I&#8217;d spent by now testing the game and staring at the art assets, but I hacked together a vaguely Indian sounding drum-loop that unless you&#8217;ve been working on a game for almost two days (and probably even if you have) gets annoying before it has even looped once.</p>
<p>Anomalous Balance</p>
<p>Who knew balancing such a simple game could be so hard? I only had the following factors to deal with:</p>
<ul>
<li>Starting distance of ship from anomaly</li>
<li>Starting velocity of ship</li>
<li>Manoeuvrability of ship and quantity of fuel</li>
<li>Gravitational pull of anomaly</li>
<li>Number and distribution of asteroids</li>
<li>Speed of asteroids</li>
</ul>
<p>But I just didn&#8217;t have enough time left to get it right. I seriously underestimated the amount of time it would take to tweak these values in order to solve the equation for fun. Increase the power of the ship, game too easy. Increase gravitational pull to compensate, game too hard, etc. Long story short, I failed this part completely. I just wasn&#8217;t able to come up with a solution where the game was not ludicrously easy or impossibly brutal. The once time I did chance upon a good combination, it was unworkable for most computers given the huge number of asteroids I&#8217;d included. Scaling back the rock count made the game far too easy again, but at least allowed the game to run at a decent frame rate on my netbook, which was the target base hardware platform to ensure I don&#8217;t repeat the mistake I made in my last LD entry of assuming everyone is running the game on a fat desktop computer.</p>
<p><strong>Pointless Cockpit</strong></p>
<p>One of the first comments I received from a game judge was that the cockpit was pointless. They didn&#8217;t need to look around at all, and had won the game (I assume) without so much as glancing at the map or distance view. Obviously the pace of moving through the asteroid areas was wrong if it could be easily navigated without the map. Another commenter described the rest of the cockpit as &#8216;a distraction&#8217;, again demonstrating that the information available on the monitors was not valuable to the player.</p>
<p><strong>Mindlessly Easy</strong></p>
<p>With the released competition version, it&#8217;s a simple matter to orient your ship at a slight angle to the Anomaly, burn your entire fuel reserve, and then safely coast around the gravity-well and out to a safe distance, winning the game. Nine times out of ten, you will miss the sparse asteroids through chance alone and win the game. I should have erred on the side of &#8216;extreme difficulty&#8217; rather than &#8216;mindlessly easy&#8217; gameplay for the competition, as this might have helped encourage players to replay the game a few times and notice some of the more subtle aspects of the game.</p>
<p><strong>Subtle Aspects Of The Game</strong></p>
<p>Alright, these were not particularly subtle, but in my intended high tension heat of the moment vision of the game that should have been, they were. I spent quite some time implementing effects intended to induce fear of the Anomaly. As the player descends into the gravity well, the volume of the ominous hum slowly increases from &#8216;barely audible&#8217; to &#8216;Really Rather Loud&#8217;. A distortion of the field of view also occurs as gravity increases, most noticeable immediately before impact with the Anomaly. I also experimented with a variable focus depth of field shader, but this made my target hardware cry as it tried to emulate the shader in software.</p>
<p>The single ship window in the competition version was intended to contribute to a sense of claustrophobia amongst the asteroids, but instead failed quite severely, and probably contributed instead to forcing players to look forwards at all times. Post competition versions have extra windows, which help look out for incoming rocks as well as allow a player to glance at the monitors without losing their situational awareness.</p>
<p><strong>Installerphobia</strong></p>
<p>You know, every Ludum Dare I&#8217;ve been in I always notice that people prefer the games they can play in their web browser. That&#8217;s fine. I understand. But outright refusing to play a game just because you have to download it or run an installer is just laziness, especially when I take the time to cross compile to other platforms. I served my time with Flash. It&#8217;s just too limited for writing a 3D game in 48 hours. <a title="Unity3D" href="http://www.unity3d.com" target="_blank">Unity3D</a> would have been an option if it had a Linux client, but it doesn&#8217;t and probably never will, which rules it out for me. Of course Joe Judge comes along to rate my LD entry and sees that he can&#8217;t play it in five seconds time on the web, so writes an obnoxious comment and doesn&#8217;t play the game. One judge that rated my game admitted to me later that he didn&#8217;t even play it, but down-voted me because I packaged the game in an installer. So I didn&#8217;t get many plays for my game <img src='http://www.thomaspurnell.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . Of course I&#8217;m sure that some people just didn&#8217;t like the look of it, but that&#8217;s a whole different issue.</p>
<p><strong>Outcome</strong></p>
<p>I&#8217;m pretty happy with INFALL. Played the right way, the game has the atmosphere I was hoping to create. Unfortunately it&#8217;s just too easy to play it the &#8216;wrong&#8217; way, and there isn&#8217;t enough guidance for players that didn&#8217;t write the game. At some point I&#8217;ll hopefully find a nice balance for the game and release an updated version (probably sans music).</p>
<p>Gameplay</p>
<p><object width="500" height="281"><param name="movie" value="http://www.youtube.com/v/wt1r4rh2p4M?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/wt1r4rh2p4M?version=3" type="application/x-shockwave-flash" width="500" height="281" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>INFALL development timelapse</p>
<p><object width="500" height="281"><param name="movie" value="http://www.youtube.com/v/VzXxz_8C3G0?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VzXxz_8C3G0?version=3" type="application/x-shockwave-flash" width="500" height="281" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ludum-dare-21-infall/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ludum Dare 19: Disc Over Y</title>
		<link>http://www.thomaspurnell.com/ludum-dare-19-disc-over-y/</link>
		<comments>http://www.thomaspurnell.com/ludum-dare-19-disc-over-y/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 06:02:06 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=145</guid>
		<description><![CDATA[This is a lesson on respect. Specifically, respecting memory. Apparently not everyone has 6GB+ of RAM available for playing Ludum Dare 48 game-making competition entries. It started off innocently enough. A nice simple map for a nice simple Ludum Dare entry, using my half written caveflyer engine. A map barely 1000 pixels wide, a mere [...]]]></description>
			<content:encoded><![CDATA[<p>This is a lesson on respect. Specifically, respecting memory. Apparently not everyone has 6GB+ of RAM available for playing Ludum Dare 48 game-making competition entries.</p>
<div id="attachment_147" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy1.png"><img class="size-full wp-image-147" title="doy1" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy1.png" alt="At this point, things were still reasonably sensible" width="512" height="285" /></a><p class="wp-caption-text">At this point, things were still reasonably sensible</p></div>
<p style="text-align: center;">
<p>It started off innocently enough. A nice simple map for a nice simple Ludum Dare entry, using my half written caveflyer engine. A map barely 1000 pixels wide, a mere 800 pixels tall. At some point I decided to grow the map a little, then a little more, and just a little more, until it reached 13312 x 20992 pixels, for a total of 279445504 bleeding pixels. And that&#8217;s just the background layer. There&#8217;s an additional foreground layer of the same size, though around half the pixels are completely transparent. I realised this was a little large and scaled the entire map to a quarter size, and then expanded it 4x in-game to try and compensate a little, but I wasn&#8217;t fooling anyone. My game was obese.</p>
<div id="attachment_146" class="wp-caption aligncenter" style="width: 710px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/discovery.png"><img class="size-full wp-image-146" title="Disc Over Y fail" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/discovery.png" alt="Graphic documentating the ridiculous over ambition of my map" width="700" height="525" /></a><p class="wp-caption-text">Graphic documentating the ridiculous overambition of my map</p></div>
<p>For some reason I decided that I didn&#8217;t need dynamic loading. I lived in some kind of denial, believing it would be no problem for anyone to run the game. I concentrated on trying to progress with the game rather than worry about trivial technical details. The game was <em>running fine here</em> after all. Then I compiled it for Windows.</p>
<div id="attachment_150" class="wp-caption aligncenter" style="width: 650px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy4.png"><img class="size-full wp-image-150" title="doy4" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy4.png" alt="If this game came on a disc, it'd have to be as big as a person (or robot at least)" width="640" height="370" /></a><p class="wp-caption-text">If this game came on a disc, it&#39;d have to be as big as a person (or robot at least)</p></div>
<p style="text-align: center;">
<p>At this point I realised I had a real problem. The game loaded in about 5 seconds in Ubuntu, but took closer to 30 seconds in Windows. I copied it over onto a similar machine and the game just didn&#8217;t load at all. I tried ten times, and the game loaded on the tenth attempt, and was using 2GB of RAM. Great. Works fine. Lah.</p>
<div id="attachment_149" class="wp-caption aligncenter" style="width: 652px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy3.png"><img class="size-full wp-image-149" title="doy3" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy3.png" alt="The jagged crystal hell of forgetting to include dynamic loading" width="642" height="404" /></a><p class="wp-caption-text">The jagged crystal hell of forgetting to include dynamic loading</p></div>
<p>I won&#8217;t pretend to profess that I know much about how Windows allocates it&#8217;s memory, but it seems that repeated launch attempts eventually allowed enough of the map to be buffered that the game was able to launch without erroring out before reaching the main loop. I could have tried to explain this to the people who were about to try and play and vote on my game, but I didn&#8217;t expect much in the way of sympathy. So at this point I decided to try and fix the issue. Hours and hours after I&#8217;d first identified the existence of the problem. So rather than writing new code in my now very limited remaining time, I tried to rework the existing loader to dynamically load on demand. This worked to an extent, but completely broke the map wide physics of the game, which relies on the map being loaded into memory to calculate what&#8217;s happening off screen. This approach is fine for the engine&#8217;s intended purpose of simulating a tightly claustrophobic subterranean combat arena, but fails somewhat at serving up seamless large worlds, which really don&#8217;t need much in the way of distant physics simulation anyway.</p>
<div id="attachment_148" class="wp-caption aligncenter" style="width: 509px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy2.png"><img class="size-full wp-image-148" title="doy2" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy2.png" alt="Robo1 contemplating his misfortune to be trapped in one of the worse Ludum Dare entries" width="499" height="255" /></a><p class="wp-caption-text">Robo1 contemplating his misfortune to be trapped in one of the worse Ludum Dare entries</p></div>
<p style="text-align: left;">But enough whining! What worked? Well, I managed to finish around 60% of the game. Considering how insane an undertaking it was, I don&#8217;t feel too bad about not finishing. There are a couple of cool things implemented. If Robo1 progresses far enough to locate the Obliterator, all kinds of fun can ensue:</p>
<div id="attachment_152" class="wp-caption aligncenter" style="width: 624px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy6.png"><img class="size-full wp-image-152" title="doy6" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy6.png" alt="Tunnel FUN" width="614" height="401" /></a><p class="wp-caption-text">Tunnel FUN</p></div>
<p style="text-align: left;">Probably the one feature of my caveflyer engine that was actually suited to this game was the destructible terrain. The protagonist does not start with the ability to destroy terrain, but obtains the ability through discovery. The original plan was to have the player collect the items which allowed them to fully explore the environment, eventually discovering the Obliterator, which would be used to bust open a sealed hangar door. Once this was open, the player could hop into a ship (already implemented in the caveflyer engine) and fly out into the outside area (left hand and bottom sides of the map image). From here the player would engage in a couple of dogfights before landing and discovering The Final Item, which I won&#8217;t talk about in case I actually get around to repairing and finishing this game.</p>
<div id="attachment_153" class="wp-caption aligncenter" style="width: 521px"><a href="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy7.png"><img class="size-full wp-image-153" title="doy7" src="http://www.thomaspurnell.com/wp-content/uploads/2011/02/doy7.png" alt="Vigorous hangar door removal in progress" width="511" height="337" /></a><p class="wp-caption-text">Vigorous hangar door removal in progress</p></div>
<p style="text-align: left;">If you&#8217;re feeling sadistic, you can go download the game from the Ludum Dare entry page, but I can&#8217;t recommend it. I also recorded a timelapse which for me at least, is a bit more interesting than the game proper, bad music included.</p>
<p><iframe title="YouTube video player" width="640" height="375" src="http://www.youtube.com/embed/cLbl4xNKv0c" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ludum-dare-19-disc-over-y/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ludum Dare 19 Preparation</title>
		<link>http://www.thomaspurnell.com/ludum-dare-19-preparation/</link>
		<comments>http://www.thomaspurnell.com/ludum-dare-19-preparation/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 21:47:41 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>

		<guid isPermaLink="false">https://thomaspurnell.com/?p=132</guid>
		<description><![CDATA[Alright. LD19 will be my second Ludum Dare, and I’m going to be applying the lessons I learnt in LD18 to win this time. Or at least finish my game . I will be using a self written pre-existing code base so that I can spend some time actually making a game instead of spending [...]]]></description>
			<content:encoded><![CDATA[<p>Alright. LD19 will be my second <a href="http://www.ludumdare.com/compo/" target="_blank">Ludum Dare</a>, and I’m going to be applying the <a href="http://www.thomaspurnell.com/sporg-postmortem/">lessons I learnt</a> in LD18 to win this time. Or at least finish my game <img src='http://www.thomaspurnell.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
<p>I will be using a self written pre-existing code base so that I can spend some time actually making a game instead of spending most of the time making an engine. I’ve also preinstalled a collection of fine free FOSS audio editing and creation software, booked the time window (I’m in Australia and the hours are a little inconvenient, but WhatCanYouDo) and even made a half hearted attempt at trying to get some other potential candidates interested in entering LD19 themselves.</p>
<p>Now i just have to wait and hope that Double Zombie Rainbow is not the chosen theme</p>
<p>Crossposted from <a href="http://www.ludumdare.com/compo/2010/12/01/ld19-prep/" target="_blank">http://www.ludumdare.com/compo/2010/12/01/ld19-prep</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ludum-dare-19-preparation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Panda3D for Ubuntu 10.10 x64</title>
		<link>http://www.thomaspurnell.com/building-panda3d-for-ubuntu-10-10-x64-2/</link>
		<comments>http://www.thomaspurnell.com/building-panda3d-for-ubuntu-10-10-x64-2/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 05:26:49 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[panda3d]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=121</guid>
		<description><![CDATA[I needed to compile Panda3D from source on an x64 Ubuntu Maverick 10.10 box. A little trial and error revealed the following as the prerequisites for rolling a fairly fully featured Panda3D build. These should work for x86 too. Bison Flex Build-essential Python2.6-dev fftw-dev libgl1-mesa-dev libosmesa6-dev libxrandr-dev libtiff4-dev libxf86dga-dev libgtk2.0-dev libGLU1-mesa-dev For the lazy: sudo [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to compile <a href="http://www.panda3d.org" target="_blank">Panda3D</a> from source on an x64 Ubuntu Maverick 10.10 box. A little trial and error revealed the following as the prerequisites for rolling a fairly fully featured Panda3D build. These should work for x86 too.</p>
<ul>
<li>Bison</li>
<li>Flex</li>
<li>Build-essential</li>
<li>Python2.6-dev</li>
<li>fftw-dev</li>
<li>libgl1-mesa-dev</li>
<li>libosmesa6-dev</li>
<li> libxrandr-dev</li>
<li> libtiff4-dev</li>
<li> libxf86dga-dev</li>
<li> libgtk2.0-dev</li>
<li> libGLU1-mesa-dev</li>
</ul>
<p>For the lazy:</p>
<p><code> sudo apt-get install bison flex build-essential python2.6-dev fftw-dev libgl1-mesa-dev libosmesa6-dev libxrandr-dev libtiff4-dev libxf86dga-dev libgtk2.0-dev libGLU1-mesa-dev</code></p>
<p>For the terminally lazy:</p>
<p><span style="text-decoration: line-through;">download my x64 .deb ~27MB (no guarantees etc, use an official release if you can)</span></p>
<p>Update: <a href="http://www.panda3d.org/download/panda3d-1.7.0/panda3d_1.7.0-ubuntumaverick_amd64.deb">official release now available</a><span style="text-decoration: line-through;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/building-panda3d-for-ubuntu-10-10-x64-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sporg Postmortem</title>
		<link>http://www.thomaspurnell.com/sporg-postmortem/</link>
		<comments>http://www.thomaspurnell.com/sporg-postmortem/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 09:07:18 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>
		<category><![CDATA[pygame]]></category>

		<guid isPermaLink="false">http://www.thomaspurnell.com/?p=109</guid>
		<description><![CDATA[My Ludum Dare entry, Sporg, isn&#8217;t very good. I had a lot of fun writing an entire game in 48 hours. I chose to start from scratch (rather than take the option of working with an established self-created codebase or &#8216;game maker&#8217; program), because I wanted to make the process as challenging as possible, and [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.ludumdare.com">Ludum Dare</a> entry, <a href="http://www.ludumdare.com/compo/ludum-dare-18/?uid=1789">Sporg</a>, isn&#8217;t very good.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2010/10/sporgo.jpg"><img class="aligncenter size-medium wp-image-113" title="sporgo" src="http://www.thomaspurnell.com/wp-content/uploads/2010/10/sporgo-300x176.jpg" alt="" width="300" height="176" /></a></p>
<p>I had a lot of fun writing an entire game in 48 hours. I chose to start from scratch (rather than take the option of working with an established self-created codebase or &#8216;game maker&#8217; program), because I wanted to make the process as challenging as possible, and challenging it was.</p>
<p><a href="../wp-content/uploads/2010/10/sporg1.png"><img class="aligncenter size-medium wp-image-111" title="sporg1" src="../wp-content/uploads/2010/10/sporg1-300x161.png" alt="" width="300" height="161" /></a></p>
<p>I spent a good fifteen minutes designing the game, and the rest of my work time creating the media assets and writing the game. Fifteen minutes seemed like plenty of time, I had a reasonably good idea and figured I could work out the rest of the details as I wrote. This is perhaps best exemplified by me &#8216;finishing&#8217; the game at around 9:30PM Sunday night, and then realising I hadn&#8217;t created any levels to actually play. So the game had no levels and had not been playtested. I threw a couple of maps together in bed, and then a few more on my morning commute, and submitted the game from work.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2010/10/map-no-name.png"><img class="aligncenter size-medium wp-image-115" title="map no name" src="http://www.thomaspurnell.com/wp-content/uploads/2010/10/map-no-name-300x288.png" alt="" width="300" height="288" /></a></p>
<p>The levels are uninteresting. This is half lack of careful level design, half lack of assets to actually include in the levels. Some decorative tiles or animation would have compensated a little, but the limited gameplay mechanic really limited what I could do with the levels. Ultimately you&#8217;re either trying to time a dash past an enemy, or trying to have one enemy shoot another, which doesn&#8217;t create a great range of level design possibilities. Different enemy types (with different rotation speeds or patterns, or perhaps even movement or multiple hit-points) would have added a lot of gameplay options.</p>
<p>The game is slow. I didn&#8217;t really appreciate this until I saw someone else play the game and look away from the screen to talk to someone, without taking their hand off of the movement controls. The game is so slow that the player could have a conversation without having to worry about getting shot or reaching their destination. I could try and blame this on <a href="http://www.pygame.org">Pygame</a>, (the development library used for Sporg), but it&#8217;s really an artifact of rushed development without adequate planning. It also didn&#8217;t help that I developed the game on my i7 920, and most people seem to still be running single core netbooks or something equally underpowered. I did actually do some of the work on an eee901 netbook, but obviously didn&#8217;t playtest the game enough to really notice.</p>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2010/10/sporg2.png"><img class="aligncenter size-medium wp-image-112" title="sporg2" src="http://www.thomaspurnell.com/wp-content/uploads/2010/10/sporg2-300x216.png" alt="" width="300" height="216" /></a></p>
<p>Dodgy collision detection! Getting stuck on the walls, getting hit by shots that you might argue should have missed, having the enemy blast you through supposedly solid corners.. I was aware of these issues through development but postponed dealing with them. To be fair, I feel I made the right choice in prioritising the other issues which did get fixed, such as the horrible flickering issue and stuttering sound which were absent from the released version.</p>
<p>Next Ludum Dare, which I hope to participate in, will be different:</p>
<ul>
<li><strong>DESIGN</strong> &#8211; I will give over a much greater portion of time to designing the game and it&#8217;s gameplay. I think I need to dedicate at least two hours, though perhaps not in a single chunk, in order to produce something that I actually want to play after I&#8217;ve written it.</li>
<li><strong>TESTING</strong> &#8211; Must test frequently! It&#8217;s better to produce a game with only 50% of your intended features working 100% than to implement 100% of features but have them work only 50% of the time, no?</li>
<li><strong>LEVELS</strong> &#8211; Or maps or whatever is appropriate. The game engine needs to be completed with plenty of time left to develop an interesting gameplay experience to play through.</li>
<li><strong>SCOPE</strong> &#8211; All of the above points are going to require time, which has to come from somewhere. I think perhaps the most important aspect for anyone developing a Ludum Dare game is to keep the scope as tight as possible. Focus on a small set of mechanics, features etc and do them well in a way that allows the player to experience what it is you dreamed up in that design period, rather than be distracted by incompleteness and bugs.</li>
</ul>
<p><a href="http://www.thomaspurnell.com/wp-content/uploads/2010/10/gender.png"><img class="aligncenter size-medium wp-image-116" title="gender" src="http://www.thomaspurnell.com/wp-content/uploads/2010/10/gender-300x111.png" alt="" width="300" height="111" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/sporg-postmortem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ludum Dare: Sporg</title>
		<link>http://www.thomaspurnell.com/ludum-dare-sporg/</link>
		<comments>http://www.thomaspurnell.com/ludum-dare-sporg/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 01:17:35 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>
		<category><![CDATA[pygame]]></category>

		<guid isPermaLink="false">http://thomaspurnell.com/?p=99</guid>
		<description><![CDATA[Spent majority of the weekend participating in Ludum Dare, the theme for which was &#8220;Enemies as Weapons&#8221; More details later, but for now, a download link: Ludum Dare entry page: Sporg sporg_ld48_release.zip (4407KB).]]></description>
			<content:encoded><![CDATA[<p>Spent majority of the weekend participating in <a href="http://www.ludumdare.com">Ludum Dare</a>, the theme for which was &#8220;Enemies as Weapons&#8221;</p>
<p>More details later, but for now, a download link:</p>
<p>Ludum Dare entry page: <a href="http://www.ludumdare.com/compo/ludum-dare-18/?uid=1789">Sporg</a></p>
<p><a href="../wp-content/uploads/2010/08/sporg_ld48_release.zip">sporg_ld48_release.zip</a> (4407KB).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/ludum-dare-sporg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse Pong Game Snippet</title>
		<link>http://www.thomaspurnell.com/reverse-pong-game-snippet/</link>
		<comments>http://www.thomaspurnell.com/reverse-pong-game-snippet/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 07:24:45 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[game dev]]></category>
		<category><![CDATA[pygame]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://thomaspurnell.com/?p=77</guid>
		<description><![CDATA[Rather than focusing on traditional game skills such as reflex and dexterity, Reverse Pong is instead a bluffing game of mental misdirection and brinksmanship which attempts to pit the personalities, rather than the skills, of the two players into conflict.

<a href="http://thomaspurnell.com/wp-content/uploads/2010/04/Reverse-pong.png"><img class="aligncenter size-medium wp-image-78" title="Reverse pong" src="http://thomaspurnell.com/wp-content/uploads/2010/04/Reverse-pong-300x180.png" alt="" width="300" height="180" /></a>]]></description>
			<content:encoded><![CDATA[<p>In reverse pong, you score points by allowing the &#8216;ball&#8217; to pass into your own goal, rather than defending your goal as in traditional pong.  The score value of the ball is doubled each time it is reflected by a player, and the scores of both players diminish by a percentage each time at each reflection.</p>
<p>Rather than focusing on traditional game skills such as reflex and dexterity, Reverse Pong is instead a bluffing game of mental misdirection and brinksmanship which attempts to pit the personalities, rather than the skills, of the two players into conflict.</p>
<p><a href="http://thomaspurnell.com/wp-content/uploads/2010/04/Reverse-pong.png"><img class="aligncenter size-medium wp-image-78" title="Reverse pong" src="http://thomaspurnell.com/wp-content/uploads/2010/04/Reverse-pong-300x180.png" alt="" width="300" height="180" /></a></p>
<pre class="brush:python;collapse:true">
import random
import pygame

#revpong
#pong clone
#players score points by allowing the pong ball into their own goal
#every paddle deflection doubles the current ball value

pygame.init()
pygame.display.set_caption(&quot;Revpong&quot;)
screen = pygame.display.set_mode((800, 480), pygame.FULLSCREEN)
pygame.mouse.set_visible(False)
#screen = pygame.display.set_mode((800, 480))
windowsize = screen.get_size()

gameContinue = True

game_colour = (255, 255, 255)
clock = pygame.time.Clock()

font = pygame.font.SysFont(pygame.font.get_default_font(), 36)

paddle_dimensions = (24, 96)
paddle = pygame.surface.Surface(paddle_dimensions)
paddle.fill(game_colour)

ball = pygame.surface.Surface((24, 24))
ball.fill(game_colour)

ball_position = (windowsize[0]/2, windowsize[1]/2)
ball_velocity = (-4, 4)

#x positions of paddles
paddle_x_1 = paddle_dimensions[0] * 3
paddle_x_2 = windowsize[0] - paddle_dimensions[0] * 4

#y positions of paddles
paddle_y_1 = windowsize[1] / 2 - paddle_dimensions[1] / 2
paddle_y_2 = windowsize[1] / 2 - paddle_dimensions[1] / 2

#deltas of paddles
paddle_d_1 = 0
paddle_d_2 = 0

#scores
score_ball = 1
score_1 = 0
score_2 = 0

def reset_ball(ball_position, ball_velocity):
	random_y = int(random.random() * 5) - int(random.random() * 5)
	random_x = 2 + int(random.random() * 2)
	ball_position = windowsize[0]/2, windowsize[1]/2
	if score_1 &gt; score_2:
		ball_velocity = random_x, random_y
	elif score_2 &gt; score_1:
		ball_velocity = -random_x, random_y
	else:
		if random.random() &gt; 0.5:
			ball_velocity = random_x, random_y
		else:
			ball_velocity = -random_x, random_y
	return ball_position, ball_velocity

ball_position, ball_velocity = reset_ball(ball_position, ball_velocity)

while gameContinue:
	clock.tick(50)
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			gameContinue = False

	#input
	keys = pygame.key.get_pressed()

	paddle_d_1 = 0
	paddle_d_2 = 0

	if keys[pygame.K_ESCAPE]:
		gameContinue = False

	if keys[pygame.K_w]:
		paddle_y_1 -= 4
		paddle_d_1 -= 1
	if keys[pygame.K_s]:
		paddle_y_1 += 4
		paddle_d_1 += 1
	if keys[pygame.K_o]:
		paddle_y_2 -= 4
		paddle_d_2 -= 1
	if keys[pygame.K_l]:
		paddle_y_2 += 4
		paddle_d_1 += 1

	ball_old_position = ball_position
	ball_position = ball_position[0] + ball_velocity[0], ball_position[1] + ball_velocity[1]

	#check new ball_position for collision with top and bottom edges
	if ball_position[1] &lt; 12 or ball_position[1] &gt; windowsize[1] - 12:
		#bounce off top or bottom edge
		ball_position = ball_old_position
		ball_velocity = (ball_velocity[0], -ball_velocity[1])

	#check new ball_position for collision with score zones
	if ball_position[0] &lt; paddle_dimensions[0]:
		#player 1 scores
		ball_position, ball_velocity = reset_ball(ball_position, ball_velocity)
		score_1 += score_ball
		score_ball = 1
	if ball_position[0] &gt; windowsize[0] - paddle_dimensions[0]:
		#player 2 scores
		score_2 += score_ball
		score_ball = 1
		ball_position, ball_velocity = reset_ball(ball_position, ball_velocity)

	ball_rect = pygame.Rect((ball_position[0] - 12, ball_position[1] - 12), (24, 24))
	#check new ball_position for collision with paddle_1
	paddle_rect = pygame.Rect((paddle_x_1, paddle_y_1), paddle_dimensions)
	if ball_rect.colliderect(paddle_rect):
		#if the ball has passed the paddle x middle
		if ball_position[0] &lt; paddle_x_1 + paddle_dimensions[0]/2:
			#test if ball is up or down
			if ball_position[1] &lt; paddle_y_1 + paddle_dimensions[1]:
				#ball is up
				ball_velocity = ball_velocity[0], ball_velocity[1] - 4
			else:
				#ball is down
				ball_velocity = ball_velocity[0], ball_velocity[1] + 4
		else:
			ball_velocity = ball_velocity[0] * -1 + 0.1, ball_velocity[1] + paddle_d_1
			ball_position = paddle_x_1 + paddle_dimensions[0] + 12 + ball_velocity[0], ball_position[1] + ball_velocity[1]
			score_ball = score_ball * 2
			score_1 = int(score_1 * 0.90)
			score_2 = int(score_2 * 0.90)

	paddle_rect = pygame.Rect((paddle_x_2, paddle_y_2), paddle_dimensions)
	if ball_rect.colliderect(paddle_rect):
		#if the ball has passed the paddle x middle
		if ball_position[0] &gt; paddle_x_2 + paddle_dimensions[0]:
			#test if ball is up or down
			if ball_position[1] &lt; paddle_y_2 + paddle_dimensions[1] / 2:
				#ball is up
				ball_velocity = ball_velocity[0], ball_velocity[1] - 4
			else:
				#ball is down
				ball_velocity = ball_velocity[0], ball_velocity[1] + 4
		else:
			ball_velocity = ball_velocity[0] * -1 - 0.1, ball_velocity[1] + paddle_d_2
			ball_position = paddle_x_2 - 12 + ball_velocity[0], ball_position[1] + ball_velocity[1]

			score_ball = score_ball * 2
			score_1 = int(score_1 * 0.90)
			score_2 = int(score_2 * 0.90)

	#draw
	screen.fill((0,0,0))

	screen.blit(paddle, (paddle_x_1, paddle_y_1))
	screen.blit(paddle, (paddle_x_2, paddle_y_2))
	screen.blit(ball, (ball_position[0] - 12, ball_position[1] - 12))

	screen.blit(font.render(str(score_1), False, game_colour), (0,0))
	offset = font.size(str(score_2))
	screen.blit(font.render(str(score_2), False, game_colour), (windowsize[0]-offset[0],0))
	offset = font.size(str(score_ball))
	screen.blit(font.render(str(score_ball), False, game_colour), (windowsize[0]/2 - offset[0]/2, windowsize[1]-offset[1]))
	pygame.display.flip()
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thomaspurnell.com/reverse-pong-game-snippet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

