Tag: development


Quick and Dirty Pseudo-Random Generator

Procedural content is big. I’m working on a game based on purely procedurally generated levels. Thus I needed a pseudo-random number generator. I took the formula Adam ‘Atomic’ Saltsman (yeah – the Canabalt guy) presented in the Game Developer magazine and adapted it to work on the iOS platform.

I also thought it’s wise to keep it compatible with 8bit computers ;-) so I truncated the number a great bit. It actually doesn’t matter too much, but I’d not use this code unchecked in production. Myself, I use it for building levels and I just need 999 different ones.

Generate an unsigned int pseudo-random number based on seed “seed”:
#define SONA_PRANDOM(seed) \
((unsigned)((seed * 1103515245 + 12345)/65536) % 32768)

Generate a float16 pseudo-random number based on seed “seed”:
#define SONA_PRANDOM_FLOAT(seed) \
(((float)SONA_PRANDOM(seed)) / (float) (1<<16-1))

Select x, y or z from a set:
#define SONA_PRANDOM_FROM_SET3(seed,x,y,z) \
(SONA_PRANDOM_FLOAT(seed) > 1.f/3.f ? (SONA_PRANDOM_FLOAT(seed) > 1.f/2.f ? x : y) : z)

Generate an int between __MIN__ and __MAX__:
#define SONA_PRANDOM_INT(seed,__MIN__, __MAX__) \
((__MIN__) + SONA_PRANDOM(seed) % ((__MAX__+1) - (__MIN__)))

In order to generate a sequence of random numbers you just reuse the last random number as seed:
unsigned random1 = SONA_PRANDOM(666);
unsigned random2 = SONA_PRANDOM(random1);
unsigned random3 = SONA_PRANDOM(random2);
// and so on

Final advice: Don't use it in production without checking every single value in a test run. If you pick the wrong seed, the random numbers might loop easily. Feel free to use it for prototyping or extend it.

Bookmark and Share

Comment » | Blog

Hyperspace Visuals

As some of you might know, I worked as a new media artist for a couple of years. I never was a visual artist since my main body of works was installations. Yet I always enjoyed working live and accumulated a number of visual artworks over the time. Now that we’re working on Radio Flare REDUX, this comes in really handy.

When I was in high school I started to have an interest in the arts. I began writing poems and making drawings. I kept drawing (not painting as I was always more fascinated with lines than with areas) as a hobby while I was studying informatics, the Austrian — a bit more theoretical — version of computer sciences. In the year 2000, when I was already a master student, I joined the Ars Electronica Futurelab and fell in love with the electronic arts. I started drafting my own media art works and having my first exhibitions of electronic pieces. Back then I had a fascination for old technology, so a couple of them are based on old devices. And I wanted to find a visual language that is not based on projecting images, the dominant media art form of those days. So I used the opposite optical instrument to the projector: the microscope.

Anti-Projection 1

Anti-Projection 1

Then I met Laura Beloff, a Finish media artist, who was my guide and main collaborator over the next years. We actually did not finish many pieces together because those we did were really big and technically as well as conceptually advanced. The most successful by far was Seven Mile Boots.

All the while I also cooperated with a lot of other artists. I never liked working alone too much.

bagatelle concrète

bagatelle concrète

Another strong influence was toxicdreams, a theatre group based in Vienna. I did a couple of shows and exhibitions with Josi Wanunu and his crew. They were exceptional people with exceptional backgrounds and I learned a lot from them. They were the first to bring me on a theatre stage. And they slowly made me come back to more visual means of expression. At the same time I worked with Thomas Grill and the Low Frequency Orchestra (LFO). Together we made some traditional video art pieces about sound, music, and visuals — based on themes like compression artifacts, Phillip K. Dick and Space Travel. And I even turned VJ for the LFO. The results were published as a DVD and shown at obscure locations like a planetarium here in Vienna. The visual language I had found was greatly influenced by my installations and the themes that kept popping up in all my art pieces: dead media and old technology, the space age, the industrial age, errors, games and time.

Kommen und Gehen (with Low Frequency Orchestra)

Kommen und Gehen (with Low Frequency Orchestra)

Now that I’m working on Radio Flare REDUX this whole — personal — history comes back. The levels of the game are journeys through music, visual representations of sound. More than that, they are music for the eyes. We set out to create a truly unique experience with this game. And it is truly fulfilling to watch it grow and develop into something special.

Bookmark and Share

Comment » | Blog