Encryption algorithms and sharing levels on a tweet

You're viewing a single comment in a conversation. View all the comments
  • 3 Comments

  • Order by
  • I´ve been tinkering with this idea around a bit (in C3 tho)

    First things first: You can prevent Twitter from compressing the image by uploading a png that contains transparency (even if it´s just 1 pixel that has 99% opacity)

    Further what I did is to write a little js (with the javascript plugin) that loads the image into an offscreen canvas, then parses the individual pixels. Each pixel holds the information for 4 tiles (RGBA values), so an image with just 100x100 pixels would hold the information for a whopping 40.000 tiles (or a 200x200 tilemap)

    Also since each RGBA value takes 0-254 this means there´s 255 possible different tiles (actually 254, since Alpha at 0 removes also the RGB values) OR one could use it to also store the 8 different tile configurations (flipped, rotated,....) for 31 different tiles.

    Using rbga values is pretty neat, since tiles in construct are referenced by a number and we can directly use that number instead of having to use encryption.

    • Running out of characters, lul.

      What is left to do is to create something that parses the tilemap and generates an image based on it, that then can be shared. It´s a very raw prototype, but generally I´d say the idea is entirely possible.

      In C2 there´s also the canvas plugin (from R0j0hound) that has this option to pick a color from the canvas and also draw to a canvas, makes things a little bit easier I guess but haven´t tested it.

      Fun thing, one could even go ahead and load in random images to generate maps, though that would require a bit of tweaking so it isn´t completely unplayable. You could snap a picture of your cat and check out what level it generates.

      • Thank you for the comment!

        Indeed it's really interesting to save and load levels using pictures.

        I thought of using canvas to process image data or create one based on a level.

        I never used the Javascript plugin so it's really interesting to know that it works so well!

        And generating levels based on images is an amazing idea, I'd love to see an experiment based on that :D.