{"assets":[{"original":"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/09\/g1-550x507.png","local":"\/data\/posts\/2012\/09\/be7d4a2beec0f743b38b3d6507c38c52.png"},{"original":"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/09\/g2-550x572.png","local":"\/data\/posts\/2012\/09\/9b8f34cd4188ebcde1a03dec3f0090d5.png"},{"original":"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/09\/g5-550x506.png","local":"\/data\/posts\/2012\/09\/15c9b38765875de5981ea8eeb61b49d4.png"},{"original":"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/09\/g4-550x435.png","local":"\/data\/posts\/2012\/09\/a3509fad9deb138a5bddf9c58d8e7021.png"}],"author_link":"author\/quadtree\/","author_name":"quadtree","cat":"LD #24","categories":["LD #24"],"comments":[],"epoch":1347916920,"event":"LD24","likes":4,"metadata":{"p_key":"78235","p_author":"quadtree","p_authorkey":"0","p_urlkey":"287245","p_title":"Empire of the Petri Dish \u2013 Post Mortem","p_cat":"LD #24","p_event":"LD24","p_time":"1347916920","p_likes":"4","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1345766400","event_key":"12","event_name":"LD24"},"source_url":"2012\/09\/17\/empire-of-the-petri-dish-post-mortem\/","text":"<p>I\u2019ve been waiting to post this until after judging was over so that I could post some hopefully interesting charts derived from my server\u2019s access logs.<\/p>\n<p>This was my fifth LD48 entry. I\u2019ve entered every LD48 since LD20. I probably slacked off more this time then on previous ones, but that was largely intentional, as I tried to come up with a design simple enough that I didn\u2019t have to rush too much. I think it worked out well, as I actually managed to add in music this time.<\/p>\n<h2><\/h2>\n<h2>What Went Well<\/h2>\n<h3>Analytics<\/h3>\n<p>Since the game was implemented in HTML5, all resources were loaded on demand using separate HTTP requests. While this would slow it down for a big game, this one didn\u2019t need too many assets. This also had the advantage that I see in my server access logs when a resource is loaded, like the win screen. See below.<\/p>\n<h3>PlayN<\/h3>\n<p>Against my better judgement, I decided to use PlayN again even though last time I got burned when I discovered compatibility problems late in development. Specifically, I\u2019d been testing using native Java, and when I switched over to HTML5 compilation I discovered that transformation\u00a0matrices\u00a0weren\u2019t\u00a0compatible\u00a0with hardware accelerated WebGL at all, and I had to largely abandon the HTML5 version due to time.<\/p>\n<p>This time, I carefully tested the HTML5 version before the very end, and I avoided transformation matrices altogether. The HTML5 version works as well as you could expect, even in IE9, although of course it is extremely slow compared to the native Java version.<\/p>\n<h3>GUI<\/h3>\n<p>Compared to my previous efforts, I think this one\u2019s UI turned out fairly well. It has better highlighting and visual\/audio cues as to what will happen if the user performs some action. I also mostly managed to keep it simple, and avoided huge help pages with dozens of controls (unlike some of my previous entries).<\/p>\n<h3>Evolution<\/h3>\n<p>Ah, the most important thing, right? The way the bacterium\u2019s genes work is this:<\/p>\n<ul>\n<li>Each creature has a set number of arms (which is actually a floating point, however a creature with 2.3 arms will just have 2 for gameplay purposes).<\/li>\n<li>Each creature has a genome, consisting of an arbitrary number of genes, each one representing one \u201csegment\u201d on its arms. Each gene has 5 attributes, each itself a floating point:\n<ul>\n<li><strong>Length<\/strong><\/li>\n<li><strong>Width<\/strong><\/li>\n<li><strong>Type:\u00a0<\/strong>A number, usually from 0 to 5. It is rounded to the nearest whole number, determining the piece type:\n<ul>\n<li>0 (Or anything outside the range): Structure<\/li>\n<li>1: Engine<\/li>\n<li>2: Solar Cell<\/li>\n<li>3: Armor<\/li>\n<li>4: Weak Structure<\/li>\n<li>5: Weapon<\/li>\n<\/ul>\n<\/li>\n<li><strong>Angle:<\/strong> The angle of this piece relative to its parent\u2019s angle<\/li>\n<li><strong>Backtrack<\/strong>: Allows branching by causing this piece to move its base toward the center by this many segments before branching off. So for example backtrack 1 would create a Y shape.<\/li>\n<\/ul>\n<\/li>\n<li>When a new creature is created, its stats like arm length and number of arms are just averaged from its parents. Gaussian (bell curve shaped) random numbers are added to these averages. Then for each segment it gets a random one from all its possible parents. The\u00a0inherited\u00a0segment\u2019s genes are also altered by Gaussian randomness.<\/li>\n<li>The damage, health, solar collection, engine power etc. of each component is determined by its mass, which is close to width*length.<\/li>\n<\/ul>\n<p>The end result gave a lot of variety in the creature types, and I\u2019m pretty happy with it.<\/p>\n<h3>Music<\/h3>\n<p>Considering that it was randomly generated by Wolfram Tones, I\u2019m pretty happy with how the music turned out. The only small thing is that the music can seem a bit dissonant with the tone of the rest of the game at times. Another oddity was that the 64-bit JRE refused to load the music file, saying it was too big. The 32-bit JRE had no trouble, though.<\/p>\n<h2><\/h2>\n<h2>What Went\u2026 Less Well<\/h2>\n<h3>PlayN<\/h3>\n<p>Again, PlayN was something of a mixed bag, especially because of its default build system, Maven. When Maven works, it works really well but its error messages can be a bit incomprehensible when it fails.<\/p>\n<p>Additionally, PlayN\u2019s severe performance problems in HTML5 mode forced me to repeatedly scale back the size of the game world. I suspect this has a lot to do with JavaScript being slow.<\/p>\n<h3>AI<\/h3>\n<p>The game\u2019s AI isn\u2019t very good, although creating good AI for a game where the structures of creatures is so random would be a bit difficult. Still, I would have liked to make better AI for both enemies and player controlled bacteriums.<\/p>\n<h3>The Name<\/h3>\n<p>This was the first LD48 entry I had trouble naming. Originally, it was going to be called \u201cPetri Dish Empire\u201d. You can still see this name in some of the source code, and in the URL on my site \u201c\/pde\/\u201d. Eventually, I decided this sounded uninspired and I switched to \u201cEmpire of the Petri Dish\u201d, which while sounding a bit better is a mouthful. It was only after the compo was over that I realized I should have named it \u201cBacterium Imperium\u201d.<\/p>\n<h3>Testing and Balance<\/h3>\n<p>I noticed partway through development that weapon pieces were overpowered, so I made them more expensive, but it wasn\u2019t really enough.<\/p>\n<p>Another problem was that if the player wasn\u2019t aggressive enough, the enemy\u00a0bacteria\u00a0could grow out of control and make the game very slow. This is why I added the solar cell cap, but it was a kind of rough change that I added late in development.<\/p>\n<p>Late in development, I discovered a nasty exploit where you could use the fact that you can create a bacterium anywhere to put a small, heavily armed but immobile bacterium right in the core of an enemy, killing them quickly and easily. To fix this, I made it so that if on creation a bacterium intersected another, it was pushed away from the other one. If it still intersected others, it was pushed away until it did not, moving farther each time. The problem was that I just normalized the difference vector between their positions and then multiplied it by an increasing multiplier. Thus, in the degenerate case where they were right on top of each-other, it would enter an infinite loop. The issue was only discovered after the compo was over, so I couldn\u2019t fix it in the compo version. Judging from the comments, it doesn\u2019t look like a lot of people hit this issue, luckily.<\/p>\n<h2><\/h2>\n<h2>Analytics<\/h2>\n<p>I went back through my server access logs to see if I could make some interesting graphs of how people played the game. Here\u2019s what I found:<\/p>\n<p>Here\u2019s how people downloaded the two versions (The native Java one, and the HTML5 one). It shows both which ones they downloaded and in what order they did:<\/p>\n<p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/17\/empire-of-the-petri-dish-post-mortem\/g1\/\" rel=\"attachment wp-att-183079\"><img alt=\"\" class=\"alignnone size-large wp-image-183079\" height=\"507\" src=\"\/data\/posts\/2012\/09\/be7d4a2beec0f743b38b3d6507c38c52.png\" width=\"550\"\/><\/a><\/p>\n<p>In total, 90 people viewed the HTML5 version. However, 16 of them went on to download the Java version, so I suspect the HTML5 version didn\u2019t work for them. Of the remaining 74:<\/p>\n<p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/17\/empire-of-the-petri-dish-post-mortem\/g2\/\" rel=\"attachment wp-att-183080\"><img alt=\"\" class=\"alignnone size-large wp-image-183080\" height=\"572\" src=\"\/data\/posts\/2012\/09\/9b8f34cd4188ebcde1a03dec3f0090d5.png\" width=\"550\"\/><\/a><\/p>\n<p>Of the 9 people who won the HTML5 version, I measured the time from when they first requested the Javascript (the first thing that happens when you load the game in a browser) to when they won:<\/p>\n<p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/17\/empire-of-the-petri-dish-post-mortem\/g5\/\" rel=\"attachment wp-att-183078\"><img alt=\"\" class=\"alignnone size-large wp-image-183078\" height=\"506\" src=\"\/data\/posts\/2012\/09\/15c9b38765875de5981ea8eeb61b49d4.png\" width=\"550\"\/><\/a><\/p>\n<p>Finally, the game lets users select their screen size. While users can select any size, they\u2019re encouraged to select a size just under the viewable area of their browser. Here are the sizes people used (The size of the bubble indicates the number at that size):<\/p>\n<p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/09\/17\/empire-of-the-petri-dish-post-mortem\/g4\/\" rel=\"attachment wp-att-183077\"><img alt=\"\" class=\"alignnone size-large wp-image-183077\" height=\"435\" src=\"\/data\/posts\/2012\/09\/a3509fad9deb138a5bddf9c58d8e7021.png\" width=\"550\"\/><\/a><\/p>\n<p>\u00a0<\/p>\n<p>All in all, I\u2019m pretty happy with how it turned out, and I hope you all enjoyed playing it!<\/p>\n<p>For the curious, there is also a <a href=\"http:\/\/dyn.ironalloygames.com\/pde_pc\/\">post-compo<\/a> version with some alterations.<\/p>\n<p>\u00a0<\/p>","time":"September 17th, 2012 9:22 pm","title":"Empire of the Petri Dish \u2013 Post Mortem","title_was_empty":false}