<?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>Rough Sea Games &#187; Programming</title>
	<atom:link href="http://blog.rough-sea.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rough-sea.com</link>
	<description>Indie game development</description>
	<lastBuildDate>Sun, 29 Jan 2012 12:19:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<image>
			<title>Rough Sea Games</title>
			<url>/wp-content/uploads/2008/10/rsg_rss-feed.jpg</url>
			<link>http://blog.rough-sea.com</link>
			<width>144</width>
			<height>95</height>
			<description>Indie game development</description>
		</image>		<item>
		<title>Admob with Air for Android using the native Android API</title>
		<link>http://blog.rough-sea.com/2011/08/admob-with-air-for-android-using-the-native-android-api/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=admob-with-air-for-android-using-the-native-android-api</link>
		<comments>http://blog.rough-sea.com/2011/08/admob-with-air-for-android-using-the-native-android-api/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 10:22:57 +0000</pubDate>
		<dc:creator>Joe Cool</dc:creator>
				<category><![CDATA[Adobe Air]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[ad]]></category>
		<category><![CDATA[admob]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[air for android]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1690</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F08%2Fadmob-with-air-for-android-using-the-native-android-api%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F08%2Fadmob-with-air-for-android-using-the-native-android-api%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>I have been researching for a while and to include Admob into my Android game made with Adobe Air and I stumbled over this<a href="http://www.jamesward.com/2011/05/11/extending-air-for-android/"> article</a> from James Ward. He describes actually the most important steps to have everything setup.</p> <p>So as soon as you have done &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2011/08/admob-with-air-for-android-using-the-native-android-api/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F08%2Fadmob-with-air-for-android-using-the-native-android-api%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F08%2Fadmob-with-air-for-android-using-the-native-android-api%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I have been researching for a while and to include Admob into my Android game made with Adobe Air and I stumbled over this<a href="http://www.jamesward.com/2011/05/11/extending-air-for-android/"> article</a> from James Ward. He describes actually the most important steps to have everything setup.</p>
<p>So as soon as you have done the steps to set everything up as stated in James Ward article  (to the point where it says <strong>System Notifications and Services</strong>), you can start following the steps here to have your admob add running in your game or app.</p>
<p><strong>1. Create the Notification Service in Java</strong></p>
<p>First of all create a java class called NotificationService. The class is also copied over from James Ward article with slight  changes:</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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.roughsea</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// This code is copied form James Ward article Extending Air for Android and change slightly</span>
<span style="color: #666666; font-style: italic;">// http://www.jamesward.com/2011/05/11/extending-air-for-android/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedInputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.DataInputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.ServerSocket</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.Socket</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Service</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Intent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.IBinder</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Looper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.util.Log</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> NotificationService <span style="color: #000000; font-weight: bold;">extends</span> Service
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> MainApp app<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">boolean</span> stopped<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Thread</span> serverThread<span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">ServerSocket</span> ss<span style="color: #339933;">;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> IBinder onBind<span style="color: #009900;">&#40;</span>Intent intent<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Log.<span style="color: #006633;">d</span><span style="color: #009900;">&#40;</span>getClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getSimpleName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;onCreate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	serverThread <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Thread</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Runnable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	  <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
		  Looper.<span style="color: #006633;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  ss <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ServerSocket</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12345</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  ss.<span style="color: #006633;">setReuseAddress</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  ss.<span style="color: #006633;">setPerformancePreferences</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>stopped<span style="color: #009900;">&#41;</span>
		  <span style="color: #009900;">&#123;</span>
		    <span style="color: #003399;">Socket</span> accept <span style="color: #339933;">=</span> ss.<span style="color: #006633;">accept</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    accept.<span style="color: #006633;">setPerformancePreferences</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">100</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    accept.<span style="color: #006633;">setKeepAlive</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #003399;">DataInputStream</span> _in <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
		    <span style="color: #000000; font-weight: bold;">try</span>
		    <span style="color: #009900;">&#123;</span>
		      _in <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DataInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedInputStream</span><span style="color: #009900;">&#40;</span>accept.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,<span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span>
		    <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e2<span style="color: #009900;">&#41;</span>
		    <span style="color: #009900;">&#123;</span>
		      e2.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span>
			<span style="color: #000066; font-weight: bold;">int</span> id <span style="color: #339933;">=</span>_in.<span style="color: #006633;">readInt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// this depends on what your flash code is sending</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>id <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
			  doNotification<span style="color: #009900;">&#40;</span>_in<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    	<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Throwable</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
	      e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		  Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span>getClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getSimpleName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;Error in Listener&quot;</span>,e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">try</span>
		<span style="color: #009900;">&#123;</span>
		  ss.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
		  Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span>getClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getSimpleName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;keep it simple&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	  <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>,<span style="color: #0000ff;">&quot;Server thread&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    serverThread.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> doNotification<span style="color: #009900;">&#40;</span><span style="color: #003399;">DataInputStream</span> in<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">String</span> task <span style="color: #339933;">=</span> in.<span style="color: #006633;">readUTF</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003399;">String</span> showAdd <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;on&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>task.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>showAdd<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      app.<span style="color: #006633;">showAd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #009900;">&#123;</span>
      app.<span style="color: #006633;">removeAd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setApp<span style="color: #009900;">&#40;</span>MainApp _app<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    app <span style="color: #339933;">=</span> _app<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onDestroy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
	stopped<span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span>
    <span style="color: #009900;">&#123;</span>
      ss.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
    serverThread.<span style="color: #006633;">interrupt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">try</span>
    <span style="color: #009900;">&#123;</span>
      serverThread.<span style="color: #006633;">join</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>2. Create the AS3 code for communication with the service</strong></p>
<p>Include this function wherever it fits your needs in your flash code:</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
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/////////////////////////////////////////////////////////////////////</span>
<span style="color: #666666; font-style: italic;">/////////////////////////////////////////////////////////////////////</span>
<span style="color: #000000; font-weight: bold;">private</span> function ToggleAdd<span style="color: #009900;">&#40;</span>_show<span style="color: #339933;">:</span><span style="color: #003399;">Boolean</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
<span style="color: #009900;">&#123;</span>
	var text<span style="color: #339933;">:</span><span style="color: #003399;">String</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;on&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_show <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
		text <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;off&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	var s<span style="color: #339933;">:</span><span style="color: #003399;">Socket</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Socket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	s.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span>, <span style="color: #cc66cc;">12345</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	s.<span style="color: #006633;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Event</span>.<span style="color: #006633;">CONNECT</span>, function<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span><span style="color: #003399;">Event</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">currentTarget</span> as <span style="color: #003399;">Socket</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">writeInt</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">currentTarget</span> as <span style="color: #003399;">Socket</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">writeUTF</span><span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">currentTarget</span> as <span style="color: #003399;">Socket</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#40;</span>event.<span style="color: #006633;">currentTarget</span> as <span style="color: #003399;">Socket</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	s.<span style="color: #006633;">addEventListener</span><span style="color: #009900;">&#40;</span>IOErrorEvent.<span style="color: #006633;">IO_ERROR</span>, function<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>IOErrorEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
	<span style="color: #009900;">&#123;</span>
		trace<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'error! '</span> <span style="color: #339933;">+</span> event.<span style="color: #006633;">errorID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	s.<span style="color: #006633;">addEventListener</span><span style="color: #009900;">&#40;</span>ProgressEvent.<span style="color: #006633;">SOCKET_DATA</span>, function<span style="color: #009900;">&#40;</span>event<span style="color: #339933;">:</span>ProgressEvent<span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">void</span>
	<span style="color: #009900;">&#123;</span>
	  trace<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'progress '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The port 12345 is actually selected by random, you should just get sure you are using one which is not used anywhere else. I use the text sending for just switching things on or off as an example, but you could actually send any specific data.</p>
<p>You have now setup communication between flash and your android app.  Now Change your MainApp.java like this:</p>
<p>&nbsp;</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
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.roughsea</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">air.app.AppEntry</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Message</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Intent</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.ads.AdRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.ads.AdView</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.ads.AdSize</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.Gravity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.View</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.FrameLayout</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Handler</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MainApp <span style="color: #000000; font-weight: bold;">extends</span> AppEntry
<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> MY_AD_UNIT_ID <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;use your own ad unit id here&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> AdView adView <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> MainApp app<span style="color: #339933;">;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle arg0<span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">try</span>
	<span style="color: #009900;">&#123;</span>
	  app <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	  NotificationService.<span style="color: #006633;">app</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span><span style="color: #339933;">;</span>
	  Intent srv <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, NotificationService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  startService<span style="color: #009900;">&#40;</span>srv<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// service could not be started</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>arg0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> showAd<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> handler.<span style="color: #006633;">sendEmptyMessage</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> removeAd<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> handler.<span style="color: #006633;">sendEmptyMessage</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">private</span> Handler handler <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Handler<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleMessage<span style="color: #009900;">&#40;</span>Message msg<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>msg.<span style="color: #006633;">what</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
	  <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>adView <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
		  FrameLayout.<span style="color: #006633;">LayoutParams</span> adsParams <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FrameLayout.<span style="color: #006633;">LayoutParams</span><span style="color: #009900;">&#40;</span>
	        FrameLayout.<span style="color: #006633;">LayoutParams</span>.<span style="color: #006633;">WRAP_CONTENT</span>,
			FrameLayout.<span style="color: #006633;">LayoutParams</span>.<span style="color: #006633;">WRAP_CONTENT</span>,
			Gravity.<span style="color: #006633;">TOP</span><span style="color: #339933;">|</span>Gravity.<span style="color: #006633;">CENTER_HORIZONTAL</span>
		  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	      adView <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AdView<span style="color: #009900;">&#40;</span>app, AdSize.<span style="color: #006633;">BANNER</span>, MY_AD_UNIT_ID<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      app.<span style="color: #006633;">addContentView</span><span style="color: #009900;">&#40;</span>adView, adsParams<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	      AdRequest request <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AdRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      request.<span style="color: #006633;">addTestDevice</span><span style="color: #009900;">&#40;</span>AdRequest.<span style="color: #006633;">TEST_EMULATOR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      request.<span style="color: #006633;">addTestDevice</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;0299D8EE8828629D2B15162000A09DE9&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	      adView.<span style="color: #006633;">loadAd</span><span style="color: #009900;">&#40;</span>request<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #009900;">&#123;</span>
		  adView.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span>.<span style="color: #006633;">VISIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
	  <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>msg.<span style="color: #006633;">what</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
	  <span style="color: #009900;">&#123;</span>
	    adView.<span style="color: #006633;">setVisibility</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">View</span>.<span style="color: #006633;">INVISIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>3. You want to place your ad somewhere else, no Problem!</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">FrameLayout.<span style="color: #006633;">LayoutParams</span> adsParams <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FrameLayout.<span style="color: #006633;">LayoutParams</span><span style="color: #009900;">&#40;</span>
  FrameLayout.<span style="color: #006633;">LayoutParams</span>.<span style="color: #006633;">WRAP_CONTENT</span>,
  FrameLayout.<span style="color: #006633;">LayoutParams</span>.<span style="color: #006633;">WRAP_CONTENT</span>,
  Gravity.<span style="color: #006633;">TOP</span><span style="color: #339933;">|</span>Gravity.<span style="color: #006633;">CENTER_HORIZONTAL</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Just change the Gravity parameters to your needs. You can find a explanation of those parameters <a href="http://developer.android.com/reference/android/view/Gravity.html">here</a></p>
<p><strong>4. Now we need to setup the manifest file. </strong></p>
<p>Load the AndroidManifest.xml file into your editor. You might have done some changes already when following James Ward article, but there are still things missing:</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
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest</span> <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;com.roughsea&quot;</span> <span style="color: #000066;">android:versionCode</span>=<span style="color: #ff0000;">&quot;1000000&quot;</span> <span style="color: #000066;">android:versionName</span>=<span style="color: #ff0000;">&quot;1.0.0&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;app&quot;</span> <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/icon&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:theme</span>=<span style="color: #ff0000;">&quot;@style/Theme.NoShadow&quot;</span> <span style="color: #000066;">android:background</span>=<span style="color: #ff0000;">&quot;@null&quot;</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;app&quot;</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.MainApp&quot;</span> <span style="color: #000066;">android:launchMode</span>=<span style="color: #ff0000;">&quot;singleTask&quot;</span> <span style="color: #000066;">android:screenOrientation</span>=<span style="color: #ff0000;">&quot;nosensor&quot;</span> <span style="color: #000066;">android:configChanges</span>=<span style="color: #ff0000;">&quot;keyboardHidden|orientation&quot;</span> <span style="color: #000066;">android:windowSoftInputMode</span>=<span style="color: #ff0000;">&quot;stateHidden|adjustResize&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.MAIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.LAUNCHER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;aspectRatio&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;landscape&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;autoOrients&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;fullScreen&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;com.google.ads.AdActivity&quot;</span> <span style="color: #000066;">android:configChanges</span>=<span style="color: #ff0000;">&quot;keyboard|keyboardHidden|orientation&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;receiver</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;com.admob.android.ads.analytics.InstallReceiver&quot;</span> <span style="color: #000066;">android:exported</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;com.android.vending.INSTALL_REFERRER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/receiver<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">android:enabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.NotificationService&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-sdk</span> <span style="color: #000066;">android:minSdkVersion</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">android:targetSdkVersion</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.INTERNET&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_NETWORK_STATE&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.READ_PHONE_STATE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The following three lines are necessary if you want to have a landscape orientation pinned as well as fullscreen mode enabled. Change those parameters to your needs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;aspectRatio&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;landscape&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;autoOrients&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;meta-data</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;fullScreen&quot;</span> <span style="color: #000066;">android:value</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>If your compiler does not find that style android:theme=&#8221;@style/Theme.NoShadow&#8221;, open the values directory under res in your project and load styles.xml</p>
<p>Add the following code to your styles.xml if its missing:</p>
<p><!--?xml version="1.0" encoding="UTF-8"?--></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;style</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Theme.NoShadow&quot;</span> <span style="color: #000066;">parent</span>=<span style="color: #ff0000;">&quot;@android:style/Theme.NoTitleBar&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;android:windowContentOverlay&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>@null<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;android:windowNoTitle&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>5. You are done&#8230;sort of</strong></p>
<p>You should be ready now. First of all compile your swf, if you use the packager, it will build a apk file, which can be opened with any unzip tool. Go to the asset folder and copy the .swf into the asset folder of your project and rename it to app.swf</p>
<p>Compile your java android project and start the emulator. If you did everything right, you will see a test ad popping up in your flash app or game.</p>
<p>Dont forget to remove the addTestDevice codelines before uploading your app to the android market.</p>
<p><strong>Closing thoughts</strong><br />
There are many android device and I have tested this code only an a Samsung Galaxy 9000S, but actually it should work on any other device. I hope I haven&#8217;t forgotten anything important. The code should work, I pasted from the original project and did only make some string adjustments. Please let me know if you run into any problems and I will try to help as far as I can.</p>
<p>I have no proof yet, if this fixed the account fraud problems, but I am quite sure, because the standard google admob API is used. We should be on the safe side here. You are actually not limited to admob, you could add any other advertisement API  if its available for android.</p>
<p>Thats its for now. I hope somebody finds this helpful.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1690&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F08%2Fadmob-with-air-for-android-using-the-native-android-api%2F&amp;title=Admob%20with%20Air%20for%20Android%20using%20the%20native%20Android%20API" id="wpa2a_2">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2011/08/admob-with-air-for-android-using-the-native-android-api/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Alien Invasion Inside &#8211; the already done list</title>
		<link>http://blog.rough-sea.com/2011/07/alien-invasion-inside-the-already-done-list/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=alien-invasion-inside-the-already-done-list</link>
		<comments>http://blog.rough-sea.com/2011/07/alien-invasion-inside-the-already-done-list/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 15:23:54 +0000</pubDate>
		<dc:creator>Joe Cool</dc:creator>
				<category><![CDATA[Earth vs. Aliens]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[alien invasion]]></category>
		<category><![CDATA[Flint]]></category>
		<category><![CDATA[Flixel]]></category>
		<category><![CDATA[flixel power tools]]></category>
		<category><![CDATA[indie game development]]></category>
		<category><![CDATA[level design]]></category>
		<category><![CDATA[missile command]]></category>
		<category><![CDATA[todo list]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1623</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F07%2Falien-invasion-inside-the-already-done-list%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F07%2Falien-invasion-inside-the-already-done-list%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>A little later than promised. Here is my little list of things I have done for Alien Invasion until to now. I have translated and pooled the tasks, to make it more readable for you. All figures are calculated in work hours.</p> <p>Protoype and design</p> Design 10,0 &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2011/07/alien-invasion-inside-the-already-done-list/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F07%2Falien-invasion-inside-the-already-done-list%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F07%2Falien-invasion-inside-the-already-done-list%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A little later than promised. Here is my little list of things I have done for Alien Invasion until to now. I have translated and pooled the tasks, to make it more readable for you. All figures are calculated in work hours.</p>
<p><strong>Protoype and design</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="356">
<colgroup>
<col width="267"></col>
<col width="89"></col>
</colgroup>
<tbody>
<tr height="19">
<td width="267" height="19">Design</td>
<td width="89" align="right">10,0</td>
</tr>
<tr height="19">
<td height="19">Prototype</td>
<td align="right">16,0</td>
</tr>
<tr height="19">
<td height="19"><strong>Sum</strong></td>
<td align="right"><strong>26,0</strong></td>
</tr>
</tbody>
</table>
<p>10 hours design sounds ok for this little game, but honestly I should have put much more thoughts in the concept. That could have saved me a ton of work. The prototype was done in a time of 1 week, 2-3 hours in the evenings.</p>
<p><strong>Player programming</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col width="267"></col>
<col width="89"></col>
<col width="126"></col>
</colgroup>
<tbody>
<tr height="19">
<td width="267" height="19">Player   game mode: Survival</td>
<td width="89" align="right">6,0</td>
<td width="126">2 redesigns</td>
</tr>
<tr height="19">
<td height="19">Player game   mode: Story</td>
<td align="right">2,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player   automatic rocket launcher</td>
<td align="right">6,0</td>
<td>gone</td>
</tr>
<tr height="19">
<td height="19">Player special   attacks</td>
<td align="right">12,0</td>
<td>gone</td>
</tr>
<tr height="19">
<td height="19">Player death</td>
<td align="right">3,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player skyline</td>
<td align="right">7,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player   combo system and score</td>
<td align="right">4,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player weapon   selection</td>
<td align="right">10,0</td>
<td>4 redesigns</td>
</tr>
<tr height="19">
<td height="19">Player skyline   shield</td>
<td align="right">4,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player   helicopter and people</td>
<td align="right">6,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player   load/save game</td>
<td align="right">5,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player 2   cannons</td>
<td align="right">2,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player   shooting</td>
<td align="right">4,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player tractor   beam</td>
<td align="right">3,5</td>
<td>2 redesigns</td>
</tr>
<tr height="19">
<td height="19">Player wave   shot</td>
<td align="right">1,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player laser   shot</td>
<td align="right">1,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player homing   missile</td>
<td align="right">4,5</td>
<td>3 redesigns</td>
</tr>
<tr height="19">
<td height="19">Player emp   mine</td>
<td align="right">4,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Player virus   shot</td>
<td align="right">1,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19"><strong>Sum</strong></td>
<td align="right"><strong>88,0</strong></td>
<td></td>
</tr>
<tr height="19">
<td height="19"><strong>Wasted</strong></td>
<td align="right"><strong>18,0</strong></td>
<td></td>
</tr>
</tbody>
</table>
<p>The player programming was the most work yet. So I wasted about 18-20 hours on dump weapons. A little more thoughts on the design side could have helped, but well you never know. 4 redesigns on the weapon selection was necessary and I am still not 100% happy, but its ok for now. I got lots of help from friends, which suggested what should be changed. Thanks guys! <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Enemy Programming</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="666" height="602">
<colgroup>
<col width="267"></col>
<col width="89"></col>
<col width="126"></col>
</colgroup>
<tbody>
<tr height="19">
<td width="267" height="19">Enemy shooting behaviour</td>
<td width="89" align="right">3,0</td>
<td width="126"></td>
</tr>
<tr height="19">
<td height="19">Enemy formation leader</td>
<td align="right">2,0</td>
<td>gone</td>
</tr>
<tr height="19">
<td height="19">Enemy movement patterns</td>
<td align="right">10,0</td>
<td>gone</td>
</tr>
<tr height="19">
<td height="19">Enemy steering behaviour Test</td>
<td align="right">12,0</td>
<td>gone</td>
</tr>
<tr height="19">
<td height="19">Enemy spline   movement</td>
<td align="right">3,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy formations</td>
<td align="right">4,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy laser attack</td>
<td align="right">5,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy repair behaviour</td>
<td align="right">3,5</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy spawning</td>
<td align="right">2,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy cloaking</td>
<td align="right">2,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy mother ship (4-5 different attacks)</td>
<td align="right">16,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy shield</td>
<td align="right">4,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">Enemy health bar</td>
<td align="right">2,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19"><strong>Sum</strong></td>
<td align="right"><strong>69,0</strong></td>
<td></td>
</tr>
<tr height="19">
<td height="19"><strong>Wasted</strong></td>
<td align="right"><strong>24,0</strong></td>
<td></td>
</tr>
</tbody>
</table>
<p>You see, I wasted too much time on the enemies. Way too much. I should have used splines from the first minute&#8230;but I wanted to have a really cool movement behaviour patterns. I tried different steering behaviours etc. Nothing really worked out well or was slow as hell. I got frustrated of that topic a several times. Using splines was my best choice until now. Some enemies still use parts of the steering behaviour. Anyway, lessons learned.</p>
<p><strong>GUI Programming</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col width="267"></col>
<col width="89"></col>
<col width="126"></col>
</colgroup>
<tbody>
<tr height="19">
<td width="267" height="19">GUI   in game hud</td>
<td width="89" align="right">4,0</td>
<td width="126">3 redesigns</td>
</tr>
<tr height="19">
<td height="19">GUI   cool down  hud</td>
<td align="right">1,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">GUI weapon   selection hud</td>
<td align="right">8,0</td>
<td>3 redesigns</td>
</tr>
<tr height="19">
<td height="19">GUI result   hud</td>
<td align="right">6,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">GUI  start screen</td>
<td align="right">6,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">GUI level   selection</td>
<td align="right">5,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">GUI pause/mute   button</td>
<td align="right">1,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19">GUI pause menu</td>
<td align="right">3,0</td>
<td></td>
</tr>
<tr height="19">
<td height="19"><strong>Sum</strong></td>
<td align="right"><strong>34,0</strong></td>
<td></td>
</tr>
</tbody>
</table>
<p>I am quite happy with the GUI so far. Flixel and Flixel power tools don&#8217;t have that much GUI stuff so I thought I would spend much more time. But I reduced everything to the bare minimum. I am quite happy with the outcome. There is still some work to do, but that&#8217;s easy stuff like achievement and credits screen.</p>
<p><strong>Effects Programming</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 9500; width: 200pt;" width="267"></col>
<col style="mso-width-source: userset; mso-width-alt: 3157; width: 67pt;" width="89"></col>
<col style="mso-width-source: userset; mso-width-alt: 4465; width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; width: 200pt;" width="267" height="19">Effects   logo intro</td>
<td class="xl67" style="border-left: none; width: 67pt;" width="89" align="right">2,5</td>
<td class="xl66" style="border-left: none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects smoke   with Flixel</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">1,0</td>
<td class="xl66" style="border-top: none; border-left: none;">gone</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   integration FLINT particle system</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">1,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   explosion and smoke<span style="mso-spacerun: yes;"> </span></td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">5,5</td>
<td class="xl66" style="border-top: none; border-left: none;">2 redesign</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects level   selection screen</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">2,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   mothership attack</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">2,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   polishing</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">5,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: none;" height="19"><strong>Sum</strong></td>
<td class="xl68" style="border-top: none; border-left: none;" align="right"><strong>19,0</strong></td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: none;" height="19"><strong>Wasted</strong></td>
<td class="xl68" style="border-top: none; border-left: none;" align="right"><strong>1,0</strong></td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
</tbody>
</table>
<p>Well this is my favourite part. Just 19h for such an outcome. I am really thankful for the FLINT particle system. I will need some more polishing time, but I have not wasted much time.  Good stuff!</p>
<p><strong>Other Programming</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 9500; width: 200pt;" width="267"></col>
<col style="mso-width-source: userset; mso-width-alt: 3157; width: 67pt;" width="89"></col>
<col style="mso-width-source: userset; mso-width-alt: 4465; width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; width: 200pt;" width="267" height="19">Other:   performance optimization</td>
<td class="xl67" style="border-left: none; width: 67pt;" width="89" align="right">10,0</td>
<td class="xl67" style="border-left: none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Other: asset   management</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">4,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Other:   bug fixes</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">16,0</td>
<td class="xl66" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Other Flixel   port to 2.5</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">6,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: none;" height="19"><strong>Sum</strong></td>
<td class="xl68" style="border-top: none; border-left: none;" align="right"><strong>36,0</strong></td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
</tbody>
</table>
<p>Premature optimization!! I should no better, I watched this <a href="http://the-witness.net/news/2011/06/how-to-program-independent-games/">video from Jonathan Blow</a>! Well to be honest, this was a necessary optimization. My frame time on my 5 year old laptop went from 10 frames up to 20 frames with all the particle action. I could throw away hundreds of lines of code as well, so that was worth it.  The port to Flixel 2.5 was not a big pain and worth the work as well.</p>
<p>16h bug fixes sounds not that much, but I have not tracked everything, its probably much more time which went into bug fixing.</p>
<p>Not much hassle with the asset management, just a few centralised files and I use .txt files for my levels. XMLs would be too complicated for my efforts.</p>
<p><strong>Leveldesign and Tools</strong></p>
<p>&nbsp;</p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 9500; width: 200pt;" width="267"></col>
<col style="mso-width-source: userset; mso-width-alt: 3157; width: 67pt;" width="89"></col>
<col style="mso-width-source: userset; mso-width-alt: 4465; width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; width: 200pt;" width="267" height="19">Level Design   spline editor</td>
<td class="xl68" style="border-left: none; width: 67pt;" width="89" align="right">5,0</td>
<td class="xl67" style="border-left: none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design   editing splines</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">4,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design   skyline editor</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">4,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design   editing skylines</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">1,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design:   tutorial mission</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">8,0</td>
<td class="xl67" style="border-top: none; border-left: none;">gone</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design:   enemy balancing</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">8,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design   story level 1- 5</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">6,0</td>
<td class="xl68" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Level Design   story mode level 6-10</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">6,0</td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19"><strong>Sum</strong></td>
<td class="xl69" style="border-top: none; border-left: none;" align="right"><strong>42,0</strong></td>
<td class="xl69" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19"><strong>Wasted</strong></td>
<td class="xl69" style="border-top: none; border-left: none;" align="right"><strong>8,0</strong></td>
<td class="xl67" style="border-top: none; border-left: none;"></td>
</tr>
</tbody>
</table>
<p>Skyline and spline editors were easy to implement and worth their time. Very useful tools. The tutorial mission was a complete waste of time. I did this far to early in the process and had to throw it away completely. Most of the work left is on the level design part. You could spend endless hours. I have not much experience in level design and this is really the hardest part for me at the moment. I got a little better already, but I am a complete noob. It can only get better <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>&nbsp;</p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 9500; width: 200pt;" width="267"></col>
<col style="mso-width-source: userset; mso-width-alt: 3157; width: 67pt;" width="89"></col>
<col style="mso-width-source: userset; mso-width-alt: 4465; width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; width: 200pt;" width="267" height="19">Graphics</td>
<td class="xl68" style="border-left: none; width: 67pt;" width="89" align="right">20,0</td>
<td class="xl68" style="border-left: none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Creating sound effects</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">8,0</td>
<td class="xl68" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">Music<span style="mso-spacerun: yes;"> </span></td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">2,0</td>
<td class="xl68" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: none;" height="19">TODO list</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">4,0</td>
<td class="xl68" style="border-top: none; border-left: none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19"><strong>Sum</strong></td>
<td class="xl69" style="border-top: none; border-left: none;" align="right"><strong>34,0</strong></td>
<td class="xl69" style="border-top: none; border-left: none;"></td>
</tr>
</tbody>
</table>
<p>The graphics part is only integrating graphics and doing some additional ones. The most graphics are done by <a href="http://chrisnoeth.de/">Chris Noeth</a>. The music is done by <a href="http://caingerman.com/">Cain German</a>, so I need only to give feedback and integrate the music. The sound effects are created with the great <a href="http://www.drpetter.se/project_sfxr.html">sfxr</a> and there is a iPhone version of this cool tool which I use as well! So this part is mainly outsourced. But I get better in doing some art myself using <a href="http://www.gimp.org/">gimp</a>. I lately started using <a href="http://itunes.apple.com/de/app/sprite-something/id372515745?mt=8">sprite something</a> on the iPad, not for Alien Invasion but maybe for the next game.</p>
<p><strong>Marketing</strong></p>
<p>&nbsp;</p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="width: 200pt;" width="267"></col>
<col style="width: 67pt;" width="89"></col>
<col style="width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; width: 200pt;" width="267" height="19">Marketing   &#8211; videos/screenshots</td>
<td class="xl67" style="border-left: medium none; width: 67pt;" width="89" align="right">6,0</td>
<td class="xl66" style="border-left: medium none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: medium none;" height="19">Marketing &#8211; Flixel and tigsource forum</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;" align="right">2,0</td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: medium none;" height="19">Marketing &#8211;   blog posts</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;" align="right">4,0</td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: medium none;" height="19">Marketing &#8211;   twitter</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;" align="right">10,0</td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: medium none;" height="19"><strong>Sum</strong></td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right"><strong>22,0</strong></td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
</tbody>
</table>
<p>Well not much up. Spent a view hours making video, screenshots, forum posts and writing blogs, what I should do more often. Twitter sucks a lot of time, but I think its the best marketing tool for indie game developers.</p>
<p>&nbsp;</p>
<p><strong>Whats left?</strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="482">
<colgroup>
<col style="width: 200pt;" width="267"></col>
<col style="width: 67pt;" width="89"></col>
<col style="width: 94pt;" width="126"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; width: 200pt;" width="267" height="19">story   mode<span> </span>level 11-15</td>
<td class="xl68" style="border-left: medium none; width: 67pt;" width="89" align="right">6,0</td>
<td class="xl68" style="border-left: medium none; width: 94pt;" width="126"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">story mode level 16-20</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">6,0</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">story mode level 21-25</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">6,0</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">story mode level 26-30</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">6,0</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19"></td>
<td class="xl68" style="border-top: medium none; border-left: medium none;"></td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">achievements +   screen</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">6,0</td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">survival mode   redesign</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">4,0</td>
<td class="xl66" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">some missing   sound effects</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">2,0</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">some missing   effects</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">2,0</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">credits +   bonus level</td>
<td class="xl68" style="border-top: medium none; border-left: medium none;" align="right">4,0</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19">polishing +   balancing</td>
<td class="xl69" style="border-top: medium none; border-left: medium none;">?</td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl67" style="height: 14.4pt; border-top: medium none;" height="19"></td>
<td class="xl68" style="border-top: medium none; border-left: medium none;"></td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: medium none;" height="19"><strong>TODO</strong></td>
<td class="xl70" style="border-top: medium none; border-left: medium none;" align="right"><strong>42,0</strong></td>
<td class="xl67" style="border-top: medium none; border-left: medium none;"></td>
</tr>
</tbody>
</table>
<p>Well theoretically I am done in a week, but as you know yourself, the first 90% are done, now I am at the second 90%. Well I hope not, because I did a lot of polishing already, but 42 hours is probably the best number which could be left. The meaning of life and such&#8230;.:)</p>
<p>Well to be honest there is some stuff missing like integration of the kongregate, mochi or newsground APIs, but I will try to sell it first on <a href="http://www.flashgamelicense.com/">FGL</a>.</p>
<p>So the total numbers are <strong>370 hours of work </strong>until now and <strong>51 hours wasted</strong>. I did work 2 month parttime work in the evenings and one month full time work. I hope I can finish the game within the next two weeks.</p>
<p>Ok thats it for now. Hope you enjoyed reading it!</p>
<p>Oh I forgot something, I think I played my game for at least 40-50 hours. I have just not tracked that time&#8230; <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 2249px; width: 1px; height: 1px; overflow: hidden;">
<table border="0" cellspacing="0" cellpadding="0" width="356">
<colgroup>
<col style="mso-width-source: userset; mso-width-alt: 9500; width: 200pt;" width="267"></col>
<col style="mso-width-source: userset; mso-width-alt: 3157; width: 67pt;" width="89"></col>
</colgroup>
<tbody>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; width: 200pt;" width="267" height="19">Effects   smoke with Flixel</td>
<td class="xl67" style="border-left: none; width: 67pt;" width="89" align="right">1,0</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   integration FLINT particle system</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">1,0</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   explosion and smoke<span style="mso-spacerun: yes;"> </span></td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">5,5</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects level   selection screen</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">2,0</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   mothership attack</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">2,0</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl66" style="height: 14.4pt; border-top: none;" height="19">Effects   polishing</td>
<td class="xl67" style="border-top: none; border-left: none;" align="right">5,0</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: none;" height="19">Sum</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">16,5</td>
</tr>
<tr style="height: 14.4pt;" height="19">
<td class="xl65" style="height: 14.4pt; border-top: none;" height="19">Wasted</td>
<td class="xl68" style="border-top: none; border-left: none;" align="right">1,0</td>
</tr>
</tbody>
</table>
</div>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1623&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2011%2F07%2Falien-invasion-inside-the-already-done-list%2F&amp;title=Alien%20Invasion%20Inside%20%26%238211%3B%20the%20already%20done%20list" id="wpa2a_4">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2011/07/alien-invasion-inside-the-already-done-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Game Instances Management</title>
		<link>http://blog.rough-sea.com/2010/11/multiple-game-instances-management/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=multiple-game-instances-management</link>
		<comments>http://blog.rough-sea.com/2010/11/multiple-game-instances-management/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 09:55:05 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[admintool]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1467</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Fmultiple-game-instances-management%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Fmultiple-game-instances-management%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>In most MMOGs you have more than one game instance, because its much easier to implement instead of a huge game universe for all players. Because the game instances do not interact, the players can be allowed to play on multiple game instances at the same time.</p> &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/11/multiple-game-instances-management/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Fmultiple-game-instances-management%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Fmultiple-game-instances-management%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>In most MMOGs you have more than one game instance, because its much easier to implement instead of a huge game universe for all players. Because the game instances do not interact, the players can be allowed to play on multiple game instances at the same time.</p>
<p>The problem is that most Admintools are just a special interface to the game. They run in the same environment as the game and therefore there are multiple Admintool instances in a multi game instance game too. This is very annoying to the Community Management, because they have to use X Admintools to manage X game instances. In our planning phase of our Admintool we of course talked to the people that should use it. The Community Managers told us that they&#8217;ve coded scripts that execute queries on several Admintools to make their work more comfortable. Yeah! Nice guys, they optimize their workflow on themself. But wait a second&#8230; The Community Management is not supposed to write code, especially if its a workaround for a bad architecture. There is no reason to have an Admintool for every game instance, but there are much reasons to have only one Admintool for every game instance:</p>
<ul>
<li>You are able to query multiple game instances with a single mouse click. (e.g. search for an user with a specific email or IP)</li>
<li>There is a central role and user management. No need to do the setup again and again.</li>
<li>Its possible to merge statistics from several game instances to an overall statistic.</li>
<li>The Community Management do not have dozens of Admintool windows. There is only one Admintool to rule them all.</li>
</ul>
<p>I hope i&#8217;ve convinced you. If you know reasons that speak against a single Admintool feel free to write a comment.</p>
<p>Ok, enough of the &#8220;why we do what we do&#8221; thingy. Lets talk about the how. If an Admintool is not just an interface to the game instance, it has to be an application on its own. That means you do not only have game servers, you have an Admintool server too. Additionally the Admintool needs a way to communicate to the  game servers and vice versa. A direct remote SQL connection is out of the question for security and other reasons. We decided do use <a href="http://activemq.apache.org/">ActiveMq </a>for the communication. The main reason is the guaranteed delivery feature. If the Admintool goes down, all messages targeting the Admintool are stored on the senders hard disc. They will be sent once the Admintool goes up again. This way no tracking data from the game will be lost.</p>
<p>The Admintool needs a way to know of all the game instances floating in the universe. You don&#8217;t have to worry. There is no list of game servers and there connection properties stored at the admintool. Instead we&#8217;ve decided to make the Admintool the sun of our game universe with many game planets surrounding it. This makes it much easier to maintain all the connections. The game servers will connect themself to the Admintool at their first startup. The Admintool sends the game server a unique internal server id which is used for subsequent connections (e.g. after a update and server restart). This way the Admintool can manage a list of all game instances in the world.</p>
<p>Thats all for now. Next time I write about multiple server queries and how to filter, sort and page them.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1467&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Fmultiple-game-instances-management%2F&amp;title=Multiple%20Game%20Instances%20Management" id="wpa2a_6">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/11/multiple-game-instances-management/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lessons Learned: Asset Loading</title>
		<link>http://blog.rough-sea.com/2010/11/lessons-learned-asset-loading/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=lessons-learned-asset-loading</link>
		<comments>http://blog.rough-sea.com/2010/11/lessons-learned-asset-loading/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 14:45:12 +0000</pubDate>
		<dc:creator>Manuel</dc:creator>
				<category><![CDATA[games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[asset]]></category>
		<category><![CDATA[broken connection]]></category>
		<category><![CDATA[data loss]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[loader]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1480</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Flessons-learned-asset-loading%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Flessons-learned-asset-loading%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Handling resource loading in a web project can be tricky sometimes. We stumbled time and time again over new issues. Today, I would like to share some thoughts with you about this topic. These are things that may help you to get asset handling right the first &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/11/lessons-learned-asset-loading/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Flessons-learned-asset-loading%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Flessons-learned-asset-loading%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Handling resource loading in a web project can be tricky sometimes. We stumbled time and time again over new issues.  Today, I would like to share some thoughts with you about this topic. These are things that may help you to get asset handling right the first time in your project.</p>
<p>In the beginning, there was our neat little asset loader that early in the development only had to load files locally. From the start we integrated parallel loading of files to speed things up a bit. When we tried it online everything still seemed fine. No worries, ey?  Well, the problems started when we hired an external Quality Assurance team of 20+ people sitting behind a single unstable 2MBit line. To our surprise they weren’t able to load our game at all. Using a remote access tool we debugged what happened and fixed, and changed, and tried out until the game loaded somewhat reliably with their connection.</p>
<p>There were two main problems we had to fight at first:  “File Not Found” and “Broken Data”.</p>
<p><strong>“File Not Found”</strong><br />
Well, sometimes the Flash loader returned a 404-error for no apparent reason. Next time, the game is started, it would find the file but another one not. Crazy stuff! We did not really find the root of the problem. We only guessed that maybe some part of the internet connection was only able to handle a certain number of parallel http requests. Yet, we were able to work around the problem: When a “File Not Found” occurs, we simply flag the asset as “not loading” again and put it in the back of the load list. When the asset loader is done with all the other files it will try to load the file again. We allow this to happen up to 10 times before eventually giving up for good.</p>
<p><strong>“Broken Data”</strong><br />
Now, that our external QA team was much more likely to be able to play the game a new problem emerged. The data that was loaded was sometimes broken.  Pictures looked scrambled; XML-objects threw exceptions on initialization with our loaded data. Again, that was a weird phenomenon that we were not able to find the root of. Yet, our workaround from “File Not Found” worked here as well. We put a try-catch block around the part where we turn the loaded data into real objects and if something fails, the file goes to the back of the load list.</p>
<p>Later, we refined our workaround by adding two more features like “Reducing of Parallel Loading” and “Trick the Cache”.</p>
<p><strong>“Reducing of Parallel Loading”</strong><br />
During our testing we realized that we were able to increase loading stability greatly by only loading on file at a time. Unfortunately, that slows down the whole loading process tremendously. So here is what we did: After every unsuccessful loading attempt we decrease the number of files to load at the same time. So, only users with unstable connections will get slowed down.</p>
<p><strong>“Trick the Cache“</strong><br />
If a load fails, we flag the file so next time we try to load it we try it without the cache. Otherwise we might just get the same broken file again. That is not an obvious thing in Flash since it has its own caching system that is hard to influence and besides, you never know what other caching mechanisms (like proxies) are at work on the way from our servers to the user.  Well, by adding a parameter to the request URL (something like “?foo=” plus a timestamp  or a random number) you can trick most of the caches to believe they need to load the file anew. (External resource about this <a href="http://www.communitymx.com/content/article.cfm?cid=827ea"> here</a>)</p>
<p><strong>Is there any room for improvement?</strong><br />
Oh Lord, yes, there is! For one, we will introduce some kind of <em>hash system</em> to validate downloaded resources at some point in the future. Right now, we only assume that if turning a chunk of binary data into an xml or a bitmap actually worked everything is fine. Well, it’s not. Especially, JPGs files are fairly error tolerant which already did cause broken visuals in the game for some users in the past.</p>
<p>Another cause of problems can be content firewalls. As it appears, some users are not able to download our (I must say brilliant *hehe*) background music while not having any troubles with the other file types. So, I believe we should introduce an <em>optional asset type</em> that will not render the game useless if they’re not found or broken.</p>
<p>Furthermore,<em> alternative data servers</em> could be something worth discussing. If communication with the dedicated data server shows any problems, it would be nice to be able to simply switch to another one.</p>
<p>That&#8217;s it for now. <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Happy Coding,<br />
Manuel</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1480&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F11%2Flessons-learned-asset-loading%2F&amp;title=Lessons%20Learned%3A%20Asset%20Loading" id="wpa2a_8">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/11/lessons-learned-asset-loading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From a stringly typed to a strongly typed messaging system (Part I)</title>
		<link>http://blog.rough-sea.com/2010/10/from-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=from-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i</link>
		<comments>http://blog.rough-sea.com/2010/10/from-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 19:57:47 +0000</pubDate>
		<dc:creator>Philipp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AMF]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[messaging system]]></category>
		<category><![CDATA[stringly typed]]></category>
		<category><![CDATA[strongly typed]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1420</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F10%2Ffrom-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F10%2Ffrom-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Reading the title of this blog post, you might ask yourself</p> <p><img class="alignright" src="http://blogs.msdn.com/blogfiles/cdndevs/WindowsLiveWriter/NewProgrammingJargon_A38D/i%20can%20has%20string_0e1d6ac7-2adf-4b93-8e1a-8caf9e3db81d.jpg" alt="" width="203" height="255" /></p> <p>&#8220;Ok, I know what&#8217;s meant by strongly typed, but what the heck is &#8216;stringly-typed&#8217;?” A good explanation of how this term came up and what is meant by it &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/10/from-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F10%2Ffrom-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F10%2Ffrom-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Reading the title of this blog post, you might ask yourself</p>
<p><img class="alignright" src="http://blogs.msdn.com/blogfiles/cdndevs/WindowsLiveWriter/NewProgrammingJargon_A38D/i%20can%20has%20string_0e1d6ac7-2adf-4b93-8e1a-8caf9e3db81d.jpg" alt="" width="203" height="255" /></p>
<p>&#8220;Ok, I know what&#8217;s meant by strongly typed, but what the heck is  &#8216;stringly-typed&#8217;?” A good explanation of how this term came up and what is meant by it can be found in this <a href="http://stackoverflow.com/questions/2349378/new-programming-jargon-you-coined/2444303#2444303">StackOverflow thread</a>. This collection of new programming jargon is a good read anyway, so don&#8217;t stop after having read the description of “stringly typed”!</p>
<p lang="en-US">Anyhow, in this and my following blog posts I want to discuss the mentioned disadvantages of stringly typed systems, using our messaging system(s) as example. The client and server of our game, Nox Mortis, used a messaging system that is stringly typed in most areas. Our Admintool uses a different  messaging system, but there are parts that don&#8217;t follow a strongly typed paradigm, too. According to the description posted at Stack Overflow, this means that our code “is usually a pain to understand and detonates at runtime with errors that the compiler would normally find.”</p>
<p lang="en-US">In general, there is nothing to say against this conclusion, it is the major disadvantage of using strings instead of concrete types. This is even more true for messaging systems: A change in a message&#8217;s data type on the server side can cause unexpected behaviours if the client side does not adapt those changes. Of course, this disadvantage does not play a big role in small systems which are easy to maintain. Within a small scope, communicating with string values is a fast and easy solution in distributed systems. But as soon as projects get larger and thereby get harder to maintain, stringly typed messaging systems will mess you up! The same happened to us with Nox Mortis, which is why we had to refactor the messaging system of our game. Anyhow, for the Admintool, we sticked with a loosely typed messaging system. The reason for that will be discussed in one of my next blog posts.  For now, I will describe what we did to get from a stringly typed to a strongly typed messaging system.</p>
<p lang="en-US">The first things needed for a strongly typed messaging system are data definitions which use the programming language&#8217;s type system. By doing so, we do not have to handle type errors ourselves: The programming language will detect those during compilation. There is a Design Pattern for that, called “Data Transfer Object (DTO)”. Those DTOs are instances of classes which represent data types. Those objects get filled with data on server side and get marshalled for a data transfer to the client. The client receives the data, and has to unmarshall it for further processing. To do so, it needs knowledge about the data structure, and if we want the message processing on the client side as strongly typed as on the server side, the data structure needs to be represented in the clients&#8217; programming language&#8217;s type system, too. This is an issue if you use different programming languages for client and server, as it is the case with our game. On the client side, we use Flash/ActionScript, while the server is written in Java. Thereby, our DTOs need to be defined as Java and as ActionScript classes. Fortunately, this is not a rare set up, so we are not the only one with this issue and there are already solutions to it!</p>
<p lang="en-US">After some research we found the GraniteDS framework, which helps you writing web applications using a Flash frontend and a Java backend. It does also contain a generator tool, which automatically creates ActionScript classes from your Java classes. If you are using GraniteDS as a “whole package”, there is nothing else to worry about: GraniteDS will also handle the marshalling and unmarshalling of your DTOs, using the AMF messaging protocol, which is widely known in the Flash-World. But we already had our own messaging protocol, and we do not want to change that (yet). Thereby we had to modify the generated ActionScript classes to be compatible with our own messaging protocol. GraniteDS allows that, too, using templates written in Groovy-Script.</p>
<p lang="en-US">Describing these changes to the templates, and the integration of the new messaging system into the production environment will be part of my next blog post.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1420&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F10%2Ffrom-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i%2F&amp;title=From%20a%20stringly%20typed%20to%20a%20strongly%20typed%20messaging%20system%20%28Part%20I%29" id="wpa2a_10">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/10/from-a-stringly-typed-to-a-strongly-typed-messaging-system-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tools for MMOG Administration</title>
		<link>http://blog.rough-sea.com/2010/09/tools-for-mmog-administration/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tools-for-mmog-administration</link>
		<comments>http://blog.rough-sea.com/2010/09/tools-for-mmog-administration/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 15:28:44 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[admintool]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1357</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F09%2Ftools-for-mmog-administration%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F09%2Ftools-for-mmog-administration%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Hey there,</p> <p>this time I tell you about the project the R&#38;D department worked on for the last months. We developed a tool that helps us and the Community Management department to administrate a Massive Multiplayer Online Game. We just call it Admintool. A tool that allows &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/09/tools-for-mmog-administration/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F09%2Ftools-for-mmog-administration%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F09%2Ftools-for-mmog-administration%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hey there,</p>
<p>this time I tell you about the project the R&amp;D department worked on for the last months. We developed a tool that helps us and the Community Management department to administrate a Massive Multiplayer Online Game. We just call it Admintool. A tool that allows us read/write access to the game database. This is required, because not everyone follows the rules of your game. There are abusive ingame messages, players with multi accounts or bots. The evil is everywhere out there. You may think: <em>But I have phpMyAdmin installed on the game server. This way I&#8217;m able to access every part of the game database.</em></p>
<p>Of course you can. But it&#8217;s not you who does the Community Management. It&#8217;s to easy to do harm to your database using direct database access especially for people without technical skills. A good Admintool let the users see what ther&#8217;re supposed to see and let them only do changes to things that does not have any impact on your game mechanics.</p>
<p>But this is not the only reason why an Admintool is a must have. Just imagine you want to ban a player from your game. It&#8217;s much easier to fill out a form with a reason and ban duration than manually do all the logic behind this. If changes are only possible through the Admintool it&#8217;s much easier to find abusive behaviour from the Admintool users too. You just have to log every change on the game database automatically.</p>
<p>Last but not least: Tracking. In a MMOG you should track nearly everything. You should track when a player register his account and which IP he used and you should track when a player spents money in your game. Of course you don&#8217;t require an Admintool to do the tracking. But you can use the Admintool to show the results of the tracking. Statistics and graphs that tell you how well your last marketing campaign worked or which is the most important feature in your game.</p>
<p>I hope I have convinced you to use an admintool for MMOG Administration. In the upcoming posts I will tell you about the features our Admintool has and how they are implemented. Next time I will show how our Admintool is able to manage dozens of game instances with only one Admintool.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1357&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F09%2Ftools-for-mmog-administration%2F&amp;title=Tools%20for%20MMOG%20Administration" id="wpa2a_12">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/09/tools-for-mmog-administration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Research &amp; Development? Whats that?</title>
		<link>http://blog.rough-sea.com/2010/08/research-development-whats-that/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=research-development-whats-that</link>
		<comments>http://blog.rough-sea.com/2010/08/research-development-whats-that/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 07:37:12 +0000</pubDate>
		<dc:creator>Philipp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[R & D]]></category>
		<category><![CDATA[Research & Development]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1387</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F08%2Fresearch-development-whats-that%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F08%2Fresearch-development-whats-that%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Hi! I’m Philipp, Lead Programmer of Rough Sea Games’ Research &#38; Development department. And when I mention this, I often hear things like “R&#38;D? Oh, you’re the Tools-Guy” … or … “Ah, so you do all the stuff nobody else likes to do”. Well, it seems to &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/08/research-development-whats-that/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F08%2Fresearch-development-whats-that%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F08%2Fresearch-development-whats-that%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } -->Hi! I’m  Philipp, Lead Programmer of Rough Sea Games’ Research &amp; Development  department. And when I mention this, I often hear things like “R&amp;D?  Oh, you’re the Tools-Guy” … or … “Ah, so you do all the stuff nobody  else likes to do”. Well, it seems to me as if there are some Clichés  attached to the job as an R&amp;D Programmer. And since “Myth-Busting”  is the latest cool thing nowadays, I’ll totally jump onto that train!  With this and the following blog posts I will try to show you what  R&amp;D is about “by example”. Maybe it will help you to decide if you  want to be an R&amp;D Programmer, or, if you should establish an R&amp;D  department in your company.</p>
<p lang="en-US">So, rumor has it that R&amp;D is just about Tools. And  indeed, the R&amp;D of Rough Sea Games is responsible for the Gui-,  Map-, and Asset-Editors, used by our Designers to create content for our  game. Furthermore, we have created an Admintool to administer our game  servers. Thomas will go into more detail about this in his blog posts.  Anyhow, it seems as if the Clichés are true…these are all tools.</p>
<p lang="en-US">Well, but that’s only half of the story, it is the  “Development” part of R&amp;D. In the Research part, we are  investigating into new render techniques, new frameworks, and as you  might know from previous posts, into new platforms. The goal is to find  new technologies that advance our workflows and products here at Rough  Sea Games. And yes, that implies working on the engine and game  framework.</p>
<p>But why do we need a whole department for that? Can’t we spread the  research-tasks to everyone in the company, so everyone does “some”  research. Well, of course we could. But most of the time, everyone else  is far too busy doing game development, and in our opinion, research  shouldn’t be done alongside other tasks. If you distribute the research  tasks among the project workers, the tasks are in competition of  priority with the project tasks. Usually, the research tasks will  “loose” against the project tasks, and thereby they won’t get the  recognition and resources they should have.</p>
<p lang="en-US">But of course, having an own R&amp;D department can be  expensive. If you can’t cover the costs through your project, you can’t  effort an R&amp;D. Right? – Wrong! It’s not an easy decision to make,  but you could try to gain some profit out of your R&amp;D if you develop  your tools  in a way that they can be used as middleware, which could  be licensed to other parties. We would like to try this with our  Admintool. So far we can&#8217;t share any experience there, it is still work  in progress. But we will let you know as soon as there is something to  write about.</p>
<p>As you can see, R&amp;D is most of the time about providing and   maintaining technology, be it  middleware or new engine technologies.   And in some companies, this is even  called the “Technology   Group/Department”. If you like this term better,  it’s fine with me. The   important thing is that, in my opinion, a  company will profit a lot   from a group like that, to be well prepared  for future things to come.</p>
<p>“Yeah yaeh, yabber yabber, technology,  middleware….is this even Game  Development anymore?” you might ask. I guess this question has the same  taste as the beforementioned “Ah, so you do all the stuff nobody else  likes to do”. But before I start writing about “what is Game  development” or start a discussion about likes and dislikes, I will show  you some examples of what we do here in R&amp;D in my next blog posts,  and you can judge for yourself.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1387&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F08%2Fresearch-development-whats-that%2F&amp;title=Research%20%26%23038%3B%20Development%3F%20Whats%20that%3F" id="wpa2a_14">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/08/research-development-whats-that/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Singletons for AS3</title>
		<link>http://blog.rough-sea.com/2010/06/singletons-for-as3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=singletons-for-as3</link>
		<comments>http://blog.rough-sea.com/2010/06/singletons-for-as3/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 09:15:17 +0000</pubDate>
		<dc:creator>Manuel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coder]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wiener würschtel]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1207</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Fsingletons-for-as3%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Fsingletons-for-as3%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p><a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singletons</a> the curse and blessing of many coding projects. <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Among other pitfalls, you&#8217;ll basically introduce a global variable in your system, making <a href="http://blog.rough-sea.com/2009/01/asserting-the-basics-iii-–-unit-testing/">UnitTests</a> much harder.</p> <p>Why Singletons?</p> <p>Despite the possible problems they can present, they are just so darn handy &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/06/singletons-for-as3/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Fsingletons-for-as3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Fsingletons-for-as3%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://en.wikipedia.org/wiki/Singleton_pattern">Singletons</a> the curse and blessing of many coding projects. <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Among other pitfalls, you&#8217;ll basically introduce a global variable in your system, making <a href="http://blog.rough-sea.com/2009/01/asserting-the-basics-iii-–-unit-testing/">UnitTests</a> much harder.</p>
<p><strong>Why Singletons?</strong></p>
<p>Despite the possible problems they can present, they are just so darn handy sometimes. If there is some part of your code that needs to be accessed from almost anywhere in the system (like the sound system, or a global error text console and such) there is hardly a better way to achieve that.</p>
<p><strong>Alternatives?</strong><br />
A global messages system to communicate between objects can achieve the same effect. We used to make heavy use of such a system system. However, according to our experience, maintaining that system is fairly time consuming for it gets more and more complicated over time. Besides, if a messaging system allows <a href="http://en.wikipedia.org/wiki/Queue_(data_structure)">queing</a>, you&#8217;ll never really now where and why a message was sent because you loose the <a href="http://en.wikipedia.org/wiki/Stack_trace">stacktrace</a>. So, right know we are reducing the work-load done by the message system, handing it over to direct singletons access. By this, we increased debugability and clearity of data transfer. Besides, using singleton access is much faster than routing it through our messaging system.</p>
<p><strong>How to Do It?</strong><br />
The web already offers a bunch of solutions (1). Most of them boil down to implement the singleton code over and over again in each singleton. We didn&#8217;t like that and tried to come up with a better solution. When we define a singleton it looks like that:</p>
<p><code style="font-size: 1.1em; color: #ff9922; background-color: #111111;"> </code></p>
<p><pre><code style="font-size: 1.1em; color: #ff9922; background-color: #111111;">
&lt;pre&gt;&lt;span style=&quot;color: #008000;&quot;&gt;/**
* Accesing this class somewhere in the code looks like this:
* cSomeController.GetInstance().DoSomething();
*/&lt;/span&gt;

&lt;strong&gt;public &lt;/strong&gt;class cSomeController extends cSingleton
{
&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;public &lt;/strong&gt;&lt;strong&gt;static &lt;/strong&gt;function GetInstance():cSomeController
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return cSingleton.GetInstance(cSomeController);
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;public &lt;/strong&gt;function DoSomething()
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trace(&quot;Yes, I can.&quot;)
&nbsp;&nbsp;&nbsp;&nbsp;}
}&lt;/pre&gt;
</code></pre></p>
<p>That is much simpler than copying&amp;pasting the complete singleton code over and over. The corresponsing cSingleton-class looks like that:</p>
<p><code style="font-size: 1.1em; color: #ff9922; background-color: #111111;"> </code></p>
<p><pre><code style="font-size: 1.1em; color: #ff9922; background-color: #111111;">
&lt;pre&gt;&lt;strong&gt;package &lt;/strong&gt;rsengine.patterns
{
&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;import &lt;/strong&gt;flash.utils.Dictionary;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;color: #008000;&quot;&gt;&nbsp;&nbsp;&nbsp;&nbsp;/**
&nbsp;&nbsp;&nbsp;&nbsp;* Singleton base class
&nbsp;&nbsp;&nbsp;&nbsp;*/
&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;public &lt;/strong&gt;class cSingleton
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;private &lt;/strong&gt;&lt;strong&gt;static &lt;/strong&gt;var m_instances:Dictionary = new Dictionary();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;private &lt;/strong&gt;&lt;strong&gt;static &lt;/strong&gt;var m_unlockConstructor:Boolean = false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;public &lt;/strong&gt;function cSingleton()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_unlockConstructor == false)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw Error(&quot;You cannot create an instance of a singleton.&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ &quot;Use GetInstance instead!&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

&lt;span style=&quot;color: #008000;&quot;&gt;&nbsp;&nbsp;&nbsp;&nbsp;/**
&nbsp;&nbsp;&nbsp;&nbsp;* Returns an instance of the specified class
&nbsp;&nbsp;&nbsp;&nbsp;* @param _class class
&nbsp;&nbsp;&nbsp;&nbsp;* @return instance of specified class
&nbsp;&nbsp;&nbsp;&nbsp;*/
&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;strong&gt;public &lt;/strong&gt;&lt;strong&gt;static &lt;/strong&gt;function GetInstance(_class:Class) : *
&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m_instances[_class] == null)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_unlockConstructor = true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_instances[_class] = new _class();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_unlockConstructor = false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return m_instances[_class] ;
&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;}
}&lt;/pre&gt;
</code></pre></p>
<p>Our singleton implementation significantly reduced the amount of code you have to copy&amp;paste compared to the other singleton implementations out there on the net. We do know that our implementation of GetInstance() is a little slower (because of the Dictionary look up). Since you shouldn&#8217;t have too many calls to the GetInstance method this is probably nothing to worry about too much. Nevertheless, you could cache the result of GetInstance() if you do need to access the singleton more than once (e.g. in a loop).</p>
<p>Have fun and happy coding<br />
Manuel</p>
<p><a name="Footnote_1"></a> <a href="http://www.gskinner.com/blog/archives/2006/07/as3_singletons.html">AS3: Singletons</a>, <a href="http://www.darronschall.com/weblog/2007/11/actionscript-3-singleton-redux.cfm">ActionScript 3 Singleton Redux</a>, <a href="http://www.google.com/search?q=as3+singletons">google</a></p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1207&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Fsingletons-for-as3%2F&amp;title=Singletons%20for%20AS3" id="wpa2a_16">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/06/singletons-for-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>InnoDB the &#8220;case-sensitive monster&#8221;</title>
		<link>http://blog.rough-sea.com/2010/06/innodb-the-case-sensitive-monster/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=innodb-the-case-sensitive-monster</link>
		<comments>http://blog.rough-sea.com/2010/06/innodb-the-case-sensitive-monster/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 11:51:35 +0000</pubDate>
		<dc:creator>Ole</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[InnoDB]]></category>
		<category><![CDATA[lower case]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[upper case]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1191</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Finnodb-the-case-sensitive-monster%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Finnodb-the-case-sensitive-monster%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Hello,</p> <p>this posting is about InnoDB&#8217;s limitation of lower / upper cases and the resulting problems of InnoDB database migrations to different operating systems.</p> <p>THE TASK:</p> <p>Import an InnoDB database from Mac OS  MySQL  5.x to Linux MySQL 5.x (in our case Rhel 5 ).</p> <p>No big deal, I &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/06/innodb-the-case-sensitive-monster/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Finnodb-the-case-sensitive-monster%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Finnodb-the-case-sensitive-monster%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Hello,</strong></p>
<p>this posting is about InnoDB&#8217;s limitation of lower / upper cases and the resulting problems of<br />
InnoDB database migrations to different operating systems.</p>
<p><strong>THE TASK:</strong></p>
<p>Import an InnoDB database from Mac OS  MySQL  5.x to Linux MySQL 5.x (in our case Rhel 5 ).</p>
<p>No big deal, I thought.</p>
<p>Made a mysql dump and imported the dump to Linux.   5 minutes work, just the way  admins love it ! <img src='http://blog.rough-sea.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><strong>THE CHALLENGE:</strong></p>
<p>Imported the dump. I am done! That&#8217;s what I thought. Just let&#8217;s check the app that accesses the freshly imported DB.</p>
<p>Running the app brought me exceptions.  Some tables couldn&#8217;t be found&#8230; URGH! Checked the tables&#8230; everything was fine. The dump was fine&#8230; the tables were present. WTF!!!!!</p>
<p><strong>THE SOLUTION:</strong></p>
<p>After 10 hours of pain, we found the solution.</p>
<p>MySQL and especially the storage engine InnoDB depends on the case sensitivity of the operating system. Windows and Mac OS (by default) are not case-sensitive.  So if you are importing a Mac or Win DB-dump to a case-sensitive operating system (like Linux), the DB will be handled case sensitively, although the dump is not a case-sensitive one. I think this problem should be fixed.  I know fixing this problem is nearly impossible because the OS has to be capable of doing this. But giving some sort of warning while importing a non-case-sensitive DB to a case-sensitive DB-Server&#8230; that can&#8217;t be so difficult !</p>
<p>How to fix our specific problem:</p>
<p>Add the following line to your MySQL Server Config:</p>
<p><em><code>lower_case_table_names=1</code></em></p>
<p>By default Windows MySQL uses <em><code>&lt;em&gt;lower_case_table_names=0 a&lt;/em&gt;nd MacOS MySQL </code></em><em><em><code>lower_case_table_names=2</code></em></em></p>
<p><em> </em>The <a title="MySQL documentaion" href="http://dev.mysql.com/doc/refman/5.1/de/name-case-sensitivity.html">MySQL documentation</a> advises setting<code> &lt;em&gt;lower_case_table_names=1&lt;/em&gt; for InnoDB. For more information, please read the &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/de/name-case-sensitivity.html&quot;&gt;MySQL documentation.&lt;/a&gt;</code></p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1191&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F06%2Finnodb-the-case-sensitive-monster%2F&amp;title=InnoDB%20the%20%26%238220%3Bcase-sensitive%20monster%26%238221%3B" id="wpa2a_18">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/06/innodb-the-case-sensitive-monster/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Numeric Enumerations (Enums) for AS3</title>
		<link>http://blog.rough-sea.com/2010/04/numeric-enumerations-enums-for-as3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=numeric-enumerations-enums-for-as3</link>
		<comments>http://blog.rough-sea.com/2010/04/numeric-enumerations-enums-for-as3/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 09:11:51 +0000</pubDate>
		<dc:creator>Manuel</dc:creator>
				<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[wiener würschtel]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1149</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F04%2Fnumeric-enumerations-enums-for-as3%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F04%2Fnumeric-enumerations-enums-for-as3%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Something I really missed in Actionscript 3 were <a title="Wiki - Enumeration" href="http://en.wikipedia.org/wiki/Enumeration" target="_blank">enums</a>. If you need ascending unique numeric ids ( e.g. for naming array indexes ), enums are your friend.</p> <p>For our current project we programmed a messaging system. The system uses unique numeric ids &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2010/04/numeric-enumerations-enums-for-as3/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F04%2Fnumeric-enumerations-enums-for-as3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F04%2Fnumeric-enumerations-enums-for-as3%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Something I really missed in Actionscript 3 were <a title="Wiki - Enumeration" href="http://en.wikipedia.org/wiki/Enumeration" target="_blank">enums</a>. If you need ascending unique numeric ids ( e.g. for naming array indexes ), enums are your friend.</p>
<p>For our current project we programmed a messaging system. The system uses unique numeric ids for message types and message channels. The list of messages and channels grew over time and right now each list contains more than a hundred entries. In the beginning we did the numbering ourselves like that:</p>
<p><code> </code></p>
<p><pre><code>
&lt;pre&gt;&lt;span style=&quot;color: #f07700;&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_OPEN_WINDOW:int = 0;
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_CLOSE_WINDOW:int = 1;
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_REGISTER_TIMER:int = 2;
&nbsp;&nbsp;&nbsp;&nbsp;// .. and so on
&lt;/span&gt;&lt;/pre&gt;
</code></pre></p>
<p>For code beauty we were always trying to group related message ids, which often meant to re-index dozens of entries if we inserted an id somewhere in between. This was a pain!</p>
<p>The net already has assembled quiet some wisdom about &#8220;fake enums ins as3&#8243;<a title="Footnote 1" name="1" href="#Footnote_1">¹</a>, which do fit different needs (like some have type safety) but unfortunately not ours. Most of them are String based, which is what we did not want. So after putting in some thought we came up with a solution that worked for us. Now we can define our enums like this:</p>
<p><code> </code></p>
<p><pre><code>
&lt;pre&gt;&lt;span style=&quot;color: #f07700;&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_OPEN_WINDOW:int = cEnum.Enum(0);
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_CLOSE_WINDOW:int = cEnum.inc;
&nbsp;&nbsp;&nbsp;&nbsp;public static const MSG_REGISTER_TIMER:int = cEnum.inc;
&nbsp;&nbsp;&nbsp;&nbsp;// .. and so on
&lt;/span&gt;&lt;/pre&gt;
</code></pre></p>
<p>Now, by using static methods and a static counter we can create an arbitrary amount of coherent numeric values, which comes in very handy from time to time! Re-indexing is in the past now!</p>
<p>We want to share our little enum class with the web, so here it comes:</p>
<p><code> </code></p>
<p><pre><code>
&lt;pre&gt;&lt;span style=&quot;color: #f07700;&quot;&gt;
&lt;strong&gt;public class&lt;/strong&gt; cEnum
{
&nbsp;&nbsp;&lt;strong&gt;private static var&lt;/strong&gt; m_currentIncrement:int = 0;
&lt;span style=&quot;color: #009900;&quot;&gt;
&nbsp;&nbsp;/**
&nbsp;&nbsp; * Adds an enum value to the collection
&nbsp;&nbsp; */
&lt;/span&gt;
&nbsp;&nbsp;&lt;strong&gt;public static function &lt;/strong&gt;Enum(_v:int) : int
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;m_currentIncrement = _v;
&nbsp;&nbsp;&nbsp;&nbsp;return m_currentIncrement;
&nbsp;&nbsp;}
&lt;span style=&quot;color: #009900;&quot;&gt;
&nbsp;&nbsp;/**
&nbsp;&nbsp; * returns the next increment
&nbsp;&nbsp; */
&lt;/span&gt;
&nbsp;&nbsp;&lt;strong&gt;public static function get &lt;/strong&gt;inc():int
&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&nbsp;return ++m_currentIncrement;
&nbsp;&nbsp;}
}
&lt;/span&gt;&lt;/pre&gt;
</code></pre></p>
<p>Bottom line, if you need a neat way to maintain a list of static coherent numeric entries while type safety is not a big issue &#8230; this is an fairly easy way to do it. May this help you out there as much as it helped us.</p>
<p>Have fun and happy coding<br />
Manuel</p>
<p><a title="Back" name="Footnote_1" href="#1">¹</a> Further readings on AS3 enums can be found here: e.g. <a href="http://www.herrodius.com/blog/87">http://www.herrodius.com/blog/87</a>,<br />
<a href="http://scottbilas.com/blog/faking-enums-in-as3/">http://scottbilas.com/blog/faking-enums-in-as3/</a><br />
or  <a href="http://blog.petermolgaard.com/2008/11/02/actionscript-3-enums/">http://blog.petermolgaard.com/2008/11/02/actionscript-3-enums/</a></p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1149&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2010%2F04%2Fnumeric-enumerations-enums-for-as3%2F&amp;title=Numeric%20Enumerations%20%28Enums%29%20for%20AS3" id="wpa2a_20">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2010/04/numeric-enumerations-enums-for-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Effortless Text Localization</title>
		<link>http://blog.rough-sea.com/2009/09/effortless-text-localization/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=effortless-text-localization</link>
		<comments>http://blog.rough-sea.com/2009/09/effortless-text-localization/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 14:32:24 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[automatization]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[continous integration]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPhone SDK]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=1105</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F09%2Feffortless-text-localization%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F09%2Feffortless-text-localization%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Automatization of repeated work is one of the keys to productive development. Another is abstraction of common problems to allow concentration on project specific work. Localization is one of the problems you have in nearly every project, especially in iPhone projects. The iPhone SDK brings interesting solutions &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2009/09/effortless-text-localization/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F09%2Feffortless-text-localization%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F09%2Feffortless-text-localization%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Automatization of repeated work is one of the keys to productive development. Another is abstraction of common problems to allow concentration on project specific work. Localization is one of the problems you have in nearly every project, especially in iPhone projects. The iPhone SDK brings interesting solutions that abstract many parts of the localization process.</p>
<p>The tool <strong>ibtool</strong>, for example, extracts strings from an interface automatically. The strings are placed in a .strings file, a textfile with key/value pairs. To localize an interface, you have to translate .strings and merge the strings back into the interface again. Because you have individual interfaces for every localization, it&#8217;s possible to adjust widgets individually for each one.</p>
<p><strong>genstrings</strong> is another tool inside the iPhone SDK. It extracts textIDs from the source code and write them into a .strings file. You may ask how  the tool knows which texts need localization and which do not. The solution is the macro NSLocalizedString, which will be replaced by a .strings file lookup method by the preprocessor, but also searched for by the genstrings tool to create the files.</p>
<p>Both tools help you to create a localized application without paying much attention to localization itself. But you cannot expect the localization department to search for .strings files inside your project and create localized versions of them. Of course this would be possible, but not very convenient, because you have to migrate the translated texts back into the interfaces using ibtool. Another reason for us at Rough Sea is that we use a localization interface from our publisher. This interface is well known to the localization department and the content is placed in a centralized database on a server.</p>
<p>So we have the great tools from Apple that help us to separate texts from the project and we have the great tool from our publisher that handles the whole translation and reviewing process. Now we need something to tie those tools together, because we do not want to insert new texts from the .strings file into the publisher&#8217;s localization tool manually or vice versa. This glue tool has to execute the Apple tools, extract the texts from the .strings files and insert them into the publisher&#8217;s loca tool. On the other hand, it has to check for new localized texts from the publisher&#8217;s loca tool, build the required .strings files from the results and merge them back into the interfaces. Sounds quite easy, but of course there are some obstacles to get there. You have to handle other things, like the deletion of a text entry or changes to an already translated interface. So you have to know what has changed since the last update and stuff like that.</p>
<p>It turns out that you only have to integrate this glue tool into the build process of your build server. The tool will update the localization database whenever the code or the interface changes and it will update the localized versions when the database changes. As a coder you only need to remember to use the text macro around your text id. You don&#8217;t have to add this text id in a file or anything else. As you commit your changes, the build server will do this for you. As an interface designer it&#8217;s the same: just create your interfaces in the primary language and commit it. After the localization department finishes localizing those texts, they will be inserted into the localized versions automatically. Of course you have to make adjustments to the interface if there are loca bugs like labels that are to small to hold the translated text.</p>
<p>As you can see those localization tools are a big black box for coders, interface designers and translators. The coders only have to write code, the interface designers design interfaces and the translators translate texts. At the end there will be a localized product.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=1105&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F09%2Feffortless-text-localization%2F&amp;title=Effortless%20Text%20Localization" id="wpa2a_22">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2009/09/effortless-text-localization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Map Generation</title>
		<link>http://blog.rough-sea.com/2009/08/random-map-generation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=random-map-generation</link>
		<comments>http://blog.rough-sea.com/2009/08/random-map-generation/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 14:47:09 +0000</pubDate>
		<dc:creator>Manuel</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[continents]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[making of]]></category>
		<category><![CDATA[map generator]]></category>
		<category><![CDATA[perlin noise]]></category>
		<category><![CDATA[random generated content]]></category>
		<category><![CDATA[terrain]]></category>
		<category><![CDATA[wiener würschtel]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=946</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frandom-map-generation%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frandom-map-generation%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Designing an appealing and huge game world from scratch will take even really fast designers a looooong time: valuable time that can be spent in better ways. This is where generated content comes in handy. With the push of a button a designer can create a whole &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2009/08/random-map-generation/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frandom-map-generation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frandom-map-generation%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Designing an appealing and huge game world from scratch will take even really fast designers a looooong time: valuable time that can be spent in better ways. This is where generated content comes in handy. With the push of a button a designer can create a whole world (oceans, land, forests, deserts, mountains, cities, &#8230; ) in an instant. So this is what we decided to do for our game &#8230; and here is how we got to the finish line:</p>
<p>On the bumpy road to an actual working map generator we decided to split all map generation tasks into small modules: heightmap generator, water generator, forest generator, desert generator, and so on. In the map-generator GUI the designer can put these modules into a task list and define the order in which they are executed.  Each module also has parameters that affect the characteristics of the generated map. Even though it is supposed to be a random map generator it is especially important to have deterministic behavior. Consequently, each module that actually generates content has at least a &#8220;seed&#8221; parameter for the random number generator. With the same seed the generator will create the same results every time. Changing the seeds will create a different map.</p>
<p><img class="alignnone size-full wp-image-952" title="map generation" src="http://blog.rough-sea.com/wp-content/uploads/2009/07/map_gen1.gif" alt="map generation steps" width="249" height="149" /><br />
In the little animation above you can see the output of some of the modules.</p>
<p><strong>Heightmap Generator</strong><br />
At first we create a heightmap. We use Perlin noise since it is built into the AS3 BitmapData class and it is amazingly fast. In the beginning we experimented with our own implementation of the diamond-square algorithm, but it was way too slow.</p>
<p><strong>Water Fill</strong><br />
In the next step we apply water to the world. We simply declare everything below a certain height level as being under water.</p>
<p><strong>Mountains</strong><br />
By looking for local peaks we detect mountains and flag the areas accordingly.</p>
<p><strong>Humidity Map</strong><br />
By defining a water contingent that grows over water and decreases over land we can flag dry and wet zones on the continents. To make things easier we define our whole world as a west-wind zone. The centers of most bigger continents will be dry (yellow), coast regions will be mostly humid (green) and continental areas lying east of a big stretch of water will be very humid (dark green).</p>
<p><strong>Climate Zones</strong><br />
Next we define climate zones in the world: tropical areas, temperate zones and polar regions. With this information we can easily place polar caps in the world.</p>
<p><strong>Forest Generator</strong><br />
Using the information from the climate zones and the humidity map makes it possible to place different types of forests into the world. Jungle (purple) will be found in the hot and wet regions around the equator, while coniferous forests will be found close to the polar caps.</p>
<p><strong>Desert Generator</strong><br />
The desert generator also uses the information from the humidity map to detect dry regions and place desert areas into them.</p>
<p>Well, now you had a look at some of the modules in our map generator. They are not only capable of creating earth-like maps (like the small sample map above) but also completely different maps by changing the parameters: a lake landscape, a waste land, a desert or whatever our games may need. With this we are able to quickly create new game content of any size for the players to explore.</p>
<p>Cheers,<br />
Manuel</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=946&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frandom-map-generation%2F&amp;title=Random%20Map%20Generation" id="wpa2a_24">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2009/08/random-map-generation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>R&amp;D goes iPhone</title>
		<link>http://blog.rough-sea.com/2009/08/rd-iphone/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rd-iphone</link>
		<comments>http://blog.rough-sea.com/2009/08/rd-iphone/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 07:56:41 +0000</pubDate>
		<dc:creator>Thomas</dc:creator>
				<category><![CDATA[Company]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[coder]]></category>
		<category><![CDATA[introductions]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[R&D]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=963</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frd-iphone%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frd-iphone%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Hello out there,</p> <p>my name is Thomas and I am the first programmer in our new R&#38;D department. Like most of the other guys here at Rough Sea, I&#8217;ve worked on games for consoles (Nintendo DS and Wii) and PC before. I&#8217;m very excited to develop sophisticated &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2009/08/rd-iphone/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frd-iphone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frd-iphone%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello out there,</p>
<p>my name is Thomas and I am the first programmer in our new R&amp;D department. Like most of the other guys here at Rough Sea, I&#8217;ve worked on games for consoles (Nintendo DS and Wii) and PC before. I&#8217;m very excited to develop sophisticated software that helps us to make state-of-the-art games. Of course this is only technically, but I&#8217;m pretty sure that Rafael and Jan will assure this for the design part too.</p>
<p>I assume you&#8217;ve read the headline already, so you know what the R&amp;D department will work on in the coming months. We&#8217;ve decided to do some research on the iPhone, because we think the way you use the iPhone is almost the same as how you play a browsergame. You get your iPhone out of your pocket, use it for a few seconds and put it back again. You have nearly the same procedure with browsergames: you open your browsergame window/tab, change a few settings and go back to work.</p>
<p>So the first thing to do is getting your working environment running. The only legal way to do this is to buy a Mac. I&#8217;m not really happy about that, because I&#8217;m a Windows guy and there are some differences in using MacOS instead of Windows. Maybe Apple only invented the app store to sell some of their Macs to iPhone developers. Nevertheless after some adjustments the Mac became usable. The nextStep (pun indended) was the installation of the iPhone SDK and all the tools that belong to it. It&#8217;s quite easy to get from the installation of the SDK to the first Hello World on the simulator (especially if you compare this to console development).</p>
<p>We at Rough Sea use test driven development and continuous integration to assure that we always have  a deliverable product at hand. Unit Tests are already integrated into the SDK and it was easy for Ole to set up a build server on a Mac Mini with hudson and the makefile-like shell tool xcodebuild. You don&#8217;t have a makefile: the tool just uses the settings of the project file to know how to build. Another thing is that you can add and change text macros for the XCode IDE. Text Macros are very useful to write code much faster. For example, you can add an alloc-init call <strong>[[class alloc] init]</strong> simply by typing the letter a and then escape. There are macros for <strong>if</strong>, <strong>for</strong> and <strong>while</strong> too. Because we have different coding guidelines than the apple guys, I had to change some of the macros. You find them in <em>/Developer/Applications/Xcode.app/Contents/ PlugIns/TextMacros.xctxtmacro/Contents/ Resources</em>. Copy the <em>TextMacros.xctxtmacro</em> folder to <em>Library/Application Support/Developer/Shared/Xcode/Specifications</em> in your home directory. Just open the *.xctxtmacro files with a text editor to change the macros. You can add your own file and project templates too. This is very nice, because you can set up a default project with many settings, like Unit Test Targets, already in place, and use this project to create new ones with only one click. To add a new project template, create the project the way you like it and copy the whole project folder to <em>Library/Application Support/Developer/Shared/XCode/Project Templates/GROUP_NAME/PROJECT_NAME</em>. For file templates you should just copy the File Templates folder from <em>/Developer/Library/Xcode/</em> to <em>Library/Application Support/Developer/Shared/XCode/</em> and change or add the files you like.</p>
<p>Next time I will write about Objective-C and libraries from the iPhone SDK like UIKit.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=963&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F08%2Frd-iphone%2F&amp;title=R%26%23038%3BD%20goes%20iPhone" id="wpa2a_26">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2009/08/rd-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure your Webserver (part 2- A)</title>
		<link>http://blog.rough-sea.com/2009/07/secure-your-webserver-part-2-a/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=secure-your-webserver-part-2-a</link>
		<comments>http://blog.rough-sea.com/2009/07/secure-your-webserver-part-2-a/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 08:12:59 +0000</pubDate>
		<dc:creator>Ole</dc:creator>
				<category><![CDATA[Server Administration]]></category>
		<category><![CDATA[Web security]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[Userrights]]></category>
		<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=512</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F07%2Fsecure-your-webserver-part-2-a%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F07%2Fsecure-your-webserver-part-2-a%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Hello everybody,</p> <p>Finally you are able to read Part 2 of &#8220;Secure your Webserver&#8221;. Part 2 will be about Linux, Webserver and the other important services.</p> <p>As I mentioned in Part 1, I will not write about Windows, MacOS or  other operating systems, because the most common &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2009/07/secure-your-webserver-part-2-a/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F07%2Fsecure-your-webserver-part-2-a%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F07%2Fsecure-your-webserver-part-2-a%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello everybody,</p>
<p>Finally you are able to read Part 2 of &#8220;Secure your Webserver&#8221;. Part 2 will be about Linux, Webserver and the other important services.</p>
<p>As I mentioned in Part 1, I will not write about Windows, MacOS or  other operating systems, because the most common one for a webserver  is Unix / Linux. Part 2 will have a part A and B. Today I am going to write about distributions,  user managament, user rights, secure shell and their enormous importance for security.</p>
<p>Before you start, choose the right distribution of Linux for your aims.  There are a lot of Linux versions (distributions) on the market. Most of them are free or have a free community edition. The most common free distributions are CentOS, Debian, Fedora, Gentoo, OpenSuse, Mandriva and Ubuntu. Of course there are also commercial destributions like Red Hat Linux Enterprises (RHEL) or Suse Linux Enterprises.</p>
<p>In general all these distributions are fine for a webserver. Their differences are minor and more a personal choice than a real technical question. A NEWBIE should maybe use OpenSUSE, Ubuntu or Fedora, as the support of the community seems to be bigger for them. Commercial products are usually superior to free distributions in their support system. They grant better support via phone, etc.</p>
<p>After you have chosen the right distrubtion for your purpose and installed it on your server machine, it is time to think about security.</p>
<p>1. User-Management and Shell-Access. (Secure Shell Daemon)</p>
<p>Linux security is mostly based on user rights. User rights are essential to the security concept of Unix and Linux systems. Usually all distributions are very strict and separate services (daemons), users, administrators, essential services like a webserver, MTA &amp; MDA (Mail Transfer Agent &amp; Mail Delivery Agent) into different groups and users.</p>
<p>All these groups and users have different write and read accesses. Usually groups are created to give a bunch of users the same rights. Therefore groups can make your administrator&#8217;s life far easier.</p>
<p>The most important &#8220;user&#8221; is called root. Root is the highest ranked user on a system. The &#8220;root user&#8221; has full read and write access. In the Windows world it would be the &#8220;Administrator&#8221;.  This is the reason why it is not smart to use the root user in your everyday work. The root user should only be used for system critical and important parts. In all other cases it is wise to use a &#8220;normal&#8221; user, which you have created.<br />
It is also possible to run root commands via your user account. Important commands for this purpose are &#8220;sudo&#8221; and &#8220;su&#8221;. Sudo runs a command line with a special user. The command su makes it possible to log in as another user via your own user shell. Of course you need the right password of the user to perform these actions.</p>
<p><a rel="attachment wp-att-926" href="http://blog.rough-sea.com/2009/07/secure-your-webserver-part-2-a/x11_ssh_tunnelling/"><img class="alignleft size-thumbnail wp-image-926" title="X11_ssh_tunnelling" src="http://blog.rough-sea.com/wp-content/uploads/2009/07/X11_ssh_tunnelling-150x150.png" alt="X11_ssh_tunnelling" width="275" height="275" /></a>It is common for Linux to allow remote login via secure shell (SSH), especially if your webserver is not reachable for you in person, e.g. a dedicated server in a data centre of your webhost. All connections via SSH are encrypted.  It is nearly impossible to decrypt the data via your client and your server (Maybe the NSA or the CIA are able to decrypt this &#8211; who knows?). You should take care to choose the ssh version 2 protocol. This is safer, as recently some weaknesses were discovered in protocoll version 1. A common SSH-client for Windows is <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">&#8220;Putty&#8221;</a>.</p>
<p>It is possible to permit or forbid login via SSH for specific users or user groups. Maybe it is not wise to allow direct root login via SSH. It is also possible to login via a certificate. You create an public and private key. Upload the public part to your server (usually: /homedir/.ssh/authorized) and log in without password. Of course it is wiser to secure your private key with a passphrase. In this case you need to type the phassphrase to decrypt the private key to log in.</p>
<p>Next part will be about firewalls, virusscanners and how to avoid spam problems.</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=512&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F07%2Fsecure-your-webserver-part-2-a%2F&amp;title=Secure%20your%20Webserver%20%28part%202-%20A%29" id="wpa2a_28">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2009/07/secure-your-webserver-part-2-a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Feel the groove</title>
		<link>http://blog.rough-sea.com/2009/06/feel-the-groove/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=feel-the-groove</link>
		<comments>http://blog.rough-sea.com/2009/06/feel-the-groove/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 12:10:20 +0000</pubDate>
		<dc:creator>Joerg</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.rough-sea.com/?p=876</guid>
		<description><![CDATA[<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F06%2Ffeel-the-groove%2F"> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F06%2Ffeel-the-groove%2F&#38;style=compact&#38;b=2" height="61" width="50" /> </a> <p>Our server code can be built with one click. The build process does not take long. To be precise, the build server says &#8220;last build: 1 minute 38 seconds&#8221;.  That&#8217;s cool. (And mainly it&#8217;s because the code is not that complex yet&#8230;)</p> <p>But despite fast builds and &#8230; </p><p><a class="more-link block-button" href="http://blog.rough-sea.com/2009/06/feel-the-groove/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F06%2Ffeel-the-groove%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F06%2Ffeel-the-groove%2F&amp;style=compact&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Our server code can be built with one click. The build process does not take long. To be precise, the build server says &#8220;last build: 1 minute 38 seconds&#8221;.  That&#8217;s cool. (And mainly it&#8217;s because the code is not that complex yet&#8230;)</p>
<p>But despite fast builds and because they are definitely going to get slower as the project progresses, we need the ability to change certain parts of the game logic with a minimum of work. So far this is mainly for the game designers, who want to be able to change some equations that influence the game&#8217;s balance. Defining stuff in config files that are read on server startup is nice, and we use this as well, but starting the server takes time, too. A better way is to be able to change game logic at run time.  So a scripting language was the way to go.</p>
<p>We decided to use <a href="http://en.wikipedia.org/wiki/Groovy_(programming_language)">groovy</a>. Now groovy is not a scripting language at all, but more or less an object-oriented programming language that can be used as a scripting language for Java. Groovy has some advantages over Java like e.g. dynamic typing.</p>
<p>Unlike in other scripting languages, the groovy code is not interpreted at runtime but compiled into java byte code. So don&#8217;t forget to automatically reload the scripting files every now and then to make sure that changes in the files are actually applied.</p>
<p>We haven&#8217;t yet decided whether to keep the scripting in the release version of the game or not, since implementing the logic in the code is surely better for the performance. People on the Internet tend to accuse groovy of weak performance in comparison to other scripting languages.  But it is very pleasant for experimenting during development. If you don&#8217;t believe me, go ask our designers&#8230;</p>
<img src="http://blog.rough-sea.com/?ak_action=api_record_view&id=876&type=feed" alt="" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.rough-sea.com%2F2009%2F06%2Ffeel-the-groove%2F&amp;title=Feel%20the%20groove" id="wpa2a_30">Share/Bookmark</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.rough-sea.com/2009/06/feel-the-groove/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

