FBS DevLab
User Functions
Username:

Password:

Don't have an account yet? Sign up as a New User

Events
There are no upcoming events

Older Stories
Wednesday 03-Dec
  • Blob Redux (26)

  • Tuesday 04-Nov
  • Virtools P5 Glove Building Block (28)

  • Thursday 16-Oct
  • Ragdoll Bull Riding (29)

  • Saturday 11-Oct
  • Fun With Limits (30)
  • Object Precaching Techniques (32)
  • Spring Toolkit (23)

  • Sunday 28-Sep
  • 50th Post, Been Busy (Yet Again) (24)

  • Saturday 20-Sep
  • Game of Life, First Optimizations (19)
  • IGDA Slides - Music Games (23)

  • Sunday 14-Sep
  • Conway's Game of Life (24)


  • Game of Life, First Optimizations
    Saturday, September 20 2003 @ 06:56 PM EDT, Matthew
    I did some quick optimizations to the initial Game of Life test, the results of which are online here (S to change time stepping).

    The major bottleneck in the intial test was the active neighbor counting; each count, the list of neighbors was queried from the master grid array. This is entirely extraneous, as the relationship between tiles was unchanging. That is, the list of neighbors for each tile is constant (so looking them up each count was unneeded).

    In this version, an array containing a list of neighbors is generated for each tile when the grid is created, and referenced via an attribute on the tile. Additionally, the active boolean state was moved from the grid array to an attribute on the tile. So, to count active neighbors all we need to do is iterate over this array and test the active boolean attribute.

    This is much faster than the older method, although still has some extraneous aspects. Primarily, neighbors are being counted each generation, even if their neighbor count hasn't changed (large dead areas, for instance). The solution is to add a neighbor count attribute for each tile. The count simply uses this attribute, which is changed when a tile is activated or deactivated.

    Next, I'll look at using VSL to replace the bulk of the schematic. The source CMO for the updated version is available, as always.

        


    What's Related
  • here
  • available

  • Story Options
  • Printable Story Format