Biomaze rules in game

Discussion about Rocks'n'Diamonds, Boulder Dash, Supaplex, Emerald Mine and any other BD hybrid.

Moderators: Zomis, Flumminator

Post Reply
andrzejlisek
Posts: 1
Joined: Fri Apr 25, 2014 10:19 pm

Biomaze rules in game

Post by andrzejlisek » Sat Apr 26, 2014 9:06 am

Biomaze is described as a modified variant of Conway's Game Of Life.

What is the exactly generation rules and how biomaze differs from classic Conway's Game of Life?

I would like to imlement the biomaze as cellular automation.

Eizzoux
Posts: 307
Joined: Wed Oct 30, 2013 5:32 am
Location: Russia
Contact:

Re: Biomaze rules in game

Post by Eizzoux » Sun Jun 22, 2014 10:17 am

Conway's game of life eventually disappears without player. It multiplies only with player.
Biomaze eventually multiplies. It doesn't need player.

That's all what can I say...
Nothing in here...*

Zomis
Posts: 1501
Joined: Mon Jun 21, 2004 1:27 pm
Location: Sweden
Contact:

Re: Biomaze rules in game

Post by Zomis » Wed Jun 25, 2014 6:03 pm

From a little source investigation, there is a `Life` method inside `game.c` that controls both Biomaze and Game of Life.

When stripping out the Game of Life part and other fluff, I believe it boils down to this:

Code: Select all

void Life(int ax, int ay)
{
  int x1, y1, x2, y2;
  int life_time = 40;
  int element = Feld[ax][ay];
  int graphic = el2img(element);
  int *life_parameter = level.biomaze;
  boolean changed = FALSE;

  if (Stop[ax][ay])
    return;

  for (y1 = -1; y1 < 2; y1++) for (x1 = -1; x1 < 2; x1++)
  {
    int xx = ax+x1, yy = ay+y1;
    int nachbarn = 0;

    if (!IN_LEV_FIELD(xx, yy))
      continue;

    for (y2 = -1; y2 < 2; y2++) for (x2 = -1; x2 < 2; x2++)
    {
      int x = xx+x2, y = yy+y2;

      if (!IN_LEV_FIELD(x, y) || (x == xx && y == yy))
	continue;

      if (((Feld[x][y] == element) && !Stop[x][y]) ||
	  (IS_FREE(x, y) && Stop[x][y]))
	nachbarn++;
    }

    if (xx == ax && yy == ay)		/* field in the middle */
    {
      if (nachbarn < life_parameter[0] ||
	  nachbarn > life_parameter[1])
      {
	Feld[xx][yy] = EL_EMPTY;
	if (!Stop[xx][yy])
	  DrawLevelField(xx, yy);
	Stop[xx][yy] = TRUE;
	changed = TRUE;
      }
    }
    else if (IS_FREE(xx, yy) || CAN_GROW_INTO(Feld[xx][yy]))
    {					/* free border field */
      if (nachbarn >= life_parameter[2] &&
	  nachbarn <= life_parameter[3])
      {
	Feld[xx][yy] = element;
	MovDelay[xx][yy] = life_time-1;
	if (!Stop[xx][yy])
	  DrawLevelField(xx, yy);
	Stop[xx][yy] = TRUE;
	changed = TRUE;
      }
    }
  }
}
 
It seems like the Biomaze does indeed work just like Conway's Game of Life, which means that it will be quite easy to implement it as cellular automata.

Although I have to say that I can't really put my finger on what is causing the difference in behavior between Biomaze and Game Of Life. From what I can see from the code, it should exactly the same except for how it treats the player. From what I can see in the game though, it doesn't. Compare the case when you have three tiles in a row of Biomaze vs. Game Of Life. Game of Life just switches between horizontal and vertical, while Biomaze suddenly creates a `+` sign and then starts to grow from there.

filbo
Posts: 357
Joined: Fri Jun 20, 2014 10:06 am

Re: Biomaze rules in game

Post by filbo » Thu Jun 26, 2014 8:05 am

I think one key difference is:

MovDelay[xx][yy] = (element == EL_GAME_OF_LIFE ? 0 : life_time-1);

After an element is "born" in the game-of-life implementation, it is immediately ready for the next generation. In the biomaze implementation it is delayed from participating for some number of game cycles. `life_time' is 40, and I think game actions are 50/sec?

I haven't puzzled it all out. But it looks like all the Life elements cycle on precisely the same cycle points (every 40 game cycles), while Biomaze elements get out of sync with each other.

This would probably make it *much* harder to emulate Biomaze in a traditional cellular automaton.

A second difference is that both kinds of element have additional parameters. Go into the level editor, select Life or Biomaze, '?', Config: notice that levels can choose entirely different Life-like CAs. I don't know if I've actually seen a level which does this. Both games are initially configured with the usual "stay alive if you have 2 or 3 neighbors, come to life if an empty square has exactly 3 neighbors" rule. With the added change that the player is considered in the neighbor count, for the Life variant.
Last edited by filbo on Thu Jun 26, 2014 8:20 am, edited 1 time in total.

filbo
Posts: 357
Joined: Fri Jun 20, 2014 10:06 am

Re: Biomaze rules in game

Post by filbo » Thu Jun 26, 2014 8:18 am

To explore this I made a 15x15 level, empty except for the player and one element of Life; and changed the Life parameter "Min neighbors to create" to 1.

Play this level. Interact with the Life elements. Observe that the whole board changes once per cycle (every second or so?). Listen. Observe that it makes the Life "twitter" sound once per cycle.

Now change it to one element of Biomaze, and change its parameters the same way.

Playing with this level, observe that over time the riot of Biomaze elements starts to cycle out of sync with itself. Individual elements flicker on and off at any time within a second. The "twitter" sound is repeated much more frequently, overlaps with itself, sounds like a flock of birds.

Other fun demonstrations: add 10 moles to stir the pot more quickly.

Put in one element each of Life + Biomaze, watch as the yellow Life elements change strictly in sync -- and the red Biomaze elements change more randomly.

filbo
Posts: 357
Joined: Fri Jun 20, 2014 10:06 am

Re: Biomaze rules in game

Post by filbo » Thu Jun 26, 2014 9:42 am

Here is a toy level that demonstrates differences in 'Life' vs 'Biomaze' behavior.

The main difference is that Life cycles all at once while Biomaze cells are each on their own separate time cycle.

This level also demonstrates a bug: observe how the rocks, moles, player, and sometimes gems from killed moles or player, are obstructed in their motion by invisible blocks. I suspect this is due to leftover values in the Stop[][] array in the source.
Attachments
life-biomaze.zip
Toy level that demonstrates differences in 'Life' vs 'Biomaze' behavior
(551 Bytes) Downloaded 324 times

Post Reply