Home | Portfolio | Labs | Nonsense | Not Mine

Experiment #3: Acid
June 1st, 2010

Are you ready for this???

Controls: Mouse and Space

Music composed by Sir Michelangelo Wheatthins (Esquire)

Lately I've had my interest drawn towards bitmaps. They offer an interesting perspective in how to mathematically describe the world around you. Even though everything is comprised of tiny little jagged squares, distinct shapes can be formed. As humans, we have complex pattern recognition abilities, allowing us to see the "big picture". But what if we couldn't see the big picture, what if we had to consider each and every tiny little square individually? This is the succulent challenge manipulating bitmaps poses.

I started this with a fairly simple concept: generate some terrain, allow the user to generate an acid that will slowly degrade that terrain and "melt" through.

The first part was easy enough, just generate a whole bunch of "health" numbers and set corresponding darknesses to the pixels (lighter = harder to destroy). I toyed with the idea of adding a certain degree of grain - paths of certain coloured pixels - to the mix, but that never really worked out right.

Then came the fun part, the acid. My basic logic was "if there's nothing to the side of it, and nothing below the side of it, then it can fall to the side. Similarly, if there is just nothing below it, it can fall downwards", and that turned out pretty well, I think! Although I was only really looking at the pixels on a very small scale (directly around each drop), so I didn't consider slighter curvatures. Which is actually something I later did with this program (mouse and keys). Maybe I'll write a lab about the theory behind that some other time.

Anyway, so I showed it to people and I got two responses: Needs more stuff, and needs a "reset". The stuff void was filled with the black insoluble "oil" that allows you to better control the flow of the acid, which is basically an acid drop without the ability to burn terrain. Not all that interesting, but it was funner.

The "reset", on the other hand, I bitterly put in with an ungodly twist; Now the ground is alive. I pulled that off by logging all the "absences" of pixels, randomly selecting them, and then randomly checking a pixel around them to see if there was any terrain around them. If there was, it reformed.

And then I accidentally screwed up the code so this is the final version. Oooops!

June 1st, 2010

It's like I'm finally getting this shit put together!

Woooo infrastructure!

Experiment #2: Sandbox Balls
June 1st, 2010


Controls: Draw with mouse, add balls with SPACE.

Sandbox physics is this really absorbing obsession I have. Every now and then I mess around with it, and every time I dramatically lack the understanding to get very far. This round was no exception. I managed to get the balls bouncing off the main partition of a line perfectly (as far as I can tell?), but I hit a wall on the end points of lines. You see, with a line segment, there are only two points a ball can impact. These are the points where the line would be tangent to it, making calculations a simple quadratic. Unfortunately, the single point which makes up the end points can impact any point on the circle, and a whole lot of math later, that's a quartic relationship between position and time (when acceleration is factored). Anyone who's familiar with advanced polynomials knows that quartics are basically witchcraft and solving them absolutely is a madman's errand (for a highschool student, at least). I'll need to look into heuristic methods for solving polynomials before I can make any progress, and as it is the math behind it is simply over my head (for now!). So the balls pass through anything that can be described as "angular", at the moment.

Also ya the balls fall through eventually, that's when the balls are supposed to start rolling rather than bouncing, and I didn't want to bother with that, considering the much more pressing issue at hand.

Experiment #1: Charged Pixels
June 1st, 2010


This is a weird little concept I saw in a preloader for some game. It takes an image and converts it into a much blockier format, rendering each giant "pixel" as a big old square. These squares are attracted to their natural location but repelled by the mouse as if it were a particle with the same charge. In essence it lets you smash apart and distort whatever picture you like (changing the URL will load up a new picture).

Weird thing I noted: If you hold the mouse next to the image, subtle lines will form between the pixels in the form of a field line diagram. IT'S LIKE SCIENCE IN ACTION YOU GUYS.