Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Pixel_Outlaw

Pages: [1] 2 3 4 5 6 7 8 ... 55
Blitz / Re: Monkey 2
« on: August 12, 2017 »
I really hope a lot of people support Mark so he can continue to live off the Blitz line of projects.
For simply getting your project off the ground with little multimedia/OpenGL fuss they can't be beaten.

After reading quite a few books on the subject of recreational programming (simple short programs to amuse) I've decided to make a forum for such things. Most of these projects are not really in line with the notion of a demo. They are usually programs with a simple effect in mind that is often static. Really the algorithm is what is important.

Since many people here enjoy programming an effect or two into a demo I thought I might draw some interest.
It is a bit different from a demoscene forum in that I ask users contribute algorithms in pseudocode or English.
I'm trying to create something that is both programming language, and platform agnostic.

Let me say that I would never want to pull people away from contributing to this forum.
My little project is more of an exploration of visual algorithms and oddidites.
There will never be compelling competitions like Shockwave has done here.

combatking0 has done the bulk of the work, we are just trying to get some solid content in now.
Most of my programming is done these days on low end Linux machines with old graphics cards so a lot of my work anymore is static graphics and concept exploration.

Please join, take a look at the examples and see if there is content you'd like to contribute!
Currently we have a approval process for joining. But that may change.

Thanks for any interest!
There are a LOT of talented visionaries here that I'd like to have.  :hi:

General chat / Re: Tablets PC
« on: November 17, 2012 »
I didn't care for all the current options so I sort of hacked together my own from a x86 tablet PC.
I just wanted something I could program on easily. Full sized usb ports are a plus with video out.
1 GB RAM, 1 GHz processor, Debian GNU/Linux

I did this because my primary concerns for a tablet were:

0. Full root account and complete system control.
1. C/C++ compiler, Common Lisp, and Python support with established libraries like SFML, SDL, Pygame etc.
2. True multi user support.
3. GNU tool chain and userland.
4. Wacom stylus pen and xvkbd for virtual stylus keyboard.
5. Free and open source software.

Got it used for $80.
The only problem with it is the drive is an IDE drive  and it takes 333 laptop RAM chips which are getting pretty rare.

General chat / Re: Raspberry PI
« on: November 17, 2012 »
I have hardly used it since I was coding python(yes, I got frustration with it as couldn't get it working :( ) and I might sell it if someone is interest :)

I use Python quite a bit in Debian.
Maybe you could tell me what you are attempting to do?

From the terminal it should be as easy as typing:    python <path to program file here>
Now if you are trying to do graphcal things you'll need to install the Pygame module.

I find a terminal editor works fine for programming.
There is less setup involved and you don't get silly "project" files.

General chat / Smooth interpolation...
« on: November 17, 2012 »
I stumbled upon this page today and thought it needed to be shared.
It discusses types of interpolation for movement. This can be used for things like movement, Perlin Noise, color cycling etc.

I use interpolation quite a lot and these new tools will get me away from the ever so common linear interpolation.

Projects / Re: A game project I'm working on
« on: November 14, 2012 »
This is really smooth!
Well done.
Are you going to do procedural textures and dungeon layouts?
You might try a splash of color here and there to keep it looking like a 90's game (assuming that is what you are going for)

Projects / The Demons of Cyclic Space (C++ & SDL)
« on: October 28, 2012 »
Greetings again. Recently I've purchased a supurb book "The Magic Machine: A Handbook of Computer Sorcery"  ISBN 0-7167-2125-2

The author outlines an algorithm to produce a gorgeous cycle of color from random noise. Here is my implimentation.
I don't have a Windows computer but it is in SDL so it should be compilable. Ensure that both the .h file and .cpp file are in the same folder.

If you are running SDL on the Pi it will probably work with the following compile line (assuming you have installed SDL and g++)

Ensure both files are in the same folder when you compile.
g++ -o cyclic_space cyclic_space.cpp -lSDL

If a member here could offer a Windows executable it would be great for those not used to compiling C++. :D

Feel free to hack on it and speed it up, it is not my algorithm so feel free to adopt it in your demos and such.
I've simply ported it from the book to a modern language.

The main file cyclic_space.cpp
Code: [Select]
// Ryan Burnside
// 10-26-2012
// "The Demons of Cyclic Space"
// Original algorithm - David Griffeath
// Header Section
#include <SDL/SDL.h>
#include <iostream>
#include <time.h>
#include <vector>
#include "HSLtoRGB.h"
// *** Function Section ***
void putpixel(SDL_Surface* surface, int x, int y, Uint32 pixel);
bool user_quit(SDL_Event &event);
void gen_palette(std::vector<SDL_Color> &colors, int states);
void seed_buffer(int* buffer_start,unsigned int num_elements, int states);
void buffer_flip(SDL_Surface* surface, int* buffer_start,
                 unsigned int width, unsigned int height,
                 std::vector<SDL_Color>& color);
int get_index(int* buffer, int width, int x, int y);
void set_index(int* buffer, int width, int x, int y, int value);
Uint32 TimeLeft(const int TICK_INTERVAL);
void advance_pattern(int* old_buffer, int * new_buffer,
                     unsigned int width, unsigned int height, int max_value);
// *** Body Loop ***
int main (int argc, char** argv)
    srand (time(NULL));
    // Define Constants Section
    const int SCREEN_WIDTH = 256;
    const int SCREEN_HEIGHT = 256;
    const int NUM_STATES = 19; // between 12 and 16 are ideal
    const int TICK_INTERVAL = 10;
    // 2 buffers to hold states of the cells
    int old_buf[SCREEN_WIDTH * SCREEN_HEIGHT];
    int new_buf[SCREEN_WIDTH * SCREEN_HEIGHT];
    seed_buffer(old_buf, NUM_ELEMENTS, NUM_STATES);
    seed_buffer(new_buf, NUM_ELEMENTS, NUM_STATES);
    // Initialize SDL video
    // SDL cleans up before exit
    // Create a new window
    SDL_Surface* screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16,
    // Generate an array of precalculated lookup colors
    std::vector<SDL_Color> colors;
    gen_palette(colors, NUM_STATES);
    SDL_Event event;
    while(user_quit(event) == false)
        advance_pattern(old_buf, new_buf, SCREEN_WIDTH, SCREEN_HEIGHT,
                        NUM_STATES - 1);
        buffer_flip(screen, new_buf, SCREEN_WIDTH, SCREEN_HEIGHT, colors);     
        // Delay for atleast TICK_INTERVAL
    return 0;
// *** Function Definitions ***
bool user_quit(SDL_Event &event)
    // These poll for user quit events.
    switch (event.type)
    case SDL_QUIT:
        return  true;
    case SDL_KEYDOWN:
        if (event.key.keysym.sym == SDLK_ESCAPE)
            return  true;
        return false;
void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
    // Places a pixel of color Uint32 on a SDL_Surface surface.
    int bpp = surface->format->BytesPerPixel;
    /* Here p is the address to the pixel we want to set */
    Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
    case 1:
        *p = pixel;
    case 2:
        *(Uint16 *)p = pixel;
    case 3:
            p[0] = (pixel >> 16) & 0xff;
            p[1] = (pixel >> 8) & 0xff;
            p[2] = pixel & 0xff;
            p[0] = pixel & 0xff;
            p[1] = (pixel >> 8) & 0xff;
            p[2] = (pixel >> 16) & 0xff;
    case 4:
        *(Uint32 *)p = pixel;
void gen_palette(std::vector<SDL_Color>& colors, int states)
    // Fills a std::vector with SDL_Colors for x many states
    // Colors differ by hue for a rainbow effect
    for(int i = 0; i < states; ++i)
        SDL_Color temp;
        float r, g, b; // Used to hold values from function
        float step = 360.0/states;
        HSLtoRGB(i * step, 1, .5, r, g, b);
        temp.r = r;
        temp.g = g;
        temp.b = b;
void seed_buffer(int* buffer_start, unsigned int num_elements, int states)
    // Assign a random color index to the color array.
    for(int i = 0; i < num_elements; ++i)
        *(buffer_start + i) = rand() % states;
void buffer_flip(SDL_Surface* surface, int* buffer_start,
                 unsigned int width, unsigned int height,
                 std::vector<SDL_Color>& color)
    // Blits a state buffer to the SDL_surface screen
    // using mapped colors defined in the std::vector color.
    int counter = 0;
    int color_index = 0;
    // Lock surface for modification
    for(int y = 0; y < height; ++y)
        for(int x = 0; x < width; ++x)
            color_index = *(buffer_start + counter);
            putpixel(surface, x, y, SDL_MapRGB(surface->format,
    // Unlock surface
int get_index(int* buffer, int width, int x, int y)
    // Adapt 2D coordinates to 1 dimension and return index.
    return *(buffer + (width * y + x));
void set_index(int* buffer, int width, int x, int y, int value)
    // Adapt 2D coordinates to 1 dimension and set index.
    *(buffer + (width * y + x)) = value;
Uint32 TimeLeft(const int TICK_INTERVAL)
    // Taken from SDL homepage
    // Returns how many ticls left to wait
    static Uint32 next_time = 0;
    Uint32 now;
    now = SDL_GetTicks();
    if ( next_time <= now ) {
        next_time = now+TICK_INTERVAL;
void advance_pattern(int* old_buffer, int * new_buffer,
                     unsigned int width, unsigned int height, int max_value)
    // Advances the cellular automation pattern 1 step
    // Create a list of points to check for neigbours colors
    int xpart[] = {0, 1, 0, -1};
    int ypart[] = {-1, 0, 1, 0};
    int test_x, test_y, old_color, neighbor_color;
    for(int y = 0; y < height; ++y)
        for(int x = 0; x < width; ++x)
            // Check 8 neighbors using parallel offset arrays
            for(int n = 0; n < 4; ++n)
                test_x = x + xpart[n];
                test_y = y + ypart[n];
                // Wrap test point if need be
                if(test_x < 0)
                    test_x += width;
                if(test_y < 0)
                    test_y += height;
                if(test_x >= width)
                    test_x -= width;
                if(test_y >= height)
                    test_y -= height;
                // Find colors for center point and neighbour
                old_color = get_index(old_buffer, width, x, y);
                neighbor_color = get_index(old_buffer, width, test_x, test_y);
                // If the neighbour is one stage more adopt it for the middle
                if(neighbor_color == old_color + 1)
                    set_index(new_buffer, width, x, y, neighbor_color);
                else if(neighbor_color == 0 && old_color == max_value)
                    set_index(new_buffer, width, x, y, neighbor_color);
    // Copy the new buffer into the old
    memcpy(old_buffer, new_buffer, width * height * sizeof(int));

The HSL to RGB function.

Code: [Select]
#include <cmath>
void HSLtoRGB(float H, float S, float L,
              float& outR, float& outG, float& outB,
              float channel_max = 255, bool fraction = false)
// H [0 - 360] S [0 - 1] V [0 - 1]
  float C = (1 - std::abs(2.0 * L - 1)) * S;
    float H2 = H/60.0;
    float X = C * (1 - std::abs(std::fmod(H2, 2) - 1));
    // define base RGB values
    float r,g,b = 0;
    if(0 <= H2 && H2 < 1)
        r = C;
        g = X;
        b = 0;
    else if(1 <= H2 && H2 < 2)
        r = X;
        g = C;
        b = 0;
    else if(2 <= H2 && H2 < 3)
        r = 0;
        g = C;
        b = X;
    else if(3 <= H2 && H2 < 4)
        r = 0;
        g = X;
        b = C;
    else if(4 <= H2 && H2 < 5)
        r = X;
        g = 0;
        b = C;
    else if(5 <= H2 && H2 < 6)
        r = C;
        g = 0;
        b = X;
    float m = L - C * .5;
    if(fraction == false)
        outR = int((r + m) * channel_max + .5);
        outG = int((g + m) * channel_max + .5);
        outB = int((b + m) * channel_max + .5);
        outR = (r + m) * channel_max;
        outG = (g + m) * channel_max;
        outB = (b + m) * channel_max;

General chat / Re: Happy Birthday Pot Noodle!
« on: June 14, 2012 »
Enjoy this fitting but second hand image.  :carrot:

General chat / Re: First boot of Raspberry Pi!
« on: June 14, 2012 »
I got mine yesterday.
The graphics drivers have yet to be fully implemented.
So as it stands it just runs off off the CPU making it a bit slow.
You might want to select a lower resolution if you have a graphically intense program for now.

You don't have to stick with lxde either, I've installed Openbox, Awesome and Vtwm on mine.
These are less memory intensive but come at the cost of ease of use (no desktop just a window manager).
You may install multiple window managers in Linux by using a utility like slim which allows you to select your desktop at login.
For a really ugly work around you can create a file called .xsession in your home directory and simply call the window manager inside that file.

For those not used to the terminal, nearly every Linux program has a help page or manual.
If you type "man" followed by the command you wish to learn about, you get some handy documentation.

man ls
Brings up help about the file listing command. Pressing the q key quits the manual page.

If you wish to search for a command you can try the apropos command.

Typing "apropos editor" brings up a list of text editors for example.

One last note, Linux is highly configurable so it might not hurt to purchase a little notebook for when you make low level changes to your system.
Also it is often good to make backups of your configuration files before you start editing them.
Now that was a bit long winded. Sorry.  :whack:

General chat / Re: First boot of Raspberry Pi!
« on: June 11, 2012 »

I've been using Debian for some time and here are a few quick tips for those new to it.

1. Debian has less hardware support (especially for wireless devices) than some other distros such as Linux Mint or Ubuntu (which are BASED on Debian)
2. To install new packages (programs) you can use "apt" package manager as the root user.
     First you want to update the system's listing of packages. This can be done with  the following line as the root user:  apt-get update
     Once you have a fresh listing you can search for packages in the listing to see what is available:     apt-cache search  package_name_here
     To install a package you can use the following code as root user:    apt-get install package_name_here

Some packages everyone should install for programming:
gcc (The GNU C compiler)
g++ (The GNU C++ compiler)
python (Python is fast and easy to use for small programs)
python-tk (Allows users to make cross platform GUI programs in Python)
python-pygame (A cross platform game library for Python)

aaaand possibly Java, should you be fond of Satan.

I usually don't use an IDE, I prefer Emacs some prefer Vim or Nano. :)

You can get plenty of cross platform libraries for most languages offered. If you are really sick you can write a demo in Lisp or Fortran.
Just be sure to mention what packages the user should install first. This is preferred to those silly and redundant .dll files. :boxer:

I don't get mine for a week yet....

Challenges & Competitions / Re: [CUBES] Runtime
« on: May 25, 2012 »
This is very stylish.
It reminds me of the classic game Vectorman a bit.
I like how the colors pulse out from the head down, it is better than simply changing all at once.

Challenges & Competitions / Re: [CUBES] Clyde
« on: May 25, 2012 »
For some reason this maks me hungry for toffee or fudge...
Very cool. ;)

Challenges & Competitions / Re: [CUBES] FxCubes
« on: May 25, 2012 »
Very very well done!

Those little slpha light blended cubes are gorgeous and it is so smooth!

I really like this demo.
Lots of style. The lines in the shadow and the square particles really were a nice touch to tie it all together.

Challenges & Competitions / Re: [CUBES] Cub³d
« on: May 25, 2012 »
Very cool!
I had a folding cube like that once... I wonder where I put it.

This is very cool!
Lots of cubes going on there.

It has a really clean fresh feel to it.  :o

Challenges & Competitions / Re: [CUBES] HTTSC
« on: May 06, 2012 »
Very nice entry!

I love the wobble on the main cube. :)

Very cool!
The tune and colors are very cheery feeling.
I like that about it.

Good heavens, boolean subtraction of a fractal!

Amazing work. Awesome to the max!

Challenges & Competitions / Re: [CUBES] Würfel
« on: April 24, 2012 »
Very nice!
Reminiscent of that classic 90's style.
Love the transparency of the cube and inner cube!

Pages: [1] 2 3 4 5 6 7 8 ... 55