A Flash Based Dynamic Puzzle Generator

Posted:9/09/2014 1:44AM

A Flash Based Dynamic Puzzle Generator

Mike Mclain Discusses A Flash Based Dynamic Puzzle Generator He Created Many Years Ago


Many years ago (around circa 2003), back when I was becoming acclimated with the freshman engineering lifestyle, I used to dabble regularly with Macromedia Flash and the classical Flash Action Script programming specification. Likewise, while I have no doubt that (within the next 15 years or so) such statements will be viewed (particularly by the younger generation of programmers) with the same dramatic sigh that older programmers who started out working with ADA, LISP, or COBOL currently get. Nevertheless, during this ActiveX fueled period of time, Flash based games were extremely popular (some people might remember go-to websites like NEWGROUNDS or even some popular Flash based games like the Helicopter Game, so attempting to create such monstrosities (during this period of time) within Flash was the trendy thing to do .

Now, (also during this period of time) I happened to notice that a number of Flash based puzzles were being published (a few were actually popular on NEWGROUNDS); however, none of these puzzles could dynamically generate a new configuration of puzzle pieces at run time (so once you solved the puzzle there was really no reason to replay the game beyond self-imposed atonement). Conversely, while I must concede that it is possible that somebody somewhere might have created their own version of a dynamically generated puzzle in Flash (during this period of time or slightly before), yet (to my knowledge) I never observed another one until many years after I had created one.

Likewise, (with this being said) given the limitations of the Flash Action Scripting Language (at least during this period of time) the technique I utilized to dynamically create a puzzle was to first create around 15 or so template pieces that would be later used to mask the puzzle image selected. Next, I created an algorithm that would (based upon the size of the puzzle selected) utilize the template pieces to create a random puzzle configuration. Conversely, after each element (within the created puzzle configuration) would be mapped to a physical location on the selected puzzle image and the template pieces selected (by the algorithm) would mask the mapped locations of the image based upon the puzzle size. Lastly, some rudimentary logic was created to determine whether or not puzzle pieces fit together and (to make the puzzle easier) a auto-snap feature was added if a piece was placed correctly.

While the game itself is both dated and somewhat buggy ( as I have gotten some complaints that the game is too easy because of the auto-snap feature), it is important to remember that this game was a first of its kind prototype that I put together in a single day. Likewise, had the times permitted the monetary sale of such games (since the independent gaming scene an online payment system was rather nonexistent back then), I might have decided to developed this game further than I did.

Thus, without further adieu, here is the Flash based dynamic puzzle generator:

Note: because this application is rather old (and I am no longer actively supporting it) updates to the Flash player (or creation of there own modern Flash interpreter within Firefox and Chrome) has resulted in the creation of additional game bugs. While current versions of Internet Explorer and the stand alone SWF player appear to be unaffected (So I have to sadly recommend that you either use Internet Explorer or download the SWF file to play this game); however, if youre using Firefox or Chrome and you do not see any images upon clicking in the list box below, you will need to click the start button (in the game) and then press the back button (in the game) in order to (hopefully) get the images loading correctly. Furthermore, if you start a puzzle and the puzzle pieces are missing (within these afflicted browsers) you will need to toggle between the image selection area and the puzzle solving area in order to get everything working correctly (a few times might be necessary).

Addendum: After observing a number of game breaking bugs (because of file loading issues) I made a few minor changes to the old code base using CS5 Flash in order to get the game functional again; however, it appears that the game timer broke as a result of rendering to the new version of Flash (noting that i did not try and fix the browser image bug) but (if time permits) I might try to resolve such issues later.

Furthermore, a copy of the source file and the SWF file can be obtained:



comments powered by Disqus