Wednesday, March 10, 2021

the joy and longevity of vanilla javascript

 In 2005 I wrote a sprite editor for the Atari 2600, PlayerPal 2600.

This was before jQuery, so I wrote it in Vanilla Javascript. (And, gasp, tables)

In 2008 I upgraded it so it could output "Batari BASIC" code - so the editor plus bB is probably the easiest way of getting an Atari 2600 program up and running.

Anyway, this year a fellow named Oliver Gross submitted some code improvements allowing height and color info to be preserved when re-importing assembly data.... smartly, my past self tagged each line with color data but dumbly thought "well it's too hard to bring [the real] color data back in so I'm not going to try". Gross' code just reads the comments. It's a great 80/20 solution - if I'm not going to put in a clever parser, this still allows for people to iterate on their sprites!

I wrote it as a single file - no external libraries or graphics. (A concept that puts it in the tradition of type-in games from computer magazines) I think having it as a single file made it very easy for Gross to set up a "dev environment" and then submit changes, even without github! He just had a to view source, copy and paste all into an editor, save it, then load that in a browser. And then send me the end file, which I diff'd with the current code to review the changes.

It's funny how this predated jQuery, and outlived jQuery as well! Vanilla js is cool like that.

No comments:

Post a Comment