Home of Ebyan Alvarez-Buylla

Neural Particle Deposition

Neural Particle Deposition

In developing an algorithm to generate nodes that are guaranteed to be within a certain distance of each other, I stumbled over this interesting distribution of particles which were initially placed randomly then moved near their nearest neighbor. I’ve dubbed this particle system “Neural Particle Deposition” on account of the organic, neuron-like shapes it produces. Take a look:

Procedural Space Invaders

Procedural Space Invaders

These simple procedurally-generated Space Invaders-style sprites were directly inspired by Jared Tarbell’s classic Invader Fractal. The concept is straightforward: start with a grid of a set width and height (3×5 works well), and mirror on the x all tiles except for the center one. You can see it in action here and grab the source code from GitHub.

Procedural Radial Flowers

Procedural Radial Flowers

At my wife’s request I bring you a direct spin off of the Procedural Space Invaders, only this time rotated along a center axis to create procedural radial spirals, or “flowers”. You can see it in action here and grab the source code from GitHub.

Cardinal Movement Relative to Player Screen Position

Cardinal Movement Relative to Player Screen Position

Here’s something you’re likely to have run across: the player character is in the center of the screen, and you want it to move in the cardinal direction you click, relative to its position—clicking above it moves north, below south, to the right east, and to the left west.

I’ve implemented this control scheme in my current project, settling on the following technique after a less-than-elegant implementation relying heavily on if-elses:

Comet Long Polling with PHP and jQuery

Comet Long Polling with PHP and jQuery

Comet describes a number of techniques with which a web server may push information to a client in a non-transactional format. Long Polling is one of such techniques, in which a browser’s request remains open until the server has information to send.

Long Polling is particularly useful in semi-synchronous applications, such as chat rooms and turn-based games, and is straightforward to implement with PHP and jQuery: