Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Must... Stop... Playing...

Sign in to follow this  


So I'm supposed to be writing a GLSL shader/GPGPU version of my rock-paper-scissors cellular automata. Unfortunately, I got sidetracked again.

I decided to begin by implementing Conway's Game of Life in a shader before I move on to rock-paper-scissors. I'm running a Geforce GTX 260 with 216 shader cores, so even though it's a very naive and slow algorithm (plainly does 8 texel lookups/cell/generation), I'm getting about 2000 FPS @ 1024x1024. That's about 2 billion cells processed per second, and if my calculations are correct, 30% of each frame is overhead.

The r-pentomino:

For a few hours, I thought I had a bug, because I just couldn't get a pattern to last... I had read that the "r-pentomino" was a well-known pattern that takes many iterations to complete. So I created a "brush" that would allow me to place r-pentominos with the mouse. It didn't seem to work -- this is supposed to be a notable "methuselah," as A-life scientists like to call them, a small pattern that's famous for the number of iterations it takes for it to stabilize, and the amount of "life forms" it generates -- but it just created this short-lived pattern...

After reading further, I discovered that the r-pentomino actually stabilizes after 1109 iterations -- at 2000 FPS, that completes in a little over half a second! No wonder. My program was working just fine.

Once I understood this, I went on a google quest to find some of the larger methuselah... At some point, I was playing around randomly placing cells, and I saw this amazing thing appear on my screen -- like a diagonal laser beam that went straight towards a group of cells, "ate through" them, then got reflected and continued until it hit another group of pixels and finally died.

I have no idea what that thing was. All I know is I've never seen it before, and I might never see it again... For hours, I tried to find what I did that caused that laser beam to appear... It clearly wasn't an artifact... I just added some pixels to a random area and the beam shot out of there.

So I'm basically playing mad scientist now... Splicing, building, looking for new undiscovered patterns... But it's not what I'm supposed to do!

I'm trying to find reasons to quit playing around with the Game of Life now... Here's a list:

[quote]People with PhDs already discovered anything you might discover in your lifetime!
The only reason patterns look like little animals is because the algorithm is symmetrical! Don't be fooled, the faces and spaceships are actually uninteresting jumbles of pixels!
Markus Persson has over 40 million dollars by now; are you seriously sitting on your ass watching little black and white pixels eat each other?
For every glider gun you assemble, your wife is this much closer to leaving you.
You know what's more productive than playing the Game of Life? Masturbating.

Okay... I think this little auto-pep talk's motivated me.

Moving on. I need to get my rock paper scissors algorithm into a shader. I hadn't really foreseen the difficulties, to be honest. The way I have things set up in my C++ CPU version is simply not compatible with GPGPU concepts. I have to go back to the drawing board and completely rethink most of my optimizations...

Looking into paletted modes right now... To be continued.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!