<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Matt Tuttle</title>
    <description>Matt Tuttle is an indie game developer with 20 years of software engineering behind him. He made Echoes of the Unread for the NES and builds games in Godot.</description>
    <link>https://matttuttle.com/</link>
    <atom:link href="https://matttuttle.com/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Fri, 23 Oct 2026 03:02:29 GMT</pubDate>
    <lastBuildDate>Fri, 23 Oct 2026 03:02:29 GMT</lastBuildDate>
    <generator>Metalsmith</generator>
    
    <item>
        <title>I Spent Ten Years Waiting for Godot</title>
        <description><![CDATA[<p>If you&#39;ve been here before, you probably know me from Haxe and <a href="/2011/02/porting-flashpunk-to-haxe/">HaxePunk</a>. Everything on this blog stops in 2016, and now I&#39;m making games in Godot. It wasn&#39;t a straight switch, though. I technically went from Haxe to nothing. I tried Love2D, Bevy, and raylib, spent a few years writing an NES game in C, and poked at Godot on and off for years before it finally clicked in late 2024.</p>
<h2 id="why-haxe">Why Haxe</h2>
<p>First off, why Haxe and not AS3? It&#39;s strongly typed, it builds fast, and it works on a bunch of targets and platforms. I loved the type inference. You didn&#39;t have to write out the type, but it was strongly typed underneath. I liked the pattern matching, and enums that weren&#39;t just integers. Eventually I understood Haxe at a pretty fundamental level, and I even made a few contributions to the standard library.</p>
<p>So why leave?</p>
<h2 id="running-an-open-source-project">Running an open source project</h2>
<p>Running an open source community takes a toll on you. We weren&#39;t even that big of a community, but there were people who felt that I owed them something, even though the thing I was making was free. I can&#39;t imagine the weight of something as popular as Godot or Blender, although they have good teams behind them. HaxePunk did too: two amazing contributors and several others who kept the project moving forward.</p>
<p>The bigger problem was a choice I made early. I built the port on top of NME, which later became OpenFL, and that dependency ended up costing me. I found myself putting out fires more than adding features. Breaking changes showed up in minor releases, which wouldn&#39;t have been that terrible if Haxe had a better package manager. But haxelib didn&#39;t have version locking like npm and lix didn&#39;t exist yet. New users would download HaxePunk for the first time and ask why it didn&#39;t work, and the answer was that something had broken underneath us. OpenFL wasn&#39;t a bad project. It was focused on its own goals, but that made it hard to build on top of.</p>
<p>OpenFL plus haxelib were the nail in the coffin. We talked about making a version of HaxePunk with no dependencies, and I even built one in <a href="https://github.com/MattTuttle/HaxePunk">my own repository</a>. I ported all of my own games to it but never released it publicly.</p>
<p>The other side was Flash. Around 2012, the vast majority of Flash developers fled the platform. I remember because I&#39;d started a new job in 2011, which was another reason my game dev slowed down. Those developers moved on to other things. Unity had been free since 2009, Torque went open source in 2012, and Unreal became free in 2015. There wasn&#39;t much reason left to use our little open source framework, so the developers left. HaxeFlixel might still be around, but it&#39;s not the same as it was 15 years ago.</p>
<h2 id="the-years-in-between">The years in between</h2>
<p>The problem was that I didn&#39;t think there was another language like Haxe. A lot of languages were locked into a specific ecosystem, and I was on a Mac at the time, which sometimes limited what I could use.</p>
<p>I learned Lua, which has plenty of issues: arrays start at 1, there&#39;s no typing, and so on. I learned to like it anyway and wrote several things in Codea and Love2D. It had the same feel as Haxe. I could write code without any hidden layers slowing me down, and I understood what most of it did. Unity&#39;s ecosystem felt alien to me. I tried it, but it never caught on for me. I was also used to nearly instant builds with Haxe.</p>
<p>I had a bunch of starts and stops with Godot. I first played with it around 2019, but the first thing I built that was more than a really basic project was Napoleon in 2022, a Godot 3 version of SPI&#39;s war game <em>Napoleon at Waterloo</em>. It still never really clicked. I&#39;d written a ton of Python for work, and GDScript felt &quot;off.&quot; There were no list comprehensions (honestly not that big of a deal), there was no typing at the time, and it felt sluggish. C# support was either nonexistent or lackluster back then.</p>
<p>Then I got focused on my NES game. <a href="/projects/echoes/">Echoes of the Unread</a> started back in 2016 as a Super Mario Bros. ROM hack, and from 2022 to early 2025 it took up a huge amount of my time. In a lot of ways it felt like Haxe again: my own tooling, my own engine, and I could compile the whole game from scratch in a few seconds.</p>
<h2 id="picking-an-engine">Picking an engine</h2>
<p>As Echoes was wrapping up, I really wanted to make more games, and I kept trying things in Love2D. But I kept writing boilerplate, the UI was cumbersome to create by hand, and not many games actually ship in Love2D. Balatro is the exception, not the rule. I knew I needed to bite the bullet and learn one of the big three: Unity, Unreal, or Godot.</p>
<p>Then Unity shot themselves in the foot by changing their license, so I decided to give Godot another real try. In early 2024 I ported Napoleon to Godot 4 and made a few small prototypes. My background in open source made Godot feel like a better bet too. If I didn&#39;t understand something in the docs, or something didn&#39;t work, I could just read or edit the source myself. And I was mostly making 2D games, where Godot is stellar, so why not.</p>
<h2 id="when-godot-clicked">When Godot clicked</h2>
<p>What finally got me there was a <a href="https://www.udemy.com/course/create-a-complete-grid-based-puzzle-game-godot-4-c-sharp/">Udemy course by Firebelly</a>, in late 2024. I&#39;d watched one of his videos and was impressed with how he thought through his projects. His code was well designed, not like most of the half-baked beginner tutorials on YouTube. So I bought his courses and started working through them.</p>
<p>That&#39;s when Godot finally clicked. I understood how nodes are supposed to work, with scripts gluing them together. And building UI in Godot was almost fun?! Seriously, I hate UI. I hated it in games, I hated it on the web, and at best I tolerate making it. Godot came along and made it far less painful.</p>
<p>Since then I&#39;ve made <a href="/projects/hanadoku/">Hanadoku</a>, <a href="https://algorhythmic.itch.io/the-universe-is-collapsing">The Universe Is Collapsing</a>, and <a href="/projects/ten-thousand-floors/">Ten Thousand Floors</a> in Godot and a bunch of other prototypes.</p>
<p>I don&#39;t know if I understand Godot all the way down the way I did Haxe, but I understand how the nodes work well enough to stitch together a proper game. Godot&#39;s way of developing has definitely clicked for me.</p>
]]></description>
        <pubDate>Thu, 22 Oct 2026 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2026/10/from-haxe-to-godot/</link>
        <guid isPermaLink="true">https://matttuttle.com/2026/10/from-haxe-to-godot/</guid>
        
        <category>Haxe</category>
        
        <category>HaxePunk</category>
        
        <category>Godot</category>
        
        
    </item>
    
    <item>
        <title>Build Configuration Files for HXCPP</title>
        <description><![CDATA[<p>If you&#39;ve ever attempted to write an extension for Haxe using hxcpp you probably hit a wall trying to figure out how to create a Build.xml file. The common &quot;solution&quot; is to copy and paste what other projects have done until something works. However, if you want to really understand the inner workings of hxcpp&#39;s xml format you&#39;ll want to continue reading.</p>
<h2 id="the-most-basic-build-xml-file">The Most Basic Build.xml File</h2>
<p>First, instead of diving in to all of the specifics of the file format let&#39;s look at the bare minimum example of a Build.xml file.</p>
<h4 id="build-xml">Build.xml</h4>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">xml</span>&gt;</span> <span class="hljs-comment">&lt;!-- Theoretically this tag could be named anything but hxcpp uses "xml" so we'll use that too --&gt;</span>
    <span class="hljs-comment">&lt;!-- A target with the id "default" must be defined or hxcpp will issue a warning --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"default"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">xml</span>&gt;</span></code></pre>

<p>If you created this file it can be &quot;compiled&quot; using the command <code>haxelib run hxcpp Build.xml</code>. If the hxcpp command can&#39;t be found make sure that you have hxcpp installed using <code>haxelib install hxcpp</code>. For now it won&#39;t actually do anything but hxcpp will gladly read this file and not print out any errors or warnings.</p>
<p>Before we cover targets, and how they can be used, let&#39;s take a look at some of the other root level elements that can be defined.</p>
<h2 id="print-information-and-error-handling">Print Information and Error Handling</h2>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Can anyone hear me?"</span> /&gt;</span></code></pre>

<p>Echo is only allowed at the base level of the xml file. It&#39;s useful for printing out detailed information about what is being compiled.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">error</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"This message will self destruct in... NOW."</span> /&gt;</span></code></pre>

<p>You can cause an intentional error to occur in hxcpp with this element. Why would you want to do that? Perhaps you don&#39;t want to support certain build conditions so instead you decide to show a useful error message to the person compiling your project.</p>
<h2 id="define-variables">Define Variables</h2>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"foo"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"bar"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- define "foo" with the value "bar" --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">unset</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"foo"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- remove the "foo" define --&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">setenv</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"foo"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"bar"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- define "foo" again and set an environment variable --&gt;</span></code></pre>

<p>I decided to combine <code>set</code> and <code>setenv</code> because they are easy to get mixed up. First, <code>set</code> and <code>unset</code> are used to assign and remove defined values. These are useful for conditional checks as we will see in a moment. The difference between <code>set</code> and <code>setenv</code> is that the latter not only defines a value but also sets it in the operating system environment variables. Note that all of the attributes shown above are <em>required</em> and hxcpp will fail if you forget them.</p>
<pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- <span class="hljs-doctag">NOTE:</span> this uses the "name" attribute and not "value" like you may expect --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">path</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"/path/to/binaries"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- append to PATH variable --&gt;</span></code></pre>

<p>The <code>path</code> element works almost identically to <code>setenv</code> with one major difference. It <strong>appends</strong> to the PATH variable instead of replacing it.</p>
<h2 id="conditional-attributes">Conditional Attributes</h2>
<p>Every element in the build.xml file can have conditional attributes applied to it. These will help customize the build for each operating system you may be targeting. There are only a handful so let&#39;s take a look at each one.</p>
<h3 id="if">If</h3>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"on_boat"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"yep"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- only checks for the definition of a variable not the actual value --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"I'm on a boat"</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"on_boat"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- multiple conditions can be chained together with or statements "||" --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Apple fanboys forever!"</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"macos || ios"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- separating values by spaces means that both must be defined to pass the condition check --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Compiling for a 64-bit linux machine"</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"linux HXCPP_M64"</span> /&gt;</span></code></pre>

<p>You can add the <code>if</code> attribute to an element to check when values have been defined.</p>
<h3 id="unless">Unless</h3>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"have_pants"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"false"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- this will not execute because the condition passes, note that the value doesn't matter --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"I can't find my pants"</span> <span class="hljs-attr">unless</span>=<span class="hljs-string">"have_pants"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- multiple conditions can be chained together with or statements "||" --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"We don't like Apple fanboys!"</span> <span class="hljs-attr">unless</span>=<span class="hljs-string">"macos || ios"</span> /&gt;</span></code></pre>

<p><code>unless</code> is the &quot;everything but&quot; condition. Useful for when you want to exclude certain portions of your build configuration.</p>
<h3 id="ifexists">IfExists</h3>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">echo</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Phew, it exists."</span> <span class="hljs-attr">ifExists</span>=<span class="hljs-string">"path/to/file.txt"</span> /&gt;</span></code></pre>

<p>This is a special condition for checking if a file exists in the file system.</p>
<h2 id="grouping-configurations-and-including-other-files">Grouping Configurations and Including Other Files</h2>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"windows"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">echo</span> "<span class="hljs-attr">I</span>'<span class="hljs-attr">m</span> <span class="hljs-attr">in</span> <span class="hljs-attr">another</span> <span class="hljs-attr">section</span>!" /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
<span class="hljs-comment">&lt;!-- You can identify sections with an id attribute. This is useful for including in other xml files --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"my-section"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span></code></pre>

<p>You can use the <code>section</code> element to define a group of elements. It can have conditions like all the other elements so it&#39;s a good way to skip large portions of the build file.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"include/more.xml"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- Adding the noerror attribute will prevent an error if the include file doesn't exist --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"does_not_exist.xml"</span> <span class="hljs-attr">noerror</span>=<span class="hljs-string">"true"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- The section attribute lets you restrict the include to a specific section. You must have a coresponding id in the included file. --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">include</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"other.xml"</span> <span class="hljs-attr">section</span>=<span class="hljs-string">"my-section"</span> /&gt;</span></code></pre>

<p>Including other configuration files is a good way to split up your build process as it grows larger. You may also want to split out platform specific configuration details into another file as well.</p>
<h2 id="miscellaneous-top-level-elements">Miscellaneous Top Level Elements</h2>
<p>Before we get to defining targets I want to cover the rest of the other top level elements.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">copyFile</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"README.md"</span> <span class="hljs-attr">from</span>=<span class="hljs-string">"."</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- Normally copyFile will fail if a file doesn't exist. "allowMissing" prevents that error. --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">copyFile</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"graphics/logo.png"</span> <span class="hljs-attr">from</span>=<span class="hljs-string">"assets"</span> <span class="hljs-attr">allowMissing</span>=<span class="hljs-string">"true"</span> /&gt;</span>
<span class="hljs-comment">&lt;!-- Adding "toolId" only runs copy file on targets where the toolId attributes match --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">copyFile</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"logo.png"</span> <span class="hljs-attr">from</span>=<span class="hljs-string">"assets/graphics"</span> <span class="hljs-attr">toolId</span>=<span class="hljs-string">"dll"</span> /&gt;</span></code></pre>

<p>Contrary to what you may think this doesn&#39;t copy files immediately, it only happens when a target executes. The <code>name</code> attribute should be a filename and the <code>from</code> attribute is the directory where a file of that name exists. The file will be placed in the target&#39;s output directory with the same filename. <strong>If you include a directory in the name attribute it has the potential to fail because hxcpp does not create folders for you.</strong></p>
<pre><code class="hljs xml"><span class="hljs-comment">&lt;!-- allowed name values (androidNdk, blackberry, msvc, mingw, emscripten) --&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">setup</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"androidNdk"</span> /&gt;</span></code></pre>

<p>The <code>setup</code> element is used to set defines for specific build environments. It takes a name for a build environment and then passes the currently defined values to that tool.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">pleaseUpdateHxcppTool</span> <span class="hljs-attr">version</span>=<span class="hljs-string">"0.1"</span> /&gt;</span></code></pre>

<p>Used by hxcpp when the version is outdated. <strong>I would advise against using this element unless you know what you&#39;re doing.</strong></p>
<h2 id="targets-and-file-groups">Targets and File Groups</h2>
<p>Targets are the bread and butter of hxcpp&#39;s configuration files. Think of a target as a group of executed commands to eventually either build an executable or some other form of output. Let&#39;s go back to the basic example from the beginning of this post for a second.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">xml</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"default"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">xml</span>&gt;</span></code></pre>

<p>So we can see that a target at the most basic sense only requires an id attribute. It&#39;s also worth noting that the &quot;default&quot; target is important because it specifies the starting point for hxcpp. Without a default target hxcpp will display an error message. Let&#39;s add a bit to this example.</p>
<h4 id="hello-cpp">Hello.cpp</h4>
<pre><code class="hljs cpp"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;iostream&gt;</span></span>
<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">(<span class="hljs-keyword">int</span> argc, <span class="hljs-keyword">char</span> *argv[])</span>
</span>{
    <span class="hljs-built_in">std</span>::<span class="hljs-built_in">cout</span> &lt;&lt; <span class="hljs-string">"Hello world!"</span> &lt;&lt; <span class="hljs-built_in">std</span>::<span class="hljs-built_in">endl</span>;
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}</code></pre>

<h4 id="build-xml">Build.xml</h4>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">xml</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- This is a file group, it contains a set of source files --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">files</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"common"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">file</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Hello.cpp"</span> /&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">files</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"default"</span> <span class="hljs-attr">output</span>=<span class="hljs-string">"hello"</span> <span class="hljs-attr">tool</span>=<span class="hljs-string">"linker"</span> <span class="hljs-attr">toolid</span>=<span class="hljs-string">"exe"</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">files</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"common"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- reference the file group we just created --&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">xml</span>&gt;</span></code></pre>

<p>If you create a <code>Hello.cpp</code> file with the code above and run <code>haxelib run hxcpp Build.xml</code> you&#39;ll see that it generates an executable file. Run that executable and you will see <code>Hello world!</code> in the console window. You just compiled a C++ program using hxcpp!</p>
<p>Let&#39;s dissect this a bit. First there is a file group, which in this case is just our main C++ file. Following that is our default target but it has a bunch more attributes added to it. The <code>output</code> attribute determines what the final output will be named. If you are on Windows you may have noticed that it automatically adds a &quot;.exe&quot; extension. The <code>tool</code> and <code>toolid</code> attributes work together to determine how hxcpp will compile the code. The only supported value for <code>tool</code> is linker right now and the <code>toolid</code> can be a variety of values (exe, dll, static_link are the most common). You can make your own custom linker tool but I&#39;m not going to cover that in this post.</p>
<h3 id="compiler-flags">Compiler Flags</h3>
<p>If you&#39;ve compiled anything beyond the most basic programs in C++ you&#39;ve probably hit the need to include libraries in your program. Thankfully hxcpp supports external libraries as we&#39;ll see below.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"opengl"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">files</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"opengl"</span> /&gt;</span>
    <span class="hljs-comment">&lt;!-- compiler flags --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">flag</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"-I/usr/local/include"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">lib</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"-lgl"</span> <span class="hljs-attr">unless</span>=<span class="hljs-string">"macos"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">vflag</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"-framework"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"OpenGL"</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"macos"</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span></code></pre>

<p>These flags can get a bit confusing because they all basically do the same thing. The main difference between the flag elements and lib is that the former comes before the objects passed to the compiler and the latter is placed after the objects.</p>
<p>Also, flag and vflag are nearly identical except that vflag takes two values and merges them together with a space. It&#39;s important to note that you <strong>should not add spaces</strong> in these values unless you want them to be wrapped in quotes. Which also means that sometimes you have to use workarounds like add multiple lib elements for flags that require spaces.</p>
<h3 id="directories">Directories</h3>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"directories"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">outdir</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"build"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- directory to place final output --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">builddir</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"source"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- directory where source files are --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">dir</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"obj"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- mentioned in the hxcpp source but never used... --&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span></code></pre>

<p>As you can see there are several directory options that can be set. The first is the <code>outdir</code> element that specifies where to put the final output, from the linker step. It should be noted that the <code>outdir</code> name has a forward slash, &quot;/&quot;, appended to it. The <code>builddir</code> can be thought of as the base directory. It is where you will find the files you want to compile and it will set the base for the <code>outdir</code> as well.</p>
<h3 id="dependencies">Dependencies</h3>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"misc"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">depend</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"parent"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- requires another target to finish before this one --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">if</span>=<span class="hljs-string">"linux"</span>&gt;</span> <span class="hljs-comment">&lt;!-- works just like the root section --&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">ext</span> <span class="hljs-attr">value</span>=<span class="hljs-string">".so"</span> /&gt;</span> <span class="hljs-comment">&lt;!-- add an extension to the output --&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span></code></pre>

<p>Like other parts of the build configuration, targets can have sections as well. This will group target configuration options just like you could group options at the root level. I&#39;ve also added the <code>depend</code> element which tells the build tool that it needs to finish a different target before running the current one. Note that this does not use the <code>id</code> attribute but instead uses <code>name</code>.</p>
<h2 id="using-with-haxe">Using With Haxe</h2>
<p>Up until this point we&#39;ve been using hxcpp to compile a C++ file directly. This is a perfectly viable way to build C++ and could be used in place of makefiles. However, you are probably wondering how this ties in with the Haxe language. So let&#39;s take a look at an example.</p>
<h4 id="main-hx">Main.hx</h4>
<pre><code class="hljs haxe">@:buildXml('&lt;echo value="I added something to Build.xml!" /&gt;
&lt;target id="haxe"&gt;
    &lt;lib name="-lgl" /&gt;
&lt;/target&gt;')
class Main
{
    public static function main() { }
}</code></pre>

<h4 id="build-hxml">build.hxml</h4>
<pre><code class="hljs bash">-cpp out
-main Main</code></pre>

<p>The <code>buildXml</code> metadata allows you to insert additional elements at the bottom of the generated Build.xml file. Take a look at <code>out/Build.xml</code> and scroll to the bottom of the file and you will see what was added. When you compile you should see the echo line show up in the output.</p>
<p>Now you may be wondering why there is a target with the id of &quot;haxe&quot;. This is a special target id that Haxe creates when transpiling to C++. One thing that hasn&#39;t been mentioned so far is that targets can be appended to if they have the same id value.</p>
<h2 id="appending-and-overriding-targets">Appending and Overriding Targets</h2>
<p>If two targets have the same id value they will be appended by default. You can change this by setting an override attribute. See the example below for clarification on how these attributes work.</p>
<pre><code class="hljs xml"><span class="hljs-tag">&lt;<span class="hljs-name">xml</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"foo"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"foo"</span>&gt;</span>
        <span class="hljs-comment">&lt;!-- append to foo --&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"foo"</span> <span class="hljs-attr">overwrite</span>=<span class="hljs-string">"true"</span>&gt;</span>
        <span class="hljs-comment">&lt;!-- remove foo's contents and replace them --&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">target</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"foo"</span> <span class="hljs-attr">append</span>=<span class="hljs-string">"true"</span>&gt;</span>
        <span class="hljs-comment">&lt;!-- append to foo (same as not having the attribute) --&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">target</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">xml</span>&gt;</span></code></pre>

<p>You may want to append or override targets when including other build configuration files. This gives you a lot of flexibility in how you compile your project.</p>
<h2 id="what-s-next-">What&#39;s Next?</h2>
<p>This post covered a lot of the basics of hxcpp&#39;s xml file format. The information covered should get you started and hopefully provide a clear explanation on many of the elements found in Build.xml files. In future posts I&#39;ll cover how to use a Build.xml file to compile a Haxe extension and also the inner workings of hxcpp&#39;s linker and compiler elements.</p>
]]></description>
        <pubDate>Mon, 13 Jul 2015 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2015/07/hxcpp-build-xml/</link>
        <guid isPermaLink="true">https://matttuttle.com/2015/07/hxcpp-build-xml/</guid>
        
        <category>hxcpp</category>
        
        
    </item>
    
    <item>
        <title>HXML Overview for Haxe</title>
        <description><![CDATA[<p>If you&#39;ve just started using Haxe or have been using OpenFL or Kha to build your projects you may not be familiar with Haxe&#39;s built-in build files, hxml. They use the same syntax as the arguments you&#39;d pass to Haxe on the command line with a few other nice features built in. Even if you are a seasoned pro there may be one or two features you didn&#39;t know about in this post.</p>
<h2 id="a-basic-example">A Basic Example</h2>
<p>Haxe can be overwhelming at first because of the number of targets it has available. Instead of trying to cover all of the targets this overview will just cover a few of them. Neko is a good target for command line tools and testing since it can be compiled quickly. To get started you should create a new project folder with the following two files in it.</p>
<h3 id="main-hx">Main.hx</h3>
<pre><code class="hljs haxe"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Main</span> </span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span></span>() {
        <span class="hljs-built_in">trace</span>(<span class="hljs-string">"hello world"</span>);
    }
}</code></pre>

<h3 id="build-hxml">build.hxml</h3>
<pre><code class="hljs bash">-neko output.n  <span class="hljs-comment"># this is the compiled neko binary</span>
-main Main      <span class="hljs-comment"># your main class (must have static function main defined)</span></code></pre>

<p>To build this example you enter <code>haxe build.hxml</code> on the command line. If everything goes as planned you should end up with a compiled neko binary named <code>output.n</code> in the same folder. To run this file you can enter <code>neko output.n</code> on the command line and it should print &quot;hello world&quot;. If you aren&#39;t getting results you may want to make sure Haxe and Neko have been properly installed and that you typed everything as shown above.</p>
<h2 id="class-paths-and-running-programs">Class Paths and Running Programs</h2>
<p>So far you have a very simple project compiling in Haxe but what if you want to put Main.hx in a different folder? This is where class paths come in. Haxe needs a way to find the classes you create so it can compile them. You should create a <code>source</code> folder now and move Main.hx into it. Now, update the build.hxml file to look like the one below.</p>
<pre><code class="hljs bash">-neko output.n
-main Main
-cp <span class="hljs-built_in">source</span>          <span class="hljs-comment"># this is the root of the new class path you created</span>
-cmd neko output.n  <span class="hljs-comment"># a quick way to run a command after compiling</span></code></pre>

<p>Notice that you add the <code>-cp</code> flag with the same name as the folder you just created. This can be a relative path to any folder including a parent folder using ellipsis, <code>../my_parent</code>. You may have also seen the additional <code>-cmd</code> flag which runs the command <code>neko output.n</code> after compiling the program. There is another way to execute neko code using the <code>-x</code> flag which is demonstrated below. Try it and see what happens.</p>
<pre><code class="hljs bash">-x Main     <span class="hljs-comment"># compiles the class Main into a neko binary file named Main.n and executes it</span>
-cp <span class="hljs-built_in">source</span>  <span class="hljs-comment"># you still need the class path to point to the source folder</span></code></pre>

<p>Hopefully you can see that the <code>-x</code> flag is a quick way to test a class using the neko target in Haxe.</p>
<h2 id="multiple-targets">Multiple Targets</h2>
<p>So by now you should have a better grasp on the neko target and some of the flags you can use to develop for neko. What if you also want to compile to javascript as well? One way would be to create another hxml file and build them separately but wouldn&#39;t it be better if you could do it all in one command?</p>
<pre><code class="hljs bash">-neko output.n
-main Main
-cp <span class="hljs-built_in">source</span>

--next         <span class="hljs-comment"># tell Haxe to start the next task</span>

-js output.js  <span class="hljs-comment"># create a javascript file</span>
-main Main
-cp <span class="hljs-built_in">source</span></code></pre>

<p>You&#39;ve probably noticed there are two new flags that haven&#39;t been used before. The first is <code>--next</code> which tells the Haxe compiler to start a new task which could be a command, another target, or a completely different program. The second flag is <code>-js</code> which will tell the Haxe compiler to build a javascript file.</p>
<p>This works fine but you might not want so much duplication between the two targets. Wouldn&#39;t it be nice if there was a way to specify the <code>-main</code> and <code>-cp</code> flags globally for the hxml file? There is!</p>
<pre><code class="hljs bash">-main Main
-cp <span class="hljs-built_in">source</span>

--each           <span class="hljs-comment"># use the flags above for every task below</span>

-neko output.n

--next

-js output.js

--next

-swf out.swf     <span class="hljs-comment"># compile to a flash swf file</span>
-swf-header 320:240:60:FFFFFF <span class="hljs-comment"># defines properties for the swf file (width:height:fps:background color)</span></code></pre>

<p>That&#39;s better. There is even a new target added just for fun. So you can see that the <code>--each</code> flag uses all of the flags above it for all of the tasks below. It&#39;s a bit like copying and pasting the flags multiple times.</p>
<h2 id="defines-and-debug">Defines and Debug</h2>
<p>Errors are bound to happen and trying to figure out where something broke can be a frustrating process. Thankfully Haxe has included stack traces to help you figure out what went wrong. There is one flag that will help improve stack traces while developing and that is <code>-debug</code>.</p>
<h3 id="error-hx">Error.hx</h3>
<pre><code class="hljs haxe"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Error</span> </span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span></span>() {
        <span class="hljs-keyword">throw</span> <span class="hljs-string">"This is an error"</span>;
    }
}</code></pre>

<h3 id="test-error-hxml">test-error.hxml</h3>
<pre><code class="hljs bash">-x Error
-debug</code></pre>

<p>Now if you build this code with <code>haxe test-error.hxml</code> you can see that Haxe dumps a stack trace where the throw is. If you were to remove this flag you&#39;ll see that the stack trace still occurs but doesn&#39;t have as much useful information. When building a release version you will want to remove this flag.</p>
<p>So that&#39;s all well and good but what if you want to compile something differently based on a defined value? You can do that with the <code>-D</code> flag. Here is an updated version of the Error class that handles a user defined value.</p>
<h3 id="error-hx">Error.hx</h3>
<pre><code class="hljs haxe"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Error</span> </span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span></span>() {
        <span class="hljs-meta">#<span class="hljs-meta-keyword">if</span> mydefine</span>
        <span class="hljs-built_in">trace</span>(<span class="hljs-string">"this only happens if -D mydefine is included"</span>);
        <span class="hljs-meta">#<span class="hljs-meta-keyword">end</span></span>
        <span class="hljs-meta">#<span class="hljs-meta-keyword">if</span> debug</span>
        <span class="hljs-built_in">trace</span>(<span class="hljs-string">"I'm in debug mode"</span>);
        <span class="hljs-meta">#<span class="hljs-meta-keyword">end</span></span>
        <span class="hljs-keyword">throw</span> <span class="hljs-string">"This is an error"</span>;
    }
}</code></pre>

<pre><code class="hljs bash">-x Error
-debug
-D mydefine</code></pre>

<p>You might have noticed that there is a condition for a debug define. By using the <code>-debug</code> flag it also automatically includes <code>-D debug</code> as well. You can read more about conditional compilation in the <a href="http://haxe.org/manual/lf-condition-compilation.html">Haxe manual</a>.</p>
<h2 id="external-libraries">External Libraries</h2>
<p>Up until now you&#39;ve only been using the standard library for Haxe. What about adding external code from haxelib? There&#39;s a flag for that too! First you should install a library through haxelib.</p>
<pre><code class="hljs bash">haxelib install format</code></pre>

<p>Now you are ready to compile with the format library.</p>
<pre><code class="hljs bash">-x Main      <span class="hljs-comment"># compile and execute the Main class for neko</span>
-cp <span class="hljs-built_in">source</span>
-lib format  <span class="hljs-comment"># include the format library from haxelib</span></code></pre>

<p>Were you expecting something more difficult? Hopefully this is all making sense and you are ready to move on to the next compile target, C++. But first you should learn about reducing the size of your compiled output.</p>
<h2 id="dead-code-elimination">Dead Code Elimination</h2>
<p>When compiling to javascript you may notice that the output can get pretty large. By default Haxe includes a lot of unused functions and classes based on what you import. This is a good thing because it prevents your code from crashing if a class isn&#39;t included in the output. However, Haxe is very smart in that it knows what code can be tossed if a function is never called.</p>
<pre><code class="hljs bash">-x Main
-cp <span class="hljs-built_in">source</span>
-dce full   <span class="hljs-comment"># can be "no", "std", or "full"</span></code></pre>

<p>The new flag is <code>-dce</code> which has a few options. The first is to pass &quot;no&quot;, which is the default, and simply doesn&#39;t perform dead code elimination. The second is &quot;std&quot; which will strip any unused code in the Haxe standard library. The final one is &quot;full&quot; which eliminates all unused code from your compiled output.</p>
<p>One thing to note however is that Haxe can sometimes remove functions that you need if you are using fancy tricks like reflection. There may also be libraries that do not work well with dead code elimination so be careful that you test thoroughly when this flag is turned on. You may want to read more about how to retain functions and classes in the Haxe manual on <a href="http://haxe.org/manual/cr-dce.html">dead code elimination</a>.</p>
<h2 id="c-">C++</h2>
<pre><code class="hljs bash">haxelib install hxcpp</code></pre>

<p>hxcpp is the required library to compile C++ code. It contains a handful of tools and a way to add native extensions with CFFI. Here&#39;s an example of how you can compile to C++.</p>
<pre><code class="hljs bash">-cpp out    <span class="hljs-comment"># slightly different than other targets because this defines a directory</span>
-main Main
-cp <span class="hljs-built_in">source</span></code></pre>

<p>This looks familiar, right? The <code>-cpp</code> flag works almost identical to other targets but instead of naming an output file it names the output directory. If you run <code>haxe build.hxml</code> now you may get an error if no compiler is found on your computer. You can either go through the step to remedy that or use the next method.</p>
<h3 id="cppia">Cppia</h3>
<p>As of writing this Cppia, pronounced &quot;sepia&quot;, is a new feature for Haxe and hxcpp. It is a very quick way to compile C++ code and runs equal to or faster than Neko. That said there are still some early issues especially with null values. So how do you compile for Cppia?</p>
<pre><code class="hljs bash">-cpp out.cppia  <span class="hljs-comment"># unlike before this is actually a file name and not a directory</span>
-D cppia        <span class="hljs-comment"># this is where the magic happens</span>
-main Main
-cp <span class="hljs-built_in">source</span>
-cmd haxelib run hxcpp out.cppia  <span class="hljs-comment"># execute the cppia file</span></code></pre>

<p>There are a few differences you might see. The first is that the <code>-cpp</code> flag no longer takes a directory name but instead it takes a file name. The second is that you need to define a value to tell hxcpp to output Cppia instead of C++. Finally there is a command flag at the bottom which executes the code by passing the newly created cppia file to hxcpp.</p>
<h2 id="where-to-go-from-here">Where to go from here</h2>
<p>There are a lot of flags that were not covered in this post. If you want to find out what they are the first thing to do is to run <code>haxe -help</code> which will return a list of all the supported flags in Haxe. There is also some useful information in the <a href="http://haxe.org/manual/">Haxe manual</a> that may be helpful.</p>
]]></description>
        <pubDate>Mon, 29 Jun 2015 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2015/06/hxml-overview/</link>
        <guid isPermaLink="true">https://matttuttle.com/2015/06/hxml-overview/</guid>
        
        <category>hxml</category>
        
        <category>hxcpp</category>
        
        <category>cppia</category>
        
        <category>neko</category>
        
        
    </item>
    
    <item>
        <title>OpenGL Resources</title>
        <description><![CDATA[<p>OpenGL has gone through several verions over the years but it seems that many of the tutorials you&#39;ll find on the internet are dated and mostly cover the fixed function pipeline. I wanted to find more information about programable shaders (glsl), framebuffers, vertex buffers, and many of the other newer features found in later versions of OpenGL. So I&#39;ve compiled a list of good tutorials and sites I&#39;ve found that cover these topics.</p>
<h2 id="opengl-tutorials">OpenGL Tutorials</h2>
<p><a href="http://open.gl/">http://open.gl/</a></p>
<p>Start here first. These tutorials are well written and clearly explain some of the details of OpenGL that seemed mystic to me before. I actually understand the difference between a framebuffer and renderbuffer now!</p>
<p><a href="http://learnopengl.com/">http://learnopengl.com/</a></p>
<p>Another great site that covers a wide variety of topics including lighting, shadows, and parallax/normal maps.</p>
<p><a href="http://www.opengl-tutorial.org/">http://www.opengl-tutorial.org/</a></p>
<p>These tutorials include the full source code which is very useful for tinkering.</p>
<p><a href="http://antongerdelan.net/opengl/">http://antongerdelan.net/opengl/</a></p>
<p>Anton Gerdelan has several tutorials on his website as well as a book. He has a good overview of ray picking and cube maps.</p>
<h2 id="heroku-s-glsl">Heroku&#39;s GLSL</h2>
<p>This site is full of mind blowing fullscreen glsl effects. Everything runs in the browser and the source code live reloads. It even lets you tweak anyone&#39;s code and save your own changes.</p>
<p><a href="https://web.archive.org/web/20140314100933/http://glsl.heroku.com/">http://glsl.heroku.com/</a></p>
<h2 id="opengl-documentation">OpenGL Documentation</h2>
<h3 id="opengl-4-reference-pages">OpenGL 4 Reference Pages</h3>
<p><a href="https://web.archive.org/web/20140322074823/http://www.opengl.org/sdk/docs/man/">http://www.opengl.org/sdk/docs/man/</a></p>
<p>When you&#39;ve exhausted the above sites this is the official reference for OpenGL. It has complete descriptions on all of the gl functions.
There are probably many others but these gems have helped me immensely.</p>
<h3 id="api-docs-for-multiple-versions">API Docs for multiple versions</h3>
<p><a href="http://docs.gl/">http://docs.gl/</a></p>
<p>This is a great site to get information on different versions of gl* function calls.</p>
]]></description>
        <pubDate>Sun, 09 Mar 2014 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2014/03/opengl-resources/</link>
        <guid isPermaLink="true">https://matttuttle.com/2014/03/opengl-resources/</guid>
        
        <category>OpenGL</category>
        
        <category>tutorials</category>
        
        <category>glsl</category>
        
        
    </item>
    
    <item>
        <title>Haxe Networking and Bonjour</title>
        <description><![CDATA[<p>I&#39;ve been working on a party game for the last few months that requires local networking between iOS and Android. The only problem is that I didn&#39;t want users to have to type in ip addresses. Enter the world of zero configuration networking...</p>
<p>Bonjour has been around for quite a while and primarily works on iOS and OSX, although Apple has provided a Windows library as well. Essentially a program publishes a services over the network that is available to find from any computer on that network. Another running program can then broadcast out a request to find certain types of services and resolve them. If none are found, the program can choose to stop looking or send out another request.</p>
<p>This is all well and good but Android doesn&#39;t have support for Bonjour. Instead someone created jmDNS which is a Java implementation that can talk with Bonjour services, with some minor differences. So now I knew which libraries to use but neither one of them works with Haxe which is the programming language I prefer.</p>
<p>With some help from hxcpp I was able to glue the two libraries together into a single class that can be used on multiple platforms. This solved my problem of finding devices over the network but what about connecting them together?</p>
<p>Haxe has basic socket connection classes, UDP will be in 3.1.0, but no major networking library (that I&#39;m aware of). Using Python&#39;s twisted framework as inspiration I decided to create <a href="https://github.com/MattTuttle/hxnet">hxnet</a>. It has simple Client/Server code for both TCP and UDP as well as basic protocol classes for RPCs and Telnet.</p>
<p>The Bonjour class is included in hxnet and it should be flexible enough to add protocols like HTTP, FTP, etc... I&#39;m not sure I&#39;d consider it production level code yet but it&#39;s solid enough for me to build my game with it. If you want to give it a shot the code is on GitHub and feel free to create pull requests if you find bugs or code up a crazy new feature.</p>
]]></description>
        <pubDate>Wed, 29 Jan 2014 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2014/01/haxe-networking-rpcs-bonjour/</link>
        <guid isPermaLink="true">https://matttuttle.com/2014/01/haxe-networking-rpcs-bonjour/</guid>
        
        <category>Haxe</category>
        
        <category>networking</category>
        
        <category>twisted</category>
        
        <category>udp</category>
        
        <category>tcp</category>
        
        <category>hxnet</category>
        
        
    </item>
    
    <item>
        <title>Recently Changed Files in git</title>
        <description><![CDATA[<p>When setting up a deployment script from git I needed to know what files were recently changed. Here is a useful script that does exactly that. Just change <code>HEAD~4</code> to whatever commit you want to go back to.</p>
<pre><code class="hljs bash">git <span class="hljs-built_in">log</span> --pretty=oneline --name-only HEAD~4..HEAD | sed -E -e <span class="hljs-string">'/[0-9a-zA-Z]{40} /d'</span> | sort | uniq</code></pre>]]></description>
        <pubDate>Thu, 23 Jan 2014 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2014/01/recently-changed-files-git/</link>
        <guid isPermaLink="true">https://matttuttle.com/2014/01/recently-changed-files-git/</guid>
        
        <category>git</category>
        
        <category>deployment</category>
        
        <category>script</category>
        
        
    </item>
    
    <item>
        <title>Why you should buy an Ouya</title>
        <description><![CDATA[<p>Do you...</p>
<ul>
<li>develop indie games?</li>
<li>get tired of playing (insert title) (insert version) games?</li>
<li>enjoy tinkering with consoles?</li>
<li>wish you could actually punch your friend while playing a multiplayer game?</li>
<li>like playing flash games but wish they were more complex?</li>
<li>have a need to be a hipster?</li>
<li>feel jaded about the upcoming next-get consoles?</li>
<li>hate everything that is bad and love everything that is good?</li>
<li>want to play your Android games with a controller?</li>
<li>currently have a pulse?</li>
</ul>
<p>If any of these are true you need to stop reading now and purchase an Ouya.</p>
<p>Seriously... now.</p>
<p>What are you waiting for? It&#39;s $99 well spent.</p>
]]></description>
        <pubDate>Tue, 09 Jul 2013 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2013/07/why-you-should-buy-an-ouya/</link>
        <guid isPermaLink="true">https://matttuttle.com/2013/07/why-you-should-buy-an-ouya/</guid>
        
        <category>Ouya</category>
        
        
    </item>
    
    <item>
        <title>Ouya Review from a Developer&amp;apos;s Perspective</title>
        <description><![CDATA[<p>My Ouya arrived a few weeks ago and I thought I&#39;d post a review of it. My experience so far has been generally positive and the system gets better with every update. For $99 it&#39;s worth the price of admission.</p>
<img src="/static/images/posts/little-crane.jpg" alt="Little Crane That Could" width="300" height="168" class="alignright size-medium" />

<p>There are already a good variety of games for it, around 200, and so far one of my favorite games is <em>The Little Crane That Could</em>. The graphics aren&#39;t amazing and while the controls can be frustratingly hard the sense of accomplishment from completing each of the puzzles is exhilarating. I hesitated to download it at first due to the less than stellar promo art but it is a game you absolutely should try out. My other favorites (in no order) are Polarity, Towerfall, Knightmare Tower, A Bit Of A Fist Of Awesome, Beast Boxing Turbo, and Stalagflight.</p>
<p>Which brings me to what I think is a game changer for the industry, the marketplace. On the Ouya you can try every game for free. It&#39;s a little like shareware back in the 80s-90s when you would get a sampler disk of games and later mail in an order for the ones you liked. This was amazing for a kid growing up in a lower income family since I could try lots of different games at a low cost.</p>
<p>The thing about the store that is completely different from any other marketplace, that I&#39;m aware of, is that prices are not listed anywhere. The game might be charging $1 or $20 and I won&#39;t know until I download and play it. This removes the price barrier from trying something out and seeing what I enjoy. It also diminishes the value of discounts that are so prevalent on mobile stores and the, often loathed by developers, $1 price point.</p>
<img src="/static/images/posts/ouya-controller.jpg" alt="Ouya Controller" width="560" height="302" class="alignleft size-medium" />

<p>As for the hardware, I am really impressed with the controller design. The triggers feel a bit spongy but overall the controller feels comfortable and evenly weighted. I have larger hands so PlayStation controllers have always irritated me and while I still think the Xbox has a better controller overall I&#39;d say the Ouya comes in a close second (especially given that the D-pad is better). However, if you like the other controllers there are ways to use them on an Ouya. Talk about a win/win.</p>
<p>The actual hardware I&#39;ve heard compared to a turbo-charged PS2. It has more RAM than the current gen consoles which is wonderful for resource loading. The Tegra 3 graphics might not hold up to today&#39;s standards but I&#39;m hoping to see less &quot;realistic&quot; games and more creativity on the Ouya. It really feels like the NES all over again with so many unique games. Except that it&#39;s easier to develop a game now than it was in the past.</p>
<p>Possibly the best &quot;feature&quot; of Ouya is the openness for developers. This is exactly what iOS and Android have provided for mobile and now indie developers have a chance at console development (without selling our souls). The ODK is a bit rough around the edges at the moment but it is no more difficult building a game for the Ouya than it is for Android. I was able to port several of my HaxePunk prototypes over a single weekend. Most of the work was just getting the input to function like I wanted.</p>
<p>Overall my outlook on the Ouya is good. I was one of the last groups to receive my Ouya but I understand how difficult it would be to manufacture that many units as well as plan for a commercial release. That being said, I feel like the Ouya team is fully committed to making this a quality product. The console is well thought out and while there are still rough spots I think that will all get sorted after they are out of the growing pains stage.</p>
]]></description>
        <pubDate>Fri, 05 Jul 2013 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2013/07/ouya-review-developers-perspective/</link>
        <guid isPermaLink="true">https://matttuttle.com/2013/07/ouya-review-developers-perspective/</guid>
        
        <category>Ouya</category>
        
        
    </item>
    
    <item>
        <title>TestFlight for Haxe</title>
        <description><![CDATA[<p>TestFlight is a great testing tool for iOS apps. I&#39;ve used it a lot at work to distribute builds to multiple devices around the company. It prompts the tester when there is a new update and tracks analytics with checkpoints and crash logs. The only issue is you need to have the SDK installed to get all those goodies.</p>
<p>Since I use Haxe a lot and have been working diligently on the HaxePunk library I knew having TestFlight integration would be a huge benefit. So I finally got the code to a point where it is ready for release and am hoping it proves useful to other people.</p>
<p>The code is located on GitHub at <a href="https://github.com/MattTuttle/nme-testflight">https://github.com/MattTuttle/nme-testflight</a>. You can also get it through <a href="https://web.archive.org/web/20130119073243/http://haxe.org/doc/haxelib/using_haxelib">haxelib</a> by typing the following in your command prompt.</p>
<pre><code class="hljs bash">haxelib install testflight</code></pre>]]></description>
        <pubDate>Fri, 25 Jan 2013 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2013/01/testflight-for-haxe/</link>
        <guid isPermaLink="true">https://matttuttle.com/2013/01/testflight-for-haxe/</guid>
        
        <category>Haxe</category>
        
        <category>TestFlight</category>
        
        
    </item>
    
    <item>
        <title>My entry for Ludum Dare #23</title>
        <description><![CDATA[<p>I participated in Ludum Dare #23 this past weekend with over 1000 others. It was a fun experience and I was able to chat with some great guys on the HaxePunk forums/IRC. Unfortunately my time was divided between LD and several other events over the weekend but I&#39;m happy with what I ended up with. <a href="http://www.ludumdare.com/compo/ludum-dare-23/?action=preview&amp;uid=3934">Check it out!</a></p>
<h2 id="what-went-right">What went right</h2>
<ul>
<li>Built on a simple concept</li>
<li>Used tools I was familiar with (HaxePunk, MilkyTracker, Sublime Text 2)</li>
<li>Had a working game with objective in the first few hours</li>
<li>Used a real mouse for drawing instead of a touchpad</li>
</ul>
<h2 id="what-could-have-been-better">What could have been better</h2>
<ul>
<li>My power was out for 2 hours</li>
<li>I had several other events to attend over the weekend (besides church)</li>
<li>The sound effects were last minute</li>
</ul>
<h2 id="next-time">Next time</h2>
<ul>
<li>Have a laptop with a good battery (mine lasts 20 minutes...)</li>
<li>Participate more in topic selection and blog posts</li>
</ul>
]]></description>
        <pubDate>Mon, 23 Apr 2012 00:00:00 GMT</pubDate>
        <link>https://matttuttle.com/2012/04/ld48-enzyme-frenzy/</link>
        <guid isPermaLink="true">https://matttuttle.com/2012/04/ld48-enzyme-frenzy/</guid>
        
        <category>HaxePunk</category>
        
        <category>ludum dare</category>
        
        
    </item>
    
  </channel>
</rss>
