<?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>Entertaining Software</title>
	<atom:link href="http://entertainingsoftware.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://entertainingsoftware.com</link>
	<description>Software just became more fun.</description>
	<lastBuildDate>Sat, 30 Mar 2013 03:03:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>McCraft</title>
		<link>http://entertainingsoftware.com/2013/03/29/mccraft/</link>
		<comments>http://entertainingsoftware.com/2013/03/29/mccraft/#comments</comments>
		<pubDate>Sat, 30 Mar 2013 03:01:39 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=201</guid>
		<description><![CDATA[Here are some updates on my research and development. First off, I have added a lot of controls to the Jewel menu system since I last wrote about it. I&#8217;ve added sub-menus and sliders, while also cleaning up the codebase. <a class="more-link" href="http://entertainingsoftware.com/2013/03/29/mccraft/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Here are some updates on my research and development.</p>
<p>First off, I have added a lot of controls to the Jewel menu system since I last wrote about it. I&#8217;ve added sub-menus and sliders, while also cleaning up the codebase. I concluded this would be much easier to program with C++, particularly for exception handling, which has always been a problem for C programmers like me. As such, I will probably be converting by the next release.</p>
<p><strong><a href="https://dl.dropbox.com/u/94060754/jewel-alpha2.tar.xz">Download the latest version of Jewel here.</a> (Released under the <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GNU General Public License version 3 or later</a>).</strong></p>
<p>I&#8217;ve found rewriting CANINE from the ground up to be particularly frustrating, and haven&#8217;t spent as much time as I should have on it. I tried updating Alpha-2 to have the changes I was planning for the new version to see how that would work, but that has also been oddly difficult. It doesn&#8217;t help that I have so many other things I want to do, too.</p>
<p>However, I have progress on the scripting language compiler! I wrote it in Ruby to allow for rapid prototyping and it is all hand-made. It supports a tied file-module structure (each file is a module) with module-level fields and functions. Good support for arithmetic, conditions and function calls has been implemented, though there are no control structures. The resulting output is in a human-readable assembly-like pseudo-code so that I can debug the compiler. This project has been rather fun.</p>
<p><strong><a href="https://dl.dropbox.com/u/94060754/orangecc-alpha1.tar.xz">Download orangecc.rb here.</a> (GPLv3+ as well.)</strong></p>
<p>What has caught my interest lately is voxel-based engines like Minecraft. Though, I&#8217;d like to point out that the blocks themselves in most of these aren&#8217;t actually voxels, but they often refer to the <em>blocks</em> as voxels, which is unusual and can get a bit confusing. However, I have learned a lot about modern OpenGL programming (and real-time graphics in general).</p>
<p>The most useful thing I&#8217;ve learned about is <em>vertex arrays</em>. As opposed to making a function call for every single vertex in the world, you just make one given an array of all the vertices you want. This speeds things up massively, though it further displays the usefulness of C++ (creating those lists is easier with std::vector&#8217;s than manual malloc/realloc-arrays). You can bring it down even further by culling out (ignoring) faces that are blocked by other cubes.</p>
<p>What&#8217;s interesting about voxel-based engines is the way they implement this. The world&#8217;s always changing, so you can&#8217;t have a static, unchanging array of vertices. Instead, the list must be regenerated every time the world is modified. Of course, this would take way too long in a world as big as Minecraft&#8217;s, which is what makes chunk-based design so useful.</p>
<p>For those of you who don&#8217;t know, Minecraft-type engines separate their worlds into multiple 16x16x256 (numbers change between some versions) chunks of blocks. What most people know is that this allows parts of the world to be loaded and unloaded at will. Something that most people may not know is that this also allows each chunk to maintain a separate vertex array.</p>
<p>When you modify a chunk, only that chunk&#8217;s array is modified. This allows regeneration to occur in real-time while still bringing render-times down in orders of magnitude. All you have to do at this point is balance array regeneration against render speed to determine chunk size, which is a decision left up to the human.</p>
<p>I&#8217;m not particularly sure if this is how Minecraft does it, but it appears that this is how many voxel-based engines work. I know Minecraft uses chunks, I just don&#8217;t know if it generates vertex arrays and, if it does, if there&#8217;s anything more they do.</p>
<p>From all this information, I wrote my own little voxel test. I call it McCraft because I really didn&#8217;t feel like thinking up a fancy name and that was the first thing that came to my head. I built it with Allegro 5.0.9 (for input and graphics) and libNoise (for Perlin-noise height map generation).</p>
<p><strong><a href="https://dl.dropbox.com/u/94060754/mccraft-alpha1.tar.xz">Download McCraft here.</a> (Again, GPLv3+.)</strong></p>
<p>So that&#8217;s the news. Also check out the latest version of <a title="Pizazz 1.3.0" href="http://entertainingsoftware.com/2013/03/13/pizazz-1-3-0/">Pizazz</a> which now supports alternative currencies!</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2013/03/29/mccraft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pizazz 1.3.0</title>
		<link>http://entertainingsoftware.com/2013/03/13/pizazz-1-3-0/</link>
		<comments>http://entertainingsoftware.com/2013/03/13/pizazz-1-3-0/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 21:57:05 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[deprioritized]]></category>
		<category><![CDATA[pizazz]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=193</guid>
		<description><![CDATA[A new version of Pizazz is out, and it&#8217;s about time! I&#8217;ve been delaying this for quite awhile. I&#8217;ve added two requested features. The first one was requested a long time ago, but I deprioritized it because the person had edited <a class="more-link" href="http://entertainingsoftware.com/2013/03/13/pizazz-1-3-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>A new version of <a title="Pizazz" href="http://entertainingsoftware.com/wordpress/pizazz/">Pizazz</a> is out, and it&#8217;s about time! I&#8217;ve been delaying this for quite awhile. I&#8217;ve added two requested features.</p>
<p>The first one was requested a <em>long</em> time ago, but I deprioritized it because the person had edited a few lines of code and got a workable result. What he wanted was for Pizazz to support selection between Zazzle&#8217;s target countries. This is used when querying price information to figure out the units by locality. I&#8217;ve added a global setting, and now you can display your stores in Yen and Monopoly Money (Canadian dollars)!</p>
<p>The other feature is just a checkbox/shortcode option: the ability to hide the &#8220;See More&#8221; button. I have few guesses as to why exactly someone would want to do this (perhaps if everything&#8217;s already visible in their site?), but it was requested and required very little modification to the code base. Of course, &#8220;See More&#8221; will remain visible by default.</p>
<p>So that&#8217;s that. I&#8217;ve also verified that it works with the newest WordPress (3.5.1 as of March 13, 2013), and that&#8217;s always good. The update isn&#8217;t vital unless you need those new features, as there are no outstanding bugs that had to be fixed.</p>
<p>Before I go, I would like to give out a little <strong>PSA</strong>. If you get a message saying that the &#8220;query did not return any products,&#8221; it means that there is literally nothing with the keywords you specified (or, at least, not in your store if you filled in that field). You can verify this by searching Zazzle with the same keywords. If Zazzle pops up with something anyway, then something went horribly wrong. The most likely scenario is that their RSS feeds are down (which happens surprisingly often), but if it persists for more than a few hours than there might be a bug in Pizazz. If so, don&#8217;t hesitate to contact me!</p>
<p><a href="http://downloads.wordpress.org/plugin/pizazz.1.3.0.zip">Download the latest version from WordPress.org.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2013/03/13/pizazz-1-3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Menus</title>
		<link>http://entertainingsoftware.com/2013/02/18/menus/</link>
		<comments>http://entertainingsoftware.com/2013/02/18/menus/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 18:00:16 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=188</guid>
		<description><![CDATA[When I say menus, I don&#8217;t mean restaurant menus. I mean the thing you see after the company&#8217;s logo when you play a video game. The first project I&#8217;m working on for CANINE is a menu system, and I&#8217;ve been <a class="more-link" href="http://entertainingsoftware.com/2013/02/18/menus/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>When I say menus, I don&#8217;t mean restaurant menus. I mean the thing you see after the company&#8217;s logo when you play a video game. The first project I&#8217;m working on for CANINE is a menu system, and I&#8217;ve been trying to make time to develop it. Sadly, there are always other things that have to be done. Actually, I got a working basis for the system the day after I made my <a title="CANINE Engine Revisted" href="http://entertainingsoftware.com/2013/02/05/canine-engine-revisted/">original post about it</a>, but it&#8217;s only now that I can write a progress report.</p>
<p>I abandoned the FLTK-style array-based menu definition for something a bit more flexible. I instead based it off the Syslinux bootloader&#8217;s way of doing it, which is declaring the menus like a series of function calls. My implementation is quite a bit different, of course, but it still fits the bill. I chose this design over the previous system because I thought it would make it much easier to bind to other programming languages, or to allow people to load their menu definitions from scripts and data files.</p>
<p>Declaring a menu looks something like this:</p>
<pre>JEWEL_MENU *menu = jewel_create_menu(my_awesome_font);
jewel_add_inform(menu, "Are you sure you would like to quit? All progress will be lost!");
jewel_add_button(menu, "Yes", &amp;quit_yes_clicked);
jewel_add_button(menu, "No", &amp;quit_no_clicked);</pre>
<p>That displays a black-and-white menu with a question and two options. You can navigate the options using the arrow keys and select one pressing either enter or space. It&#8217;s looking pretty good!</p>
<p>The next thing I want to do is add a toggle button and slider. Afterwards, sub-menus will be top priority. One of the primary reasons I wanted to write a library was to handle this.</p>
<p>Lastly will be themes. Currently, you can set the font for text and it will adjust dimensions appropriately, but I want to implement configurations for back/foreground color, margins, and padding. Even more, I want to have controls able to specify classes like in CSS so you can style them differently (e.g. to make the aforementioned &#8220;Yes&#8221; button more impending).</p>
<p>Code cleanup is also on the list. I&#8217;m considering obliterating all of the asserts in the library and having any and all errors just return error codes. I&#8217;d rather programmers be able to display error dialogs then to have sudden crashes and weird 0x0000F82A-type messages.</p>
<p>For now I&#8217;m uploading the source code as Alpha-1. I hereby place it under the GNU General Public License version 3 or later. Feel free to play around with it! (Note: only tested on the 64-bit Arch Linux GNU/Linux distribution. Requires Allegro 5.x, tested with 5.0.8.)</p>
<ul>
<li><a href="https://dl.dropbox.com/u/94060754/jewel-alpha1.tar.xz">Jewel Alpha-1</a></li>
<li><a href="http://www.liballeg.org/" target="_blank">Allegro 5.x</a></li>
<li><a href="http://www.archlinux.org/" target="_blank">Arch Linux</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2013/02/18/menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CANINE Engine Revisted</title>
		<link>http://entertainingsoftware.com/2013/02/05/canine-engine-revisted/</link>
		<comments>http://entertainingsoftware.com/2013/02/05/canine-engine-revisted/#comments</comments>
		<pubDate>Wed, 06 Feb 2013 03:39:10 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[canine]]></category>
		<category><![CDATA[compilers]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=177</guid>
		<description><![CDATA[Lo and behold, I have returned! More than just to my blog, though. I&#8217;m revisiting the CANINE engine, a Wolfenstein-3D-style game engine that I said I was going to focus on and then forgot about! Sadly, more important things came <a class="more-link" href="http://entertainingsoftware.com/2013/02/05/canine-engine-revisted/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Lo and behold, I have returned!</p>
<p>More than just to my blog, though. I&#8217;m revisiting the CANINE engine, a Wolfenstein-3D-style game engine that I said I was going to focus on and then forgot about! Sadly, more important things came up and it got pushed too far back. I am really interested in getting this game done, because I really like the retro feel it gave off.</p>
<p>Its current status is less than optimal. There is a working C++/Allegro5 code base that looks like what I had shown in my last video, but with a cruddy attempt at a skybox and support for see-through grates. I forked it to add Google V8 JavaScript to it, but V8 ended up feeling too bulky and I couldn&#8217;t think of a good way to integrate it into the engine. Largely, this was caused by the engine&#8217;s poor design. The raycaster&#8217;s great, the renderer&#8217;s great-ish, the resource management is where things broke down.</p>
<p>I started managing resources in a way that is just too complicated. Unsigned 8-bit integers (usually represented as ASCII printable characters) map resources in a palette which the level associates with itself. The renderer pulls textures from it, but it&#8217;s even more complicated than that. The palette doesn&#8217;t actually manage resources, it stores a table of identifier-filename pairs, and gets the bitmaps for each request from a dedicated resource manager. The resource manager stores data in filename-pointer pairs and handles loading automatically.</p>
<p>This entire architecture makes me sad and I can&#8217;t go on with it. Instead, I&#8217;m going to rewrite the engine. Yes, for a third time, but read on! This time I&#8217;m going to plan things out, and I&#8217;m making the process public.</p>
<p>I&#8217;ve decided to release CANINE as free/libre and open source software under the GNU General Public License. This means it will grant you the right to run CANINE for any purpose, modify it and redistribute original/modified versions (even commercially). All that the license requires is that you share these rights with anyone you redistribute CANINE, and any modifications, to.</p>
<p>Initially I&#8217;m going to do is upload the three editions I have. First is Alpha-1, which is written in C and supports a basic textured environment. Next is Alpha-2, a rewrite in C++ that supports the weird palette-resource system, skyboxes and transparency in walls. Lastly is Alpha-2J, which sports some initial bindings to JavaScript.</p>
<ul>
<li><a href="https://dl.dropbox.com/u/94060754/canine-alpha1.tar.xz">Alpha-1</a></li>
<li><a href="https://dl.dropbox.com/u/94060754/canine-alpha2.tar.xz">Alpha-2</a></li>
<li><a href="https://dl.dropbox.com/u/94060754/canine-alpha2js.tar.xz">Alpha-2JS</a></li>
</ul>
<p>My plan for the next version is to write a few libraries and run some tests before writing the main game. I believe the project modularity will help me create a clean system: each project is created and maintained separately, allowing each one to be completed individually so that the final product requires little work in comparison.</p>
<p>The first library, codename &#8220;Jewel,&#8221; will provide a simple menu engine in C built on top of the Allegro game programming library. The idea is to design the entire menu as one multidimensional array with callback support. Here&#8217;s an example of what I have in mind:</p>
<pre>static const MENU *game_menu = {
   { MENU_BUTTON, "Start", &amp;start_game },
   { MENU_SUBMENU, "Options", NULL },
      { MENU_SUBMENU, "Video", NULL },
         { MENU_TOGGLE, "Fullscreen?", &amp;set_fullscreen },
         { MENU_TOGGLE, "Blood/Gore?", &amp;set_blood_gore },
         { MENU_END, NULL, NULL },
      { MENU_SUBMENU, "Audio", NULL },
         { MENU_SLIDER, "Music Volume", &amp;set_music_volume },
         { MENU_SLIDER, "Sfx Volume", &amp;set_sfx_volume },
         { MENU_END, NULL, NULL },
      { MENU_END, NULL, NULL },
   { MENU_SUBMENU, "Quit", NULL },
      { MENU_MESSAGE, "Are you sure you want to quit?", NULL },
      { MENU_BUTTON, "Yes", &amp;quit_game },
      { MENU_BACK, "No", NULL },
      { MENU_END, NULL, NULL },
   { MENU_END, NULL, NULL }
};</pre>
<p>Inspired by the Fast Light Toolkit&#8217;s menu system, I believe it&#8217;s easy for people to work with and allows for a really lightweight implementation. We&#8217;ll see how it goes.</p>
<p>Afterwards will be a scripting language, codename &#8220;Orange.&#8221; What held me up in each version of CANINE was trying to figure out a good way to implement scripting. In CANINE Alpha-1 it lead me to believe the design was flawed. In CANINE Alpha-2 the primary problem was my inability to select a language.</p>
<p>I have a problem with pretty much every language I encountered. Squirrel&#8217;s too slow, AngleScript doesn&#8217;t have enough documentation of the actual language, Pawn doesn&#8217;t compile on 64-bit GNU/Linux, TinyScheme is also slow, GameMonkey makes me feel like I&#8217;m downloading a virus, PSL&#8217;s design just doesn&#8217;t fit, and Lua is insecure. There&#8217;s some cross-over there, but I just listed my major grievances with each one. GameMonkey could fair well with a better website.</p>
<p>For this reason, I&#8217;m going to implement my own scripting language. I&#8217;m going to keep it small and simple, considering it&#8217;s going to be my first implementation of a programming language since my Tiny BASIC compiler. I&#8217;m shooting for a bit of a combo between PSL (PLIB Scripting Language/Library) and Dink-C (from the anti-hit title Dink Smallwood). The language will be a dumbed-down version of C designed for an event-driven game engine. All that I&#8217;ll implement in the beginning is file-level globals, int/float/const-string variables, int/float arithmetic, public/private functions and the if-statement.</p>
<p>That&#8217;s right. The if-statement. Not for, not while, not do-while. For the stuff I&#8217;m starting out with, I won&#8217;t need loops. Eventually I will implement them, but I want to get something working first.</p>
<p>The idea is that each script defines handlers for an object. For instance, the &#8220;zombie.script&#8221; file will define the &#8220;update&#8221; function to handle its movement each loop and the &#8220;collision_bullet&#8221; function to handle getting shot. The point of the public/private function system is to allow me to add as many callbacks as I want over time without worrying about accidentally calling a private helper function from older scripts that just so happens to have the same name.</p>
<p>The compiler will be separate from the virtual machine so that game loading won&#8217;t be affected by compilation efficiency. I&#8217;m still pretty n00b at compilers so I don&#8217;t want to have to worry about that. Scripts will be stored in a portable, CPU-independent format so that you won&#8217;t have to worry about switching between 32/64-bit and big/little-endian machines.</p>
<p>The last thing I&#8217;m going to do is write a little client-server chat program and experiment with the networking libraries out there. Why? I think it&#8217;d be cool if CANINE had multiplayer support, because playing against friends (or enemies, really) is fun. The Enet library is looking particularly enticing&#8230; more on that later.</p>
<p>Throughout this process, I&#8217;m going to try and blog as much as possible (without overdoing it). I believe that talking about it constantly will help me stay focused on the project(s). Of course, I&#8217;ll still have normal work to do, but I&#8217;ll make time.</p>
<p>That&#8217;s all I have to say. Noch guten tag!</p>
<p><strong>More information</strong></p>
<ul>
<li>The last post I had on CANINE</li>
<li><a href="http://plib.sourceforge.net/psl/prog_guide.html" target="_blank">PSL </a>and <a href="http://www.dinknetwork.com/file/dinkc_reference/" target="_blank">Dink-C</a>, so you have an idea of what I&#8217;m thinking about</li>
<li><a href="http://enet.bespin.org/" target="_blank">Enet</a>, same reason as above</li>
<li><a href="http://translate.google.com/#de/en/Noch%20guten%20tag!" target="_blank">Google Translate</a>, to figure out what that last thing I said was</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2013/02/05/canine-engine-revisted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website Design and jQuery</title>
		<link>http://entertainingsoftware.com/2013/01/09/website-design-and-jquery/</link>
		<comments>http://entertainingsoftware.com/2013/01/09/website-design-and-jquery/#comments</comments>
		<pubDate>Wed, 09 Jan 2013 23:54:54 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=162</guid>
		<description><![CDATA[Notice: I wrote this a few weeks ago, but didn&#8217;t have the time to edit it. Then I forgot about it&#8230; but now its here! Also, I replayed Mass Effect 2 and finished 3. Hello again, readers! I just finished replaying Mass <a class="more-link" href="http://entertainingsoftware.com/2013/01/09/website-design-and-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><em>Notice: I wrote this a few weeks ago, but didn&#8217;t have the time to edit it. Then I forgot about it&#8230; but now its here</em>!</p>
<p><em>Also, I replayed Mass Effect 2 and finished 3.</em></p>
<p>Hello again, readers! I just finished replaying Mass Effect and decided that it is time to write a new article.</p>
<p>Over the weekend I designed and implemented a WordPress theme for a friend of mine from the Secret Maryo Chronicles project. I know him as MrVertigo27, but others call him Spitfire25565. He has a YouTube channel full of tutorials and Let&#8217;s Plays of Minecraft and its plethora of mods. They are pretty cool and you can go check them out &#8212; but I will not give you the link until you finish reading! =P</p>
<p>All of his videos are coagulated into a group called GameMode5. GM5 focuses on reviewing and rating Minecraft-related technologies, particularly mods. This ranges from minor mods such as Hack/Mine, which mostly just modifies gameplay, to the Aether mod, which creates an entirely new sub-world (like the Nether).</p>
<p>Despite all of the videos under the GM5 name, however, their website spent several months as an unconfigured, content-less Joomla! installation. After awhile, that kind of thing starts to get on my nerves, and I finally broke down and offered to build his website for him (a similar event to when I wrote the GNU FreeDink website theme).</p>
<p>He happily agreed, and even gave me complete creative control. This allowed me to play with it a lot, though it also required me to think more carefully &#8212; I wanted to make sure that he would still like it.</p>
<p>I replaced Joomla! with the more popular WordPress content management system and got to work on a draft, which I then converted into a dynamic theme. The end result, for reference, is here: <a href="http://gamemode5.com/">http://gamemode5.com/</a>.</p>
<div id="attachment_173" class="wp-caption aligncenter" style="width: 610px"><a href="http://gamemode5.com/"><img class="size-full wp-image-173" alt="GameMode5 Theme" src="http://entertainingsoftware.com/wp-content/uploads/2013/01/gm5screenshot.jpg" width="600" height="388" /></a><p class="wp-caption-text">A screenshot of the GameMode5 theme I wrote.</p></div>
<p>The first thing I did was create the logo. Using the powerful GNU Image Manipulation Program (GIMP), this task was fairly straight-forward. The first thing I did was place, in big, bold letters, &#8220;GameMode5.&#8221; I used the free and open font Orbitron to make it look nice and video-gamey. The letters were a bit too close together, so I increased the &#8220;kerning&#8221; (inter-character spacing) until the text fit across the whole screen.</p>
<p>The next thing I did was create a drop-shadow using one of the GIMP&#8217;s filters. I played with a few depths until I settled on 5&#215;5 with a bright grey coloration. This was pretty cool, but it was missing something. So, I ran through this algorithm:</p>
<pre> 10  LET F = FIRST FILTER
 20  APPLY FILTER F
 30  IF IMAGE LOOKS COOL THEN GOTO 60 ELSE GOTO 40
 40  UNDO FILTER
 50  GOTO 70
 60  TINKER WITH FILTER SETTINGS
 70  IF MORE FILTERS THEN GOTO 80 ELSE GOTO 100
 80  LET F = NEXT FILTER
 90  GOTO 20
100  EXIT</pre>
<p>This algorithm resulted in just one filter, &#8220;Erase Every Other Line,&#8221; which looked pretty frelling cool. I then applied the same filter to the drop-shadow. It occurred to me that it might look better to erase every odd line instead of every even line of the drop-shadow, so I tried that, too. I preferred the later because it made the text glow more.</p>
<p>After that I just put a little green motto line beneath it and called it done. This end result is what you see now.</p>
<p>The next thing I did was create the web page layout, consisting of a header, content area, sidebar and copyright footer. I aligned them using some pretty CSS3 and divs. You can do a lot by setting fixed widths and the &#8220;float&#8221; attribute. For instance, the middle area is just:</p>
<pre>div#sidebar {
  width: 200px;
  float: right;
}

div#content {
  width: 595px;
}</pre>
<p>I decided on fixed width because I really wanted to show off the background, which I wanted to be tiles from Minecraft itself. However, I wanted to website to be dark since I felt it fit the mood better (note that I always find myself in the most horrific circumstances in this game &#8212; being ganged up on by skeletons, surprise-attacked by three creepers in a row, falling into lava when I was standing still&#8230;). So, I decided to use GIMP&#8217;s wonderful Colorize tool to darken the original tile set.</p>
<p>I chose the stone because, well, stone&#8217;s awesome. Do not even try to deny it: stone is the best block in Minecraft. Ever. Everything should be built out of stone. Cobblestone is evil. Cobblestone must die. Why do the creepers only go after my stone?!?!?! \(O_O)/</p>
<p>Ahem. So, I placed all of these in the background and made a conclusion: it was super boring. To spice it up, I placed a few gold ores around. A few CSS tweaks later, along with a nice Lorem Ipsum example text, and I decided to show MrV what I had done.</p>
<p>He liked it (=D) but made one request. He wanted to know if I could randomize the ores in the background. Lo and behold, it is time for every web developers greatest tool and worst nightmare. JavaScript.</p>
<p>It took a bit of time, largely because I tend to forget the names of the JavaScript functions, but I eventually succeeded. The algorithm is pretty cool; I split the screen into individual, 64&#215;64 tiles and iterate through them. In each tile, I randomly decide if there&#8217;s going to be an ore there. If there is, then I randomly select which ore it is.</p>
<p>Leaving it there, though, is not really in the spirit of Minecraft. In Minecraft ores only appear at certain levels, encouraging you to go deeper to find the more important valuable resources. Well, it took quite a bit of tinkering, but I got something very nice.</p>
<p>Between regions 1 and 5, there is a 50-50 shot of the cell either being coal or iron. Between 5 and 10, it becomes an even statistical split between coal, gold and iron. Lastly, anywhere past ten it turns into an equal chance of either diamond or redstone. This can be simplified into the following JavaScript:</p>
<pre>if (y &gt; 10) {
  switch (Math.floor(Math.random() * 2)) {
    case 0: /* redstone */; break;
    case 1: /* diamond  */; break;
  }
}
else {
  switch (Math.floor(Math.random() * (y &gt; 5 ? 3 : 2))) {
    case 0: /* coal     */; break;
    case 1: /* iron     */; break;
    case 2: /* gold     */; break;
  }
}</pre>
<p>Beautiful, eh? Took quite a while to figure out where to put the parenthesis in the ternary (A&gt;B?C:D) statement, but the end result works like a charm!</p>
<p>Of course, there&#8217;s the question of how I got the images back there, anyway. Well, all I did was insert an absolute-positioned image-div with a negative z-index after the ending copyright statement. The web browser, assuming it understands CSS properly (which all modern browsers do) will position them exactly where they are needed.</p>
<p>That basically sums it up, but there&#8217;s one last thing that I want to mention. It is a library called jQuery, without which I would have been driven insane writing this simple program. jQuery lets me do stuff like get the dimensions of the document area and insert elements without having to deal with the constant browser quirks and incompatibilities. On my own I would have needed to write this to get the document width:</p>
<pre>function getWidth()
{
  if (typeof (window.innerWidth) == 'number') {
    /* most web browsers (but not all of them
       or all versions) */
    return window.innerWidth;
  } else if (document.documentElement
             &amp;&amp; (document.documentElement.clientWidth
                 || document.documentElement.clientHeight)) {
    /* internet explorer version six and later
       in standards mode */
    return document.documentElement.clientWidth;
  } else if (document.body &amp;&amp; (document.body.clientWidth
                               || document.body.clientHeight)) {
    /* internet explorer version four */
    return document.body.clientWidth;
  }
}</pre>
<p>&#8230;and that is the simplest version of this code I could find. However, which jQuery all I have to say is:</p>
<pre>$(document).width</pre>
<p>&#8230;and this works in Internet Explorer, Firefox, Chromium and even Opera!</p>
<p>The key to jQuery is the <code>$()</code> function, which functions sort of as a more powerful <code>document.getElementById()</code> which can also accept the <code>document</code> and <code>window</code> objects, plus CSS identifiers and HTML code. The later usage is how I inserted the background divs:</p>
<pre>$('&lt;div&gt;blah blah blah&lt;/div&gt;').insertAfter('div#copyright');</pre>
<p>jQuery makes JavaScript coding super easy and its generously licensed under the super-liberal, free and open source MIT/X11 license, which essentially means you can do whatever you want with it as long as you do not remove the copyright notice(s).</p>
<p>They also have a really cool user interface library which I used in an <a href="https://github.com/Luiji/George" target="_blank">older project</a> to make a draggable window within the page. jQuery&#8217;s a life saver, and I definitely recommend you check it out.</p>
<p><strong>Links</strong></p>
<ul>
<li><a href="http://gamemode5.com/" target="_blank">GameMode5</a>: the website that I developed the theme for</li>
<li><a href="http://www.theleagueofmoveabletype.com/orbitron" target="_blank">Orbitron</a>: the free and open font that I used in the logo</li>
<li><a href="http://jquery.com/" target="_blank">jQuery</a>: the library I mentioned</li>
<li><a href="http://www.gimp.org/" target="_blank">GIMP</a>: the tool I used to create the logo</li>
<li><a href="http://gamemode5.com/wp-content/themes/gamemode5/fancy-background.js" target="_blank">fancy-background.js</a>: the script I wrote to manage the background ores</li>
<li><a href="https://www.youtube.com/Spitfire25565" target="_blank">Mr. Vertigo&#8217;s YouTube Channel</a>: since I promised you a link earlier =)</li>
</ul>
<p><strong>License Notice</strong></p>
<p>I wrote the theme and JavaScript code for GameMode5, so I am letting them decide how they want to license this stuff. The Fancy Background script should be used for reference, only.</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2013/01/09/website-design-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boredom, Chemistry and Rolos</title>
		<link>http://entertainingsoftware.com/2012/11/30/boredom-chemistry-and-rolos/</link>
		<comments>http://entertainingsoftware.com/2012/11/30/boredom-chemistry-and-rolos/#comments</comments>
		<pubDate>Sat, 01 Dec 2012 01:24:44 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chemistry]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=153</guid>
		<description><![CDATA[I am not precisely sure why, but I have gone in a downward spiral of boredom the past two weeks. It is not like I do not have things to do, but for some reason they all seem dull. As <a class="more-link" href="http://entertainingsoftware.com/2012/11/30/boredom-chemistry-and-rolos/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I am not precisely sure why, but I have gone in a downward spiral of boredom the past two weeks. It is not like I do not have things to do, but for some reason they all seem dull. As such, I have started getting back into things that I got out of, i.e. blogging. I have now found myself here typing this text.</p>
<p>Let us start out with a status update: what I have been doing since the last time I posted.</p>
<p>I have spent most of my time advancing my knowledge in chemistry, reading up on philosophy, expanding my background in the history of software development, learning conversational German (Bedingung, ich hätte gern die Suppe als vorspeise, bitte!) and, more recently, studying the field of psychology. With all this going on, I have largely forgot about actually programming anything.</p>
<p>Since the holidays are rolling in, and hence the candy, I started thinking about Rolos. They say that you can &#8220;role a Rolo to a friend,&#8221; though the very design of the chocolate implies that you must compensate for the unavoidable curved path it will take. I decided to search for a precise equation for the number of degrees you would have to rotate your fist to role a Rolo to someone X meters away from you.</p>
<p><div id="attachment_157" class="wp-caption alignright" style="width: 275px"><img class=" wp-image-157  " alt="[Various Rolos]" src="http://www.zetaportal.com/entertainingsoftware/wp-content/uploads/2012/11/rolo-candies-us.jpg" height="234" width="265" /><p class="wp-caption-text">&#8220;You can roll a rolo to a friend!&#8221;</p></div>As it turns out, rolling a rolo at any angle will cause it to make a sharp curve that stops it a few centimeters away from your hand. This tells me one thing, the Hershey Company has lied to me (yes, I know Nestlé made Rolos, but in the United States Hershey is under license). I later realized that in the commericals they were rolling entire packs, but then should they not say &#8220;role a pack of rolos to a friend?&#8221; I thought this was disappointing enough of a conclusion that I decided to write about something else, like chemistry.</p>
<p>Chemistry is a beautiful subject. The study of atomic interactions is fascinating, but the real beauty is in the mathematical bit. Specifically, I speak of stoichiometry, the wonderful subject of converting from one unit to another. It is amazing how much you can gleam from this simple concept. For instance, let us take this everyday equation:</p>
<p>2 Bread + 1 Cheese → 1 Sandwich</p>
<p>Albeit this is not what you normally see in chemistry, but it is a really great example that I have been taught. Now, in the pantry you have 14 pieces of bread and 8 pieces of cheese. The question is, which one of these ingredients limits how many sandwiches you can make. In chemistry, this value is known as the &#8220;limiting reactant&#8221; or the &#8220;limiting reagent.&#8221;</p>
<p>This is really simple to discover just by simple conversion (stoichiometry) and comparison. First, we must find how many sandwiches we could make from the bread if we had unlimited cheese:</p>
<p>(14 Bread) × (1 Sandwich ÷ 2 Bread) = 7 Sandwiches</p>
<p><div id="attachment_158" class="wp-caption alignleft" style="width: 208px"><img class=" wp-image-158    " alt="[Grilled Cheese]" src="http://www.zetaportal.com/entertainingsoftware/wp-content/uploads/2012/11/grilled_cheese_with_soup.jpg" height="170" width="198" /><p class="wp-caption-text">Grilled Cheese! =D</p></div>What we did here is convert from units of bread (14) to units of sandwiches (7). We did this by multiplying the amount of bread by the ratio of sandwiches to bread (1 Sandwich / 2 Bread). By doing so, we end up with [(14 Bread * 1 Sandwich) / 2 Bread). The unit "Bread" is then cancelled out by the division and results in ([14 * 1 Sandwich] / 2) which gives us 7 Sandwiches. The most important thing in stoichiometry is to keep the units, otherwise this type of solution is unusable.</p>
<p>Next, we do the same thing with limited cheese and unlimited bread:</p>
<p>(8 Cheese) × (1 Sandwich ÷ 1 Cheese) = 8 Sandwiches</p>
<p>As you can see, 14 Bread only gives us 7 Sandwiches, while 8 Cheese gives us 8 Sandwiches. Therefore, since our resources are limited this way, we can only make 7 Sandwiches, and therefore Bread is the limiting reagent.</p>
<p>Fascinating, is it not? Now, let us take a simple example using an actual chemical equation:</p>
<p>H<sub>2</sub> + O<sub>2</sub> → H<sub>2</sub>O</p>
<p>Wait, but there is a problem. If you look carefully, the first half of the equation has two hydrogen atoms and two oxygen atoms, but the second half has two hydrogen atoms and only <em>one oxygen atom</em>! This means that we have to balance the equation by prefixing the molecules (note: not the individual atoms) with a coefficient to make everything equal.</p>
<p><strong>2</strong>H<sub>2</sub> + O<sub>2</sub> → <strong>2</strong>H<sub>2</sub>O</p>
<p>There, now the amount of atoms is equal on both sides. Given 50 moles of hydrogen and 100 grams of oxygen, we must find the limiting reagent. The problem here is that we are given oxygen in grams, but limiting reagents in chemistry require everything to be in moles. The &#8220;mole&#8221; corresponds to approximately 6.022 × 10<sup>23</sup> entities (in this case, molecules). The equation above could be read as &#8220;Two moles of dihydrogen plus one mole of dioxygen reacts to form two moles of water.&#8221;</p>
<p>To convert from grams to moles, me must first remember that moles are specific to the molecule they are linked with. In the case of hydrogen, there are 50 mol H<sub>2</sub> (moles of dihydrogen). This is <em>not</em> the same as 50 mol O<sub>2</sub> (moles of dioxygen). Given this, to convert from grams of a molecule to moles, you must divide the amount of grams by the molar mass of the molecule. The molar mass (measured in g/mol or &#8220;grams per mole&#8221;) is found by adding the molar mass of its atoms (given on the periodic table). In this case, the molar mass of oxygen is approximately 2 × 16 g/mol, giving dioxygen a mass of 32 g/mol. Hence,</p>
<p>100 g O<sub>2</sub> ÷ 32 g/mol = 3.125 mol O<sub>2</sub></p>
<p>Now, we can apply the bread-and-cheese!</p>
<p>50 mol H<sub>2</sub> × (2 mol H<sub>2</sub>O ÷ 2 mol H<sub>2</sub>) = 50 mol H<sub>2</sub>O</p>
<p>3.125 mol O<sub>2</sub> × (2 mol H<sub>2</sub>O ÷ 1 mol O<sub>2</sub>) = 6.25 mol H<sub>2</sub>O</p>
<p>Thus, we have discovered that oxygen is the limiting reagent. The difference is so large because one oxygen atom is about sixteen times the size of a hydrogen atom. For example, if you had a tank, you could fit sixteen times more hydrogen atoms than oxygen atoms into it.</p>
<p>I was going to end this post with the text &#8220;Voila! Simple, is it not?&#8221; but then I remembered that the first time I saw this I had a mental heart attack. Instead, I say good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2012/11/30/boredom-chemistry-and-rolos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pizazz 1.2.0</title>
		<link>http://entertainingsoftware.com/2012/09/27/pizazz-1-2-0/</link>
		<comments>http://entertainingsoftware.com/2012/09/27/pizazz-1-2-0/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 18:53:09 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[pizazz]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=141</guid>
		<description><![CDATA[Hey there! Long time no type. How&#8217;s it been going with you? It&#8217;s time for a new release of Pizazz. I&#8217;ve been distracted lately, so a lot of these improvements are overdo. Let&#8217;s see&#8230; I added a new shortcode that allows <a class="more-link" href="http://entertainingsoftware.com/2012/09/27/pizazz-1-2-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Hey there! Long time no type. How&#8217;s it been going with you? It&#8217;s time for a new release of <a title="Pizazz" href="http://entertainingsoftware.com/wordpress/pizazz/">Pizazz</a>. I&#8217;ve been distracted lately, so a lot of these improvements are overdo. Let&#8217;s see&#8230;</p>
<p>I added a new shortcode that allows you to embed Pizazz into your posts and pages, which will allow you to make store pages and advertise your products where they&#8217;re relevant. Are you blogging about asparagus? Then why not embed a Pizazz product feed with a bunch of asparagus T-shifts and mugs? Just type in <code>[pizazz store=asparagus rows=8 columns=3]</code> into your post and you&#8217;re ready to go! For the full documentation on Pizazz&#8217;s shortcodes, go to <code>Settings-&gt;Pizazz</code> and scroll down.</p>
<p>There is also a few more customizations. You can now change the alignment of text or just make it disappear and links can be made to open in new windows <em>and</em> the prices can be displayed right next to your products! This should give you a bit more flexibility while designing your website.</p>
<p>Lastly, the associate ID used to get referrals has been moved from the widget properties into <code>Settings-&gt;Pizazz</code>. I was worried that people would have to copy and paste their ID into all of their shortcodes and it would become too difficult to maintain. A dialog box will appear at the top of your administrative control panel after the update to remind you, so don&#8217;t fret!</p>
<p>The new release is up at the <a href="http://wordpress.org/extend/plugins/pizazz/">WordPress plugin repository</a>. I recommend you update and check out these cool new features. Tell me what you think in the comments below and if you need help, check out the support area at <a href="http://wordpress.org/support/plugin/pizazz">WordPress</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2012/09/27/pizazz-1-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tiny BASIC Compiler</title>
		<link>http://entertainingsoftware.com/2012/09/12/tiny-basic-compiler/</link>
		<comments>http://entertainingsoftware.com/2012/09/12/tiny-basic-compiler/#comments</comments>
		<pubDate>Wed, 12 Sep 2012 06:11:00 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[experimentation]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=135</guid>
		<description><![CDATA[I wrote my first compiler! A few weeks ago, actually&#8230; I&#8217;ve been procrastinating this blog post because I haven&#8217;t been too sure what to say on the subject. It&#8217;s a very simple compiler that takes Tiny BASIC code and outputs <a class="more-link" href="http://entertainingsoftware.com/2012/09/12/tiny-basic-compiler/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I wrote my first compiler! A few weeks ago, actually&#8230; I&#8217;ve been procrastinating this blog post because I haven&#8217;t been too sure what to say on the subject. It&#8217;s a very simple compiler that takes Tiny BASIC code and outputs NASM Assembler that can be compiled into MS-DOS/FreeDOS executables.</p>
<p>TinyBASIC is a simple microcontroller language from back in the days where 4K was a normal amount of RAM. It was popular because it could fit in 3K and still run your reasonably useful programs. It looks like this:</p>
<p><code><br />
REM FIBONACCI SEQUENCE GENERATOR<br />
REM RELEASED INTO THE PUBLIC DOMAIN</code></p>
<p>REM SETUP THE VARIABLES &#8212; COUNTER, CURRENT VALUE AND LAST VALUE<br />
10 LET I = 0<br />
20 LET X = 1<br />
30 LET Y = 0</p>
<p>REM DISPLAY THE CURRENT ITERATION AND VALUE<br />
40 PRINT &#8220;FIB: &#8220;; I, X</p>
<p>REM ADD THE LAST VALUE TO THE CURRENT VALUE WHILE SAVING THE CURRENT VALUE<br />
REM AS THE NEW LAST VALUE<br />
50 LET Z = X<br />
60 LET X = X + Y<br />
70 LET Y = Z</p>
<p>REM INCREMENTING THE ITERATOR AND ABORTING WHEN IT&#8217;S TIME<br />
80 LET I = I + 1<br />
90 IF I &lt;= 10 GOTO 40</p>
<p>Pretty neat, eh? It&#8217;s actually pretty easy to parse when you get in the hang of things. I read the first few chapters in Jack Crenshaw&#8217;s tutorial on compilers, <em>Let&#8217;s Build a Compiler</em> to get a basic expression parser running and did the rest on my own. Now, that code above compiles and runs perfectly!</p>
<p>The most important thing I learned from this, after all my previous attempts at writing compilers, is that parser generators are time-wasters from the depths of hell. It takes me three hours to set up something that looks like it might parse the code &#8212; not compile, but parse &#8212; that throws constant errors while I got a few working statements from my hand-written compiler in one.</p>
<p>The resulting code is much cleaner, too, because you don&#8217;t have a parser generator putting in tons of impossible-to-read tables and includes that it shouldn&#8217;t even need (Bison WTF is wrong with you?). LALR parsers, from what I understand, are the primary output of most of these parser generators. They seem to have a reputation for being almost unreadable and unwritable by human beings, and I have yet to find an upside to them other than that they are memory-efficient compared to some of the alternative results of parser generators. At the same time, I only use a few global integers in my compiler, and the code is smaller&#8230; especially considering that the compiler includes both a scanner and parser in the same code set.</p>
<p>I also found that writing the compiler by hand was much more enjoyable as immediate results were faster to procure and having full control and responsibility for the code felt more challenging. Considering I&#8217;m primarily a hobbyist, challenge is one of the most important parts of anything I do.</p>
<p>I targeted MS-DOS/FreeDOS because it has what is quite possibly the cleanest and simplest system call table that I&#8217;ve ever encountered (in other words, it was really easy to target). I used DosBox to emulate the MS-DOS kernel on my GNU/Linux machine. By request of a friend of mine, I tested my compiler on Windows and found that the resulting executables ran natively. Now that&#8217;s backwards compatibility!</p>
<p>All in all the project was pretty fun and the result was a neat little toy. This new skill should come in handy when it comes time to implement scripting into one of my game projects. Lua is for babies!</p>
<p>The source code is available online under the GNU General Public License version 3 or later. Leave a note in the comments if it helps you figure out how compilers work! If you are really interested in writing your own compiler, I highly recommend Jack Crenshaw&#8217;s tutorial. It&#8217;s very helpful and spans over topics from expression parsing to interpreters.</p>
<ul>
<li><a href="https://github.com/Luiji/TinyBASIC-C" target="_blank">TinyBASIC-C at GitHub</a></li>
<li><em><a href="http://compilers.iecc.com/crenshaw/" target="_blank">Let&#8217;s Build a Compiler</a></em></li>
<li><a href="http://www.ittybittycomputers.com/IttyBitty/TinyBasic/TBuserMan.htm" target="_blank">More on TinyBASIC</a></li>
<li><a href="http://www.nasm.us/" target="_blank">NASM</a>/<a href="http://yasm.tortall.net/" target="_blank">YASM</a> (required to build the results of Tiny BASIC all the way to binary format)</li>
<li><a href="http://www.dosbox.com/" target="_blank">DosBox</a> (for people who want to try out the compiler on GNU/Linux)</li>
<li><a href="http://en.wikipedia.org/wiki/LALR_parser" target="_blank">Wikipedia Entry on LALR Parsers</a></li>
</ul>
<p><strong>Stay tuned: I&#8217;m doing some finishing touches on a new release of Pizazz and have been doing some behind-the-scenes work on CANINE!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2012/09/12/tiny-basic-compiler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pizazz 1.1.1 Released</title>
		<link>http://entertainingsoftware.com/2012/08/28/pizazz-1-1-1-released/</link>
		<comments>http://entertainingsoftware.com/2012/08/28/pizazz-1-1-1-released/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 23:28:25 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[pizazz]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=128</guid>
		<description><![CDATA[Ah&#8230;the feeling of fixing bugs. It&#8217;s very satisfying, but not as satisfying as releasing those fixes to the world. Now is one of those wonderful times for Pizazz. The first thing I wanted to deal with is that the thumbnail-size <a class="more-link" href="http://entertainingsoftware.com/2012/08/28/pizazz-1-1-1-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Ah&#8230;the feeling of fixing bugs. It&#8217;s very satisfying, but not as satisfying as releasing those fixes to the world. Now is one of those wonderful times for <a title="Pizazz" href="http://entertainingsoftware.com/wordpress/pizazz/">Pizazz</a>.</p>
<p>The first thing I wanted to deal with is that the thumbnail-size property stopped working. Previously, I had used PHP&#8217;s <a href="http://php.net/str_replace" target="_blank">str_replace</a> function to change &#8220;_125.jpg&#8221; to &#8220;_theCustomThumbnailSize.jpg&#8221;. As it turns out, Zazzle automatically generates the images based on the last number in the filename, hence I was able to implement this nice little feature. However, for some incomprehensible reason Zazzle changed the default number to 152. I&#8217;m pretty sure that&#8217;s a typo, because the five and two have been switched and that&#8217;s it. Generally this would be dangerous for everybody who relies on this default size to use the feed in any of their products.</p>
<p>The fix for this is pretty simple, but I had to fix something else, first. I installed Pizazz on my fresh, new test server and it didn&#8217;t work. At all, or at least at all by default. If you chose the lucky tags then it would work perfectly. After awhile I figured out what was wrong: the RSS feed was broken (or, better put, malformed). The titles of the products in some areas contained ampersands (&#8220;&amp;&#8221;). Normally this is fine, except that they were <em>just</em> ampersands. Under XML (from which RSS derives), the ampersand has a special meaning. It is used to identify special characters; for instance, &#8220;&amp;gt;&#8221; indicates the greater-than sign (&#8220;&gt;&#8221;). So, an ampersand on its own is erroneous, and should actually be &#8220;&amp;amp;&#8221;. Sadly, the XML parser I was using &#8212; SimpleXML &#8212; isn&#8217;t forgiving, and would abort on such lines. Most XML parsers break on these types of things, even Internet Explorer failed to read these feeds (though that browser fails on a lot of things). However, since Pizazz was made for Zazzle, and Zazzle always does things like this, SimpleXML had to go.</p>
<p>I rewrote the parser to use PCRE &#8212; Perl-Compatible Regular Expressions &#8212; to extract data from the text file without parsing it as true XML. So instead of running the XML parser and pulling out the data from a specialized PHP data structure, I just asked PHP to give me the text in between each &#8220;&lt;item&gt;&#8221; and &#8220;&lt;/item&gt;&#8221;, then from there pull out the title from &#8220;&lt;title&gt;&lt;![CDATA[" and "]]&gt;&lt;/title&gt;&#8221;, etc. This also removed the need for a number of verifiers that I wrote in to handle when Zazzle only produces bad RSS every-other request (that happens sometimes). In combination, this results in faster feed-caching and much more forgiving RSS parsing. The number of times that Pizazz abruptly fails due to XML parsing errors has been greatly reduced if not eliminated. Even when Zazzle returns its home page surrounding the RSS data the proper fields can still be extracted!</p>
<p>Great, now I could get back to the bug that I initially wanted to fix: the thumbnail sizer. Well, I could have just changed the parameter for str_replace from 125 to 152, but I&#8217;m absolutely sure that Zazzle will change this number again and I&#8217;ll have to change that again. So, instead, I just got PCRE to replace &#8220;_anyNumberAtAll.jpg&#8221; with what I want. That fixed it for now, and should prevent anything like this from happening again.</p>
<p>Then I got a bug report from one of my clients using multisite. Specifically, Pizazz didn&#8217;t work on multisite (well, it sort of did). Before, she activated Pizazz on each sub-blog individually, which circumvented the problem where &#8220;Network Activate&#8221; would crash WordPress&#8217;s network dashboard with a E500 Internal Server Error. I was going to fix Network Activate but, considering that there was a way around it and I had other stuff on my mind, I deprioratized it and ended up forgetting about it. Well, she got around to enabling it on the main site, and ended up breaking the network dashboard again. There was no way around this one, so I had to go working on it.</p>
<p>During the first day I successfully fixed the undefined-function error PHP was spewing out by moving Pizazz&#8217;s initialization code into a WordPress init-hook, as I technically should have from the beginning. This resulted in a different error: &#8220;function get_current_screen is not defined in /&#8230;/wp-admin/network/settings.php.&#8221;</p>
<p>This one took me 36-hours to debug. I painstakingly scoured the blogs, the WordPress codex, the forums, anywhere Google would take me and never found anything that would solve my problem. Worse off, PHP doesn&#8217;t give tracebacks unless you install a debugging plugin, which wasn&#8217;t a viable option. I kept on trying new things, including rewriting the settings page entirely. Albeit, the rewrite resulted in a cleaner script and moved the settings into their own page, which was nice, but it was (is) still frustrating.</p>
<p>I ended going onto my client&#8217;s server and just putting in a bunch of <a href="http://php.net/die" target="_blank">die</a> calls throughout the source code, trying to pinpoint where everything went wrong. I knew it was in settings.php, and the die calls didn&#8217;t help any further. That error kept cropping up in the network dashboard, and I couldn&#8217;t figure it out!</p>
<p>Finally, I commented out the code that loaded settings.php because I just wanted to remember what the network dashboard looked like. Then, carelessly, I hovered over and past the Network Settings tab. I froze, then moved my mouse back. I noticed that the Network Settings didn&#8217;t have any plugin fields listed. I looked back at the main site dashboard and hovered over the settings there and saw the plugins again. I un-commented the lines that loaded settings.php and looked back. The network dashboard stopped working, but the settings field worked perfectly in the main site dashboard. I wanted to scream.</p>
<p><strong>You can&#8217;t register options pages in the network dashboard!</strong> As opposed to WordPress raising an error when this was attempted, it prevented the function from being created in the assumption that plugin developers would know what the &#8220;undefined function&#8221; error meant. <strong>They don&#8217;t say that you can&#8217;t define option tables ANYWHERE in the documentation!</strong> I checked, it isn&#8217;t there. No wonder so many plugins don&#8217;t work in multisite, they don&#8217;t document these incompatibilities! All I had to do was change <em>( is_admin() )</em> to <em>( is_admin() and ( ! is_network_admin() ) )</em> and it worked again. Who the hell manages the codex!</p>
<p>There was much internal screeching, pacing and (for some unhealthy reason) eating that came afterwards. This has to be one of the most frustrating things I have ever had to deal with. One line, one problem that I wouldn&#8217;t have had if they had just documented it!<strong><br />
</strong></p>
<p>Eh&#8230;anyway, here&#8217;s the new plugin. All these bugs have been fixed and there are some minor code clean-ups. I don&#8217;t remember at which point it was but I rewrote the cache manager to use <a href="http://php.net/opendir" target="_blank">opendir</a> instead of <a href="http://php.net/glob" target="_blank">glob</a> when iterating through the files, because for some reason glob doesn&#8217;t always work when opendir does, so that should help any users who had or would of had a problem with this.</p>
<p>Now, I&#8217;m going to play with writing a little TinyBASIC compiler to cool off, and when I&#8217;m back to Pizazz I&#8217;ll implement shortcodes to embed Pizazz product inventories into your posts and pages. Keep tuning in!</p>
<p>Pizazz is available <a href="http://wordpress.org/extend/plugins/pizazz/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2012/08/28/pizazz-1-1-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back</title>
		<link>http://entertainingsoftware.com/2012/08/21/back/</link>
		<comments>http://entertainingsoftware.com/2012/08/21/back/#comments</comments>
		<pubDate>Tue, 21 Aug 2012 23:10:16 +0000</pubDate>
		<dc:creator>Luiji</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[canine]]></category>
		<category><![CDATA[pizazz]]></category>
		<category><![CDATA[secret maryo chronicles]]></category>
		<category><![CDATA[secrets]]></category>

		<guid isPermaLink="false">http://entertainingsoftware.com/?p=125</guid>
		<description><![CDATA[I&#8217;ve been away from programming my projects for awhile. I&#8217;m not going to disclose why, &#8217;cause I like to keep some mystery surrounding my microscopic internet presence. Or maybe I&#8217;m just paranoid, how are you to know? Anyway&#8230; Since I&#8217;ve <a class="more-link" href="http://entertainingsoftware.com/2012/08/21/back/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been away from programming my projects for awhile. I&#8217;m not going to disclose why, &#8217;cause I like to keep some mystery surrounding my microscopic internet presence. Or maybe I&#8217;m just paranoid, how are you to know? Anyway&#8230;</p>
<p>Since I&#8217;ve been away for so long, some cob webs have cropped up. CANINE is still just a basic little rendering engine (still entertains me, though!) and Pizazz has some bugs due to incompatibilities with a slight (SLIGHT!) change in the Zazzle RSS feed. Also, I should give Secret Maryo Chronicles some love&#8230;that game helped me get through a week of nothing-to-do (or a month? I can&#8217;t remember&#8230;) and I want to ensure its continued development. So, here&#8217;s my game plan:</p>
<ol>
<li>Fix the bug in Pizazz where image resizing stopped working. Make a hotfix release.</li>
<li>See if I can get my secret TinyBASIC compiler to a little more than just tokenize source code.</li>
<li>Add in a way to embed Zazzle product feeds into WordPress pages with Pizazz via shortcodes. <code>[pizazz-listing query=asparagus store=HolidayBug]</code></li>
<li>Hack on the secret platformer I&#8217;ve been working a bit on with a new friend of mine.</li>
<li>Get some basic scripting going in CANINE so we can get some interactivity out of the billboards. (Exploding barrels here I come! Later.)</li>
<li>Add in a script editor to Secret Maryo Chronicles to help out Quintus&#8217;s new scripting subsystem.</li>
<li>Hack a bit more on CANINE to get some bullets and enemies going.</li>
<li>Get that TinyBASIC compiler I mentioned to output something that I can compile with Netwide Assembler (hence marking my first <em>successful</em> attempt at a compiler).</li>
<li>Work a bit on that beat-em-up I made some mock-up-graphics for.</li>
</ol>
<p>I&#8217;m going to try and stick to this as much as possible, only diluting it with Team Fortress 2. (Why must I have friends to play Mann vs. Machine? I don&#8217;t have enough! I don&#8217;t need Valve&#8217;s social pressure. &gt;:[) If anybody gives me compelling reason, though, this order <em>may</em> be subject to change. It has to be <em>really</em> compelling, though.</p>
<p>Thanks to anybody who&#8217;s still interested in my projects,</p>
<p>- Luiji Maryo</p>
]]></content:encoded>
			<wfw:commentRss>http://entertainingsoftware.com/2012/08/21/back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
