The other day I read an article about how to create fractals using the midpoint displacement algorithm. It's a simple recursive algorithm where you take a square, and split it into 4 smaller squares while displacing the height of the corner where the 4 squares join by a random amount. This process is repeated, creating smaller squares which gradually make a smoother terrain.
I spent an hour or two writing a PHP script to make a terrain image using this method. After I got some decent looking greyscale images, I added a color map so I could create colored oceans and mountains.
Today I modified my old 3D graph script to generate 3D terrains using a bitmap and elevation map from my new fractal
Here is what it looks like:
I might work on getting a terrain generator running in the iPhone, and rendering it with OpenGL.
The other night while watching a cartoon, I thought of a way to create levels for my iPhone game by scanning an image drawn on graph paper. To do this I need to access the raw pixel data from a CGImage. I already have a method that is loading png images into OpenGL texture maps, so I started modifying it to get the pixel data. I made some progress altering the pixels, which can lead to procedural texture generation later. I am going to try to make a program that detect shaded cells on graph paper and convert them to polygons in my game level.
I just discovered twitterfeed.com/ , where I can post to my blog, and twitter feed will find new posts in my RSS feed and post to twitter and facebook automatically. Hopefully this will encourage me to write in my blog more often, knowing that my posts will be distributed to more people without any extra effort.
Dreamhost has just added beta support for PHP 5.3. I can finally start implementing the new language features I've read about. Unfortunately, I just discovered it breaks all my scripts that use GD, so I had to switch back to 5.2
Yesterday I moved the code that draws the walls in my maze app to the MazeParts class. Now it can share memory with the floor drawing code and got rid of the allocating/deallocating memory on each frame rendered. I
also enabled the depth buffer and depth sorting, finally the walls are overlapping correctly. I started adding some code to load a plist file into an array. This will help me create levels besides the random mazes it makes now.
Did some more iPhone programming. The other day I took some of the maze drawing code and put it into a new MazeParts class. This class will be handling the drawing of the floor and walls of the maze. It will make the renderer file cleaner and easier to work with. Today I rewrote the floor drawing code to use translation calls instead of rebuilding vertex and texture buffer data for each floor tile. Next I will do something similar to draw the walls. I also added a setting to my info.plist file to hide the status bar.
I'm excited about the new iPhone 3GS. The hardware support for OpenGL ES 2.0 will make it more fun to explore advanced graphics in my projects. I have a basic 3D maze running on my iPod touch, and it would be awesome to be able to add shader programs to it.
Here's the link for info about winning an iPhone 3GS from QuickPWN
I got a Macbook Pro
Last month I purchased a new unibody 15" Macbook Pro. It is my first Mac in over 10 years. It's so nice owning a Mac again. I've been dabbling in iPhone development since I got it, and I have a basic OpenGL application working. My app lets me move a marble around the screen using the Macbook's accelerometer.
I used the accelerometer simulator
and the unimotion program unimotion.sourceforge.net/ to accomplish this. It would be nice to have this functionality built into the iPhone simulator.
I bought a book about game physics, and I'm on my way to creating a great game. Next I will be simulating interactions between multiple marbles, and figuring out how to load level configurations.
Presenting SproutWorks 3D Digg Explorer