BoulderDash Creature Info

The information in this document is generally intended for implementers of BoulderDash, to assist them in getting the creatures to behave in the correct way. Note that where program code is shown, the code is written in some weird combination of popular high level procedural languages, and is not directly executable (and may contain flaws).

Inside this document:


Fireflies and butterflies

This section has been replaced by the BDCFF firefly specification and the BDCFF butterfly specification.


Boulders and diamonds

This section has been mostly replaced by the BDCFF boulder specification and the BDCFF diamond specification.

Boulders and diamonds which are sitting on top of a brick wall ($02), stationary boulder ($10) or stationary diamond ($14), can roll off.

When a boulder or diamond begins falling or hits an object, it plays the appropriate boulder sound or diamond sound.


Amoeba

This section has been mostly replaced by the BDCFF amoeba specification.

The "amoeba slow groth time" is given at offset $01 of the cave data; note that this is the same position as the "magic wall milling time"; it is assumed that both magic wall and amoeba will not coexist in the same cave.


Magic wall

This section has been mostly replaced by the BDCFF magic wall specification.

When a boulder or diamond hits a magic wall, regardless of its state, it makes a diamond sound or boulder sound respectively. The magic wall milling time is given by the value at offset $01 in the cave data).


Explosions

Explosions can be caused by a number of different things:

What things explode?

When an explosion occurs, a 3 x 3 area centered on the creature exploding is affected. Any objects in that 3 x 3 area, with the exception of steel wall ($07) are destroyed. Note that the objects pre-outbox ($04), outbox ($05), and pre-Rockfords ($25, $26, $27, $28) apparently are destroyed should they occur in an explosion, however this would not be a good idea: this must be an oversight either on my part (looking through the program) or on the programmer's part (when writing the code).

Explode to space or diamonds?

If the object exploding is a firefly or Rockford, the end result will be a 3 x 3 area of space. If the object is a butterfly, the end result will be a 3 x 3 area of diamonds. Chain explosions do not occur (a butterfly caught in another butterfly's explosion does not in turn explode, creating even more diamonds).

Four stages of explosion

The explosion takes four frames to finish. If you examine the object codes, however, you will see that there are five stages of explosion. The reason is that when a scan is taking place, and an object at (x,y) explodes, this will affect spaces that have not yet been scanned (eg at (x+1,y+1)). Spaces before the current scan position are set to explosion stage 1, and spaces after the current scan position are set to explosion stage 0, so that by the time the scan finishes they will be at explosion stage 1 just like the others.

Properties of an exploding object

The explosion spaces act like wall in the sense that creatures can not enter an explosion. Should a falling diamond or boulder hit an exlosion, it will stop falling (complete with sound) as if it were a bit of dirt; they do not roll off. Explosions can be exploded again (they get reset to a stage 1 explosion, and set to the appropriate type of explosion: explode to space, or explode to diamonds).

Sound of an explosion

A specific sound is played when an object explodes: there is no difference as to whether the object is exploding into space or into diamonds.

General Algorithm

procedure ScanExplosion(in positionType explosionPosition;
                        in explosionType explodeToWhat;
                        in integer explosionStage)
# Morph the explosion into the next stage of the explosion.
    ASSERT((explosionStage >= 0) and (explosionStage <= 4));

# Explosion stages zero to 3 morph into stages 1 to 4
    if (explosionStage <= 3) then
        PlaceExplosion(explosionPosition, explodeToWhat, explosionStage+1);
    else

# Explosion stage 4 morphs into a space or a diamond as appropriate.
        if (explodeToWhat == explodeToSpace) then
            PlaceSpace(explosionPosition);
        else
            PlaceStationaryDiamond(explosionPosition);
        endif
    endif
endprocedure

##

procedure Explode(in positionType explosionPosition;
                  in explosionType explodeToWhat)
# Explode something at the specified position into the specified object type

# The spaces prior to and including the current space in the scan sequence
# are set to a stage 1 explosion.
    Explode1Space(GetRelativePosition(explosionPosition, up1left), explodeToWhat, 1);
    Explode1Space(GetRelativePosition(explosionPosition, up1), explodeToWhat, 1);
    Explode1Space(GetRelativePosition(explosionPosition, up1right), explodeToWhat, 1);
    Explode1Space(GetRelativePosition(explosionPosition, left1), explodeToWhat, 1);
    Explode1Space(explosionPosition, explodeToWhat, 1);

# The spaces after the current scan position are set to a stage 0 explosion,
# so that they will be a stage 1 explosion by the end of the scan frame.
    Explode1Space(GetRelativePosition(explosionPosition, right1), explodeToWhat, 0);
    Explode1Space(GetRelativePosition(explosionPosition, down1left), explodeToWhat, 0);
    Explode1Space(GetRelativePosition(explosionPosition, down1), explodeToWhat, 0);
    Explode1Space(GetRelativePosition(explosionPosition, down1right), explodeToWhat, 0);
    RequestSound(explosionSound);
endprocedure

##

procedure Explode1Space(in positionType explosionPosition;
                         in explosionType explodeToWhat;
                         in integer explosionStage)
# Explode one space to the required stage and type of explosion, checking
# whether the object at this space can be exploded first.
# Note that if the object that gets exploded happens to be Rockford, then naturally
# Rockford will no longer be in existance. However, we don't explicitely check whether
# we are exploding Rockford here; his absence will be noticed next scan frame
# if we don't come across Rockford at any time during the next scan frame.
    ASSERT((explosionStage == 0) or (explosionStage == 1));

    if (GetObjectAtPosition(explosionPosition) != objSteelWall) then
        PlaceExplosion(explosionPosition, explodeToWhat, explosionStage);
    endif
endprocedure

Web page design by Peter Broadribb <peterb@perth.dialix.oz.au>