Tiny Coding: Making Big Games With Little Code

Posted in Game Dev, JavaScript, Projects | Tagged , , , | Leave a comment

How I made a 3D game in only 2KB of JavaScript

Months ago, when I heard that the legendary JS1k game jam would not be continuing, I talked it over with some other devs and decided to help fill the void we would host a 2k game jam on itch called 2kPlus Jam. The primary goal of this comp was to create a game that fits entirely in a 2 kilobyte zip file. That is incredibly small, for point of reference a 3.5 floppy disk could hold over 700 of these games.

My entry, Hue Jumper, is an homage to 80’s racing game rendering technology. The 3D graphics and physics engine was implemented from scratch in pure JavaScript. I also spent ungodly hours tweaking the gameplay and visuals.

The theme for the game jam was “Shift” which I incorporated by shifting the hue for the world’s color when the player crosses a checkpoint. I imagined that crossing a checkpoint was fictionally like shifting or jumping into a new dimension with a different hue, which is how I came up with the name “Hue Jumper”.

This post is going to be a bit long because it contains the JavaScript code for my game in it’s entirety. The code is already well commented so I’m not going to explain every line of it nor are you expected to read through all the code now. Instead my goal is to explain how it works, why I made it this way, and walk you through the overall structure. This same code is on CodePen for you to play around with live. So please continue reading, buckle up, and hold onto your butts!

Continue reading

Posted in Game Dev, JavaScript | Tagged , , , | 23 Comments

Hue Jumper – A 2 Kilobyte 3D racing game in JavaScript

For 2kPlus jam I made a 3D racing game that fits in 2 kilobyte zip! It includes physics, controls, rendering engine, and procedural level generator. The code is extremely dense and clean as I went through many iterations to fit everything. I also spent an immense amount of time polishing the look and feel. You can play the game in browser, or view the code on GitHub. I am working on a post that will go into some technical detail about how my game works. Also, check the other submissions to 2kPlus jam, there are some mind blowing entries!

Posted in Game Dev | Tagged , , | Leave a comment

Egg Time Rewind – An egg cracking low res shooter


Time REWINDS you die… but your PREVIOUS LIVES remain.

This game was made in 4 days for Nokia 3310 Jam 2 with the limitation of 84×48 resolution and only 2 colors. The them was “Death is Good”. It is written in JavaScript building off the code used by my js13k game Bounce Back.

I used the theme by having ghosts of your previous lives return to help you after each death. There is also a juggling mechanic like the Twin Bee / Stinger series of games where you can juggle an egg for massive bonus points. The level is procedurally generated every time you start a new game and gets progressively more difficult over time.

The game can be played with keyboard, mouse, or gamepad in several different configurations. There are 2 ways to shoot, hold fire for fully auto, or wait to charge up a powerful blast.

Player’s high score is tracked to add some replay value, though it is a pretty simple game. The font and font rendering system is the same one I made for Bogus Roads. The sound effects use ZzFX, my tiny JavaScript sound generator.

Posted in Game Dev, JavaScript | Tagged , , , , | Leave a comment

Adventures in Tiny Coding – My 2019 In Review

Last year was an interesting and productive year. Mostly I’ve been doing a deep dive into web development and JavaScript, while making ton of games, tools, tiny programs, and animations. The central theme to nearly everything I have been doing is something you might call “Tiny Coding”.

Tiny Ski code printed on a business card

My adventure in tiny coding began on April fools day, strangely enough. For the previous several weeks I had gone perhaps slightly mad, feverishly working on tiny C++ skiing game. Inspired by Andrew Kensler’s Business Card Ray Tracer, I had the urge to make a tiny game to print on the back of on my business card. On April first I published a half joking post about how I would only be making business card sized games now. Little did I know that would not be far from the truth.

I soon discovered the last annual JS1k was already in progress, a competition for making tiny JavaScript programs. At the time I had little experience with JavaScript but I was eager to learn. So I toiled for 2 weeks straight and ended up submitted 6 programs. My favorites are Queen’s Gambit (a robotron chess mashup) and Digit Dilemma (a tough new puzzle game).

Continuing my journey I stumbled across Dwitter, a website where people post tiny JavaScript programs that make art. I was (and still am) blown away by the wonders contained there, and knew that I needed to learn more. Fast forward about six months and over seven hundred dweets I can confident say that I am a master code golfer, though there is always more to discover. In fact I’ve made so many dweets that I created a special tool called The Dweetabase that can be used to quickly browse through them.

I was disappointed that I was unable to find a good tool to capture all the JavaScript animations I was producing, so I decided to make my own! This tool, called CapJS, has received considerable polish with some nice features like a fancy Code Mirror editor, Shadertoy support, beautifier, minifier, centering overlay, watch window, and easy to use drag and drop loading.

I began writing a column called “Dissecting a Dweet” that explains how some of these tiny programs work, which I post right here on my blog. The most popular one by far was “#3 – Mini Black Hole” is a good place to start. So far I’ve released eight of these and I have roughly the first twenty planned out if interest continues.

Towards the end of the year I moved on to building some larger programs, but still sticking with this new “tiny code” philosophy. For JS13k I made “Bounce Back” an action adventure roguelite that won second place! I also made “Bogus Roads” for #LowResJam, one of my most complete game with 3 procedural generated levels and 5 music tracks. A few weeks ago at MAGFest I presented a talk on tiny coding to a packed audience which I will continue refining for submission to GDC.

One of the coolest tools I’ve released is ZzFX, a tiny sound effect generator for people to use in their JavaScript games. This began as JS1k entry but I greatly improved it, added a better interface, cleaned up the code, and put it on GitHub. I felt something like this would be a boon to everyone that makes these kind of tiny games. To my delight, many people have already used it including some really incredible games like “The Wandering Wraith” by Mateusz Tomczyk.

Late in the year I released ZzArt on GitHub, a tool that can evolve abstract art using GLSL shaders. Though the code itself is fairly simple, I have been completely amazed by the results. I now have saved hundreds of amazing images, and ended up getting many of them printed for holiday gifts. I even had a few poster sized prints made and hung them in my living room! I will definitely continue developing this.

I recently had some exciting news recently when one of my videos won “Best Illusion of The Year” and now has over two million views! There are many more amazing things that I’ve left out, so keep reading for a organized list of everything I’ve done in 2019. Follow me on twitter for daily updates on my progress. Here’s to an amazing 2020 for everyone!

Continue reading

Posted in Projects | Tagged , | Leave a comment

Best Illusion of The Year 2019

Holy cow, I won Best Illusion of the Year! Thank you to the contest organizers, other participants and fellow illusion chasers.

This spinning shape appears to defy logic by rotating around both the horizontal and vertical axis at the same time! To make things even more confusing, the direction of rotation is also ambiguous. Some visual cues in the video will help viewers change their perception.

More Info…

Posted in Projects | Tagged , , | Leave a comment

JSONCrush – Compress JSON into URL friendly strings

I just open sourced an amazingly useful tool called JSONCrush. This simple system allows for excellent compression of URI encoded JSON strings using the JSCrush algorithm. It seems almost like magic how well it works. The minified version is under 2k of JavaScript!

JSONCrush on GitHub

Example

JSON – 103 bytes

{"students":[{"name":"Jack","age":17},{"name":"Jill","age":16},{"name":"Sue","age":16}],"class":"math"}

URI Encoded Component – 199 bytes

%7B%22students%22%3A%5B%7B%22name%22%3A%22Jack%22%2C%22age%22%3A17%7D%2C%7B%22name%22%3A%22Jill%22%2C%22age%22%3A16%7D%2C%7B%22name%22%3A%22Sue%22%2C%22age%22%3A16%7D%5D%2C%22class%22%3A%22math%22%7D

JSONCrushed – 81 bytes! 59% smaller

('students!%5B*Jack-7.Jill-6.Sue-6)%5D~class!'math')*('name!'-'~age!1.)%2C*%01.-*
Posted in JavaScript | Tagged , , | Leave a comment

ZzArt – Abstract Art Evolution

This tool generates GLSL shaders (basically a bunch of math equations) that you can evolve into incredibly varied works of abstract generative art.

Images can be bookmarked, save as HD pngs or exported as GLSL shader code. The satellite feature shows a full screen preview on a second monitor. It even works on most mobile devices.

This is a work currently underdevelopment but it’s far enough to share. I am constantly adding new features and improvements. If you make anything cool, please share, I’d love to see it!

Posted in JavaScript, Projects | Tagged , , , | Leave a comment

Dissecting A Dweet #8: Shattered Tunnel

Howdy, folks! Today we will be looking at the JavaScript code behind this amazing 3D tunnel effect. This code has an interesting lineage so we’ll also talk about some of the history behind it.

for(c.width|=k=i=960;z=--i;x.fillStyle=`hsl(0 99%${i/9}%`)x.fillRect(k-z*C(j=i/k+t/4)+S(m=k*j)*(r=1e5/z),540+C(m)*r-z*S(j),s=3e4/z*S(j*9),s)

View post on imgur.com

Continue reading on for a full explanation of how it works!

Continue reading

Posted in JavaScript | Tagged , , , | 3 Comments

Bounce Back Postmortem

The JS13k competition has been going on every year since 2012 but this was my first year entering. Participants get 1 month to make an original 13 kilobyte JavaScript game. This year the theme was “Back” and there were 245 entries! Bounce Back got 2nd place!

My game “Bounce Back” is a procedurally generated adventure game using a boomerang as the primary weapon. I was inspired to create an homage to one of my favorite games “Zelda: Link’s Awakening”. The game was mostly written from scratch and took about two weeks to complete. For the past few months I’ve been practicing JavaScript every day and learning more about game design. So I pulled out all the stops and put everything I’ve learned into practice, hopefully it shows!

In this post I will explain how my game works and the process I went through. Before reading, please take a few moments to play the game if you haven’t already. The source code is also available on GitHub!

Continue reading

Posted in Game Dev, JavaScript | Tagged , , , | 2 Comments