Breakout Glitch

Our task in Glitch this week was to glitch Steph Thirion‘s Breakout code written in Processing, using an hour to see what we could come up with.

Here’s a vid of Super-Breakout:

My result:

I didn’t feel like it was destructive or additive; mainly I was just tweaking values with randomization, and then rotated it a bit, which would need further tweaking to have more of it on-screen.

Github gist: https://gist.github.com/3835687

Though I did find this pretty cool glitchiness written in Processing, by Amnon:

We had another assignment, which was to post screenshots of our crash reports.  Here’s mine, from doing my Java homework in Eclipse (I think I had an infinite loop going or something):

And finally, my girlfriend tried to take a photo using her phone’s front-facing camera, but this kept happening:

ITP Glitch: Editing Civilization Save Files

So far in my Glitch class, we’ve experimented with databending and transcoding images, audio, and video, using a variety of different techniques, but mainly trying to de-abstract how software handles file formats so that we can edit the actual bytes of files to alter the expected output — e.g. shifting the bytes by one in order to cause the image’s dimensions to warp or change color.

Here is our homework assignment for this week:

  • Find and write about a file format / specification. For example, ISO/IEC 10918 (JPEG),  ISO/IEC 1172-3 (MP3), ISO/IEC 14496-3 (AAC) GIF89a, ZIP, MIDI, etc. See List of Codecs for more. You should provide an analysis of any features of the format that may be interesting to glitch artists working with it, or provide a history that explains the various biases that are reified by the format, and the advantages and disadvantages of those biases in actual use.
  • Create your own file format / specification. A complete specification will allow someone else to both encode media into an intermediate representation, and then decode it back to an approximation (lossy) or exact replica (lossless) of the original. As far as “types” of media: audio, images and video are popular; dance, haptic sensations, taste, legal requirements, written language, etc. all count as media. You must run at least one piece of media through your encoding / decoding process, but you may do this by hand — it does not need to be executed by a computer.

 

The second assignment seems pretty difficult at this point.  I looked into making “extrafiles” and found this OS X app, extrafile, which introduces a series of unique file formats such as one called “Block Ascii” which is only 1bit color:

So you can save a file into one of those formats using the app.

Coming up with my own file format specification would take a while, and I’m not sure how I would transpose data through media processing without losing everything in a jumble of noise.  However, I did do an assignment last semester dealing with genetic inheritance which involved passing a database record of peoples’ stats (1-10 sliding scales of peoples’ stats, like creativity or strength or determination) into a Wolfram cellular automata algorithm, via a node.js server passing JSON, so that the output looked like this:

But that’s not really a file format per se.  It might be interesting to be able to encode someone’s physical and life characteristics into a photo file of them, so that in, say, 50 years, someone could open up the photo image and see what the person’s biometrics and other statistics were at the time the photo was taken.  Hmm, possible idea!

So in terms of describing another existing file format, it made me think about when I first played Civilization as a kid.  Back then, there was no real internet to speak of, and I was using Prodigy* via a dialup modem so that I could (slowly) browse the Civ forums there.  Some people who knew their shit were hex editing their save files so that they could test the limits of the game (e.g. I think cities couldn’t get any higher than 99 population or something, because of memory issues from going to 3 digits) and cheat to win.  That stuff was over my head so I never played with it, but I remember it to my day as a way that some people were able to change settings for games, registration verification, etc.

Anyway, even though it’s hard to look up info on the first couple Civ games (because most Google results now are for Civ 4 and 5), I did find pages with a pretty good write-up of the Civilization 2 savefile format and of the Civilization 3 BIC file format.

On data types:

"...there are three data types: The null-terminated string is a variable length type for text. It always ends with a byte value of zero, meaning a string of 9 bytes only has place for at most 8 characters. The signedshort integer is a numeric data type taking up 2 bytes. It can take values from -32768 to +32767. The unsigned byteshould be self-explanatory. It takes values from 0 to 255."

For handling states of engineer units:

An engineer in CIV II generates 2 points per turn. A settler generates 1 point. These numbers remain constant when the “Base time for engineers to transform terrain (x2)” is changed in the Rules file. With the “Base time…….” set to 20 (vanilla CIV II), twenty points are needed to transform Grassland to Hills.
Consequently, if the Grassland to Hills transformation command is entered on turn 1, a single Engineer will complete the transformation on turn 10. Its byte 15 is changed to 2 on turn 1, is incremented by 2 on each of the following 9 turns, and reaches 20 on turn 10.
If 2 engineers (E1 and E2) are assigned to the task, their byte 15’s change as follows:
UNIT -- E1 E2
 TURN 1 04 00
 TURN 2 08 00
 TURN 3 12 00
 TURN 4 16 00
 TURN 5 00 00 Task completed

Some culture variables in the savefile:

CULT SECTION (Culture)
  4	char		"CULT"
  4	long		??? (33)
  4	long		??? (5)
  4	long		number of culture opinions
  For each culture opinion:
    4	long		length of culture data (88)
    64	string		culture opinion name
    4	long		chance of successful propaganda
    4	long		culture ratio percentage (3:1 = 300, 3:4 = 75)
    4	long		culture ratio denominator (e.g. the 1 in 3:1)
    4	long		culture ratio numerator (e.g. the 3 in 3:1)
    4	long		initial resistance chance
    4	long		continued resistance chance

It might be interesting, given the exact formats and memory sizes of the variables, to make a random savefile generator, and then open it up within the game to see what you get.  Would the game be playable, or does it require a certain logic within the savefile where, say, you couldn’t have some variables if other variables were of a certain value?

Tool-assisted speedruns have become big as a result of savefiles.  Basically, if you can save the exact state of a game in a file, you can restore from that point without limit.  I played through Zelda: Ocarina of Time via an emulator on my computer back when I was in college, so it was easy to quickly restore at difficult points in the game.  Apparently all this is called save scumming.  This is how you get those weird videos every once in a while that show some Japanese player doing a perfect speedrun through a custom-made annoying-as-holy-fuck Mario Brothers-family game, e.g.:

That video introduces some followup questions.  Why do people subject themselves to such torture?  How did that person not kill everyone in his building?  Is there a good reason he never uploaded past part 3 since 2007?  Did he go on a murderous rampage?

In terms of savefile formats, I know that later Civ games used XML for settings files and maybe savefile formats?  What if you could translate the format of one game’s savefiles to that of another, so you could play your character in a different world?  More importantly, what if there were a standardized player file format that you could re-use between different games through a secure authenticator? (say, you used it on Steam)  This has been done with some games and some networks (such as Mass Effect on Xbox Live), but how about an open player file format?  And how about if it included your real-world Galapag.us characteristics and history?

8-Bit DNA

My ITP classmate Matthew Epler did his intro to computational media midterm on turning poetry into RGB colors, after playing with the concept of digital characters as ASCII values (see the ASCII Table).

“This project is the beginning of what I suspect will be an ongoing investigation of the relationship between language and code. In “Color of Language,” poems are translated into color via Processing, and then passed through a series of iterations involving one simple mathematical equation.”

This made me think about our example sketches where we could break down GIF images into pixels and then display each pixel differently (turn the pixels into ellipses, or search/sort them by brightness).

As I’ve been playing with the look of karyograms and DNA in other projects, I wanted to visually display 8-bit Nintendo characters as their representative digital DNA.  This brief Processing sketch reads in every pixel of the .gif image and outputs it all on one line instead of as an image with width and height, to give it a unique linear signature. Here is the result:

It would be pretty hard to guess the characters just from this representation, but each one definitely has its own digital signature.

The characters:

 = Link (Legend of Zelda)

 = Samus Aran (Metroid)

 = Mario (Super Mario Bros.)

 = Kid Icarus

 = Scrooge McDuck (Duck Tales)

noStroke();
background(255);
size(1400, 500);

PImage thisImg;

int numImgs = 5;
thisImg = loadImage("link.gif"); // filler

for (int i=0; i < numImgs; i++) { 
  switch (i) {
  case 0:
    thisImg = loadImage("link.gif");
    break;
  case 1:
    thisImg = loadImage("samus.gif");
    break;
  case 2:
    thisImg = loadImage("mario.gif");
    break;
  case 3:
    thisImg = loadImage("kidicarus.gif");
    break;
  case 4:
    thisImg = loadImage("scrooge.gif");
    break;
  }

  // displays 1 pixel x 20 pixel DNA lines for each Nintendo character

  color[] imgPixels = thisImg.pixels;
  int z = 0;
  for (int x = 0; x < thisImg.width; x++) {
    for (int y = 0; y < thisImg.height; y++) {
      color c = imgPixels[x + y * thisImg.width];
      fill(c);
      rect(z*1, 25*i, 1, 20);
      z++;
    }
  }
}