Reply to topic  [ 3 posts ] 
Updated Game Of Life 
Author Message
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Just submitted an update to my Game of Life app.

CLICKY!

I've added a few nice features to it and massively massively increased the performance.

The new features are...
* You can now change the speed at which the simulation runs. The current version runs at 10 GPS (generationns per second). You can now change it to run anywhere from 5 seconds per generation to 60GPS.
* You can now toggle edge wrapping on and off.

The main changes are "under the hood" though. I wouldn't have been able to just ramp the speed up to 60GPS as the sim and the drawing just wouldn't handle it. I've had to optimise the GOL engine and the way it draws to get the best performance out of it.

Now it uses bit operations to speed up the way it calculates whether a cell should be alive or dead in the next generation and it also keeps track of which parts of the map are changing. It only checks cells that either changed themselves or have neighbours who changed in the last generation step.

So, if there is a single cell that keeps flashing on and off then the whole generation step only checks 9 cells.

Very pleased with it. Except I've had to pull it as I found a tiny bug but that will be fixed and resubmitted tonight :D So far I've had about 15 5 star reviews (from around the world) and I don't want to let a tiny, easy to fix bug ruin it.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon May 21, 2012 2:07 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
Right, uploaded an updated version.

I've actually added something that I was thinking of the other day also so that's good.

You can now show/hide the stats on the population. It just shows Generation number and Population count.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Mon May 21, 2012 9:06 pm
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 7:35 pm
Posts: 6580
Location: Getting there
Reply with quote
OK, just updated the draw function to improve performance even further.

I'm not going to release it though.

If I keep submitting updates it'll never actually get approved.

Before I started tonight the draw function went through every single cell on the screen and checked if it was alive. If it was alive it then drew a rectangle onto the screen for that cell.

i.e. for y from 0 to 48
for x from 0 to 32
if cellIsAlive (runs on the model)
then draw rect at (x, y).

Now it sends an x, y coord into the model and gets back a width and whether that width is alive or dead.
If it is alive it adds a rectangle starting from x, y of the width and adds width to the x value.
If it is not alive it just adds width to the x value.
When x gets to the end of the line it goes to the next line.

::EDIT::

Gah! I gave in to temptation and resubmitted my latest version. It takes it from a max of around 35GPS (Generations Per Second) to a mix of around 56-57GPS.

Considering that the maximum FPS on an iPhone is 60FPS I'm quite pleased with that :D

Still room for improvement though.

_________________
Oliver Foggin - iPhone Dev

JJW009 wrote:
The count will go up until they stop counting. That's the way counting works.


Doodle Sub!
Game Of Life

Image Image


Tue May 22, 2012 9:20 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.