Step 0: Configure the GamePack
This is a little video I made (yep - I taught myself how to do it from scratch too, using Blender!) showing how I put together my Illuminato WideScreen Gamepack (in a very idealized, white-splash world, I suppose).
Step 1: Translate Mario Level to Excel
I basically took this picture, that I found over here at Ian's ridiculous collection of Mario levels into an excel spreadsheet (it's in the Boxario app file):
Step 2: Extract Into a CSV File
Using Excel's "Export as" feature, I saved the file mariolevel.txt (also in the Boxario app file), which looked something like this:
,,,,,,,,,,,,,,,,,,,5,5,,,,,,,,,,,,,6,6,6,6,6,6,6
,1,,,,,,,,,,,,,,,1,,,5,5,,,1,,,,,,,,,,6,6,6,6,6,6,6,6,6,6
,1,3,,,,,,,4,,,,,,,1,,,5,5,,,1,,,,,,,,,,6,6,6,6,6,6,6,6,6,6,6,
Step 3: Use Perl Script to convert into Arduino format
I wrote a little perl script (really sloppy, but it works!) to read the CSV file, and output a formatted list of coordinate pairs for wherever there's a block in the Excel file I drew in step 1:
print "Hello World\n";
;
open FILEIO, "mariolevel.txt";
open FILEOUT, ">mariolevelout.txt";
$row = 1;
$totalcount = 0;
while ($line = ) {
chop $line;
@bits = split(/,/, $line);
$size = scalar @bits;
#print $size;
#;
for($i = 1; $i < $size; $i++) { if ($bits[$i] eq "") { #print "-"; } else { #print "{$i,$row,'".$bits[$i]."'},\n"; print FILEOUT "{$i,$row,".$bits[$i]."},\n"; $totalcount++ } } #print $line; #;
$row++;
}
print $totalcount;
;
exit 0;
This generates a file that looks something like this:
{84,10,2},
{85,10,2},
{52,11,8},
{59,11,10},
{47,12,4},
{48,12,9},
{52,12,8},
{59,12,2}
Step 4: Copy Coordinate Pairs to TouchShield Slide
Open up the TouchShield Slide application code, and copy it into the Arduino IDE window. Then replace the BLIP data structure with the full contents of the coordinate pair data from the previous step:
const BLIP data[] = {
{84,10,2},
{85,10,2},
{52,11,8},
{59,11,10},
{47,12,4},
{48,12,9},
...
Step 5: Program the GamePack
Compile and download the code to the TouchShield Slide. Then, open up the Arduino.txt file in the app zip, and download it to the Arduino or Illuminato, whichever you want. The Arduino base (or Boxario Base) code basically just reads the InputShield, and transmits data to the TouchShield Slide, which reads the data and scrolls the screen, like so:
Of course, all the source code is GNU GPL Open Source, and is all posted at the App Store over here...
PS ... I need serious help optimizing the code, since right now it's plenty choppy, but maybe that'll be my project for the next week :)
No comments:
Post a Comment