Dozen Days of Words
Episode 12: Morse Code
Read-me File

COPYRIGHT INFORMATION

Dozen Days of Words episode 12: Morse Code
copyright (c) 2010 Blazing Games Inc.
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


REVISION HISTORY

August 23, 2010 - Project started
September 1, 2010 - Official release

ABOUT DOZEN DAYS PENTALOGY

The history of the Dozen Days Pentalogy is kind of mixed up. Initially, for
a brief stint when I was going to make Blazing Games have daily updates 
(back in the time when I had hopes of turning Blazing Games into something 
more than a hobby) I decided that I would have a series of games that were
created in a single day. Just after announcing the project, I got a real
third-party project and had to cancel my daily update plans as well as put
on hold the Dozen Days project. 

I then had an idea for a single game that would combine the 60 games
(5 series of 12 games) that made up the planned series. The first epi
was created and then I ended up again putting the series on hold. 

The next time I came back to the series, I decided to go back to the
original game in a day roots and create each episode of the series as a
game-in-a-day challenge. This was successfully done for the first series in
the game, Dozen Days of Dice. In Dice, the only code/assets that I allowed
myself to use was code/assets that I created for earlier episodes in the
series. Code-reuse actually did play a huge part in the development of the
later episodes when I switched from Flash development to Flex development
due to Flex being more Open Source Friendly. There was one problem. Finding
a whole day to develop the game in was proving to be quite a challenge. So
in November of 2008 I had a poll on my site asking if people cared if the
games in the series were developed in a single day or if I could switch
to a multiple-session development format but would still restrict the
development time to under 24 hours. 

For the Second series, Dozen Days of Words, I switched to that  multi-session
format. At the time I am writing that, the series is just underway so I will
update this section when I start season 3 of this game in 2010.

UPDATE: I have decided to switch to HTML 5/JavaScript for the last two episodes
of the second season/series of games. For these games the development is under
24 hours of work but those hours are spread out over a number of days so that
I can work on this project in my spare time.


POSTING GAME ON WEBSITES

This is a HTML 5 game written in JavaScript. The bulk of the code is in the
MorseCode.as file which is called from a html file that sets up the canvas and
calls the game setup routines. It should be noted that IE does not support the
canvas tag so if you want to use this game with IE then you will need to look
into the exCanvas project.

PROGRAMMING NOTES

This is part of the Dozen Days of Words series and as such was created in under
24 hours of development time. Here is the worklog:

Hour 0:00-0:30 For the final game I have decided to go with a Morse Code game
where players code and decode letters and words. Setting up the project means
taking what I can from the CircleWord game as the base starting skeleton. My
first goal is to start assembling a primitive but adequate animation system.

Hour 0:30-5:00 Creating primitives and basic layer system. Was going to try and
implement dirty rectangle support but found that the amount of time that I would
have to invest was a bit too high so am going to hold off on that support until
after the game is fully functional. Here is the test code for the layer support:

	this.stage = new BGLayer("stage", new BGRect(0,0, CANVAS_WIDTH, CANVAS_HEIGHT));
	var layer = new BGLayer("A", new BGRect(10,10,300,220));
	layer.backgroundColor = "red";
	this.stage.addChild(layer);
	layer = new BGLayer("B", new BGRect(330,10,300,220));
	layer.backgroundColor = "green";
	this.stage.addChild(layer);
	layer = new BGLayer("C", new BGRect(10,250,300,220));
	layer.backgroundColor = "blue";
	this.stage.addChild(layer);
	layer = new BGLayer("D", new BGRect(330,250,300,220));
	layer.backgroundColor = "purple";
	this.stage.addChild(layer);

Hour 5:00-6:00 Morse code tables
Building a table that holds the dot-dash codes for the letters and numbers.

6:00 - 8:00 MorseTile class
The creation of the class that renders dot-dash patterns graphically with 
the size scaling to fit the space available. Here is the test code

	this.stage = new BGLayer("stage", new BGRect(0,0, CANVAS_WIDTH, CANVAS_HEIGHT));
	var layer = new MorseTile("A", new BGRect(10,10,300,220));
	layer.setCode(CODES[0]);
	layer.backgroundColor = "red";
	this.stage.addChild(layer);
	layer = new MorseTile("B", new BGRect(330,10,300,220));
	layer.setCode(CODES[1]);
	layer.backgroundColor = "green";
	this.stage.addChild(layer);
	layer = new MorseTile("C", new BGRect(10,250,300,220));
	layer.setCode(CODES[2]);
	layer.backgroundColor = "blue";
	this.stage.addChild(layer);
	layer = new MorseTile("D", new BGRect(330,250,300,220));
	layer.setCode(CODES[3]);
	layer.backgroundColor = "purple";
	this.stage.addChild(layer);

8:00 - 10:30 Labels and Buttons
I need buttons to make the game work, but buttons need text so I quickly created
the label class and then created the button class. This went quick but a minor
bug added about half an hour or so to the time.

10:30 - 13:30 ET put a bug in my code. 
Interesting bug in my Morse Code game that I am writing. The Morse Code tables 
are in an array of arrays and use 0 to designate a dot and 1 to designate a 
dash. In JavaScript, a new Array(#) call creates an array of that length so the 
single dot (E) and single dash (T) resulted in incorrect values in my table!

This bug was discovered while getting the single letter encode game mode working.
While testing the bug was discovered and it took me about a while to figure out
what exactly was going on. The implementation, which is it's own stage layer, is
fairly simple just some labels, buttons, and a couple of Morse Tiles.

Still, at this stage in development, it is clear that I am not going to get the
whole words modes so I will just have an  encode and decode mode, with the 
encode done that just leaves the decode and title screens to go!

13:30 - 15:30 Decode mode
Implementing of the single letter decoding went fairly quick now that the ET 
problem has been fixed. 

15:30 - 16:30 Title
The title screen simply lets the player select from the two game modes. For fun
I did the title text a bit fancy by having the Morse Code for the title 
underneath the title.

16:30 - 18:00 Fine Tuning
Cleaning up layout and colors. Testing on different browsers, including ie using
excanvas.