Guinea Pigs Wanted!

The enemy movement code mentions gold precisely 3 times:

  // Check to see if the enemy has touched gold!

  if (current == LevelElement::Gold && enemy->getHasGold() == 0) {

    if (random(0, ENEMY_GOLD_PICKUP_THRESHOLD) == 0) {

      enemy->setHasGold(random(ENEMY_GOLD_HOLD_MINIMUM, ENEMY_GOLD_HOLD_MAXIMUM));
      level.setLevelData(enemyX, enemyY, LevelElement::Blank);

    }

  }
          // If the enemy has gold, then make it available to pickup ..

          if (enemy->getHasGold() > ENEMY_GOLD_DROP_VALUE && level.getLevelData(enemyX, enemyY - 1) == LevelElement::Blank) {

            enemy->setHasGold(0);
            level.setLevelData(enemyX, enemyY - 1, LevelElement::Gold);

          }
           
          enemy->setYDelta(0);
          enemy->setEscapeHole(static_cast<EscapeHole>(static_cast<uint8_t>(enemy->getEscapeHole()) - 1));

        }
          // Drop the gold?

          if (enemy->getHasGold() > 0 && isSolid(down) && current == LevelElement::Blank) {

            enemy->setHasGold(enemy->getHasGold() - 1);

            if (enemy->getHasGold() == ENEMY_GOLD_DROP_VALUE) {

              level.setLevelData(enemyX, enemyY, LevelElement::Gold);

            }

          }

The last two cases are mutually exclusive (i.e. only one can occur).

I have been through these and cannot identify a conditon where they would ‘contradict’ each other so to speak.


Though I’ve suddenly had an idea.
I’m going to comment out the code that makes the enemy pick up gold, and if there’s still bits of gold left over at the end of a level then we know it’s the counting code that’s wrong.

1 Like

I am not so sure … if they continue with the gold they will eventually drop it randomly (code or if you bury them later they will drop it (again assuming there is no ladder above them).

I could just make it so you cannot burn under a ladder. It would simplify things a little although I don’t think this is the problem.

Good idea. Are you getting the problem enough that you can reliably repeat it?

ArduboyRecording%20(2)

Sorry, @Dreamer2345, I am not sure what I am looking at.

Is it at this point you are referring? Untitled

The guard on the right should die and regenerate?

Yep Thats the point
Im trying to recreate the phasing
Edit: Its more difficult on the emulator

When the enemies weren’t picking gold up the number was always right, so it’s almost certainly not the counting, it’s more likely the enemies picking up gold for some reason.

(Though I experienced some other oddities like being able to stand on thin air in some circumstances when removing bricks from beneath myself and at one point safely landing on an enemy’s head.)

So the guard can fall into the ‘hole’ at various points. My guess is that he is falling in in the same frame as the hole is completed. A quick (and dirty ?) fix might be to remove the last ‘hole’ (Brick_Close_4) from the test as the hole is almost complete then.

I have changed the movement code so many times now, I might have introduced these errors :frowning:

I Have found a way of making the Phase bug repeatable

Lode_Runner_level3

You can stand on their heads momentarily … some levels even rely on this.

Directly below you? You should be able to dig to the left or right of you. I have a threshold that checks how close to being in a cell you are before you can dig. Originaly, I was really strict but testers complained that it was hard to dig a line of holes quickly …

If I recall, the line getNearestX(2); can be changed to have a bigger or smaller number to change the ‘accuracy’ I forget whether bigger is more accurate or less.

// Burn to the left ..  

if ((justPressed & A_BUTTON) && !(justPressed & B_BUTTON)) { 

 if (inCellY()) { 

   nearestX = getNearestX(2);

OK … I will try this when I get home. I love repeatable bugs!!

Oh good, I thought that was a bug.

I sort of trick it by standing on the edge of the block.
The metric for deciding which block you can dig is larger than the metric for deciding if you’ve fallen off a block it seems.

I’m not complaining about that though, I’m just thinking that means that certain blocks that shouldn’t be solid might be being treated as solid under certain conditions.


One of the reasons I haven’t tested more is that once LodeRunner is on my unit it’s a little hard to get it off again, I have to rely on a well timed reset.

Really? I am not having that problem.

Actually its really simple - don’t take it off?

Touché.

Yeah. I’ll try again tomorrow if you want, but neither ‘flashlight’ nor regular attempts to reupload seem to work.

Version 0.99 is out! OK, before anyone points it out I am running out of version numbers before I go ‘gold’ (pun intended).

New Features / Fixes / Fudges

  • The gold issue!!! Turns out that if you died while the enemy guards were carrying a piece of gold, they didn’t give it up and when the level restarted all of the pieces were replaced on the level - hence more than expected pieces.
  • The issue @Dreamer was able to reproduce. Funny, I couldn’t do it on that level he was talking about but managed on Level 1.
  • You only get 1 extra life per level, not ten. Sorry.
  • Level 9 … a simple tweak to make it easier.
  • EDIT: You can’t dig a hole under a ladder enymore.

To Do

  • Sort out the ‘Men’ count after a restore.
    I cannot reproduce this one!

The new HEX can be found here > https://github.com/filmote/LodeRunner/tree/master/distributable
Source code can be found here > https://github.com/filmote/LodeRunner/releases

1 Like

0.100 is a legal version number, and so is 0.65535.
Though I’m pretty sure neither are semver compliant.

*fanfare*
This is also one of those “*headdesk*, why didn’t we think of that sooner” problems.

Not too many sub- 1.00 numbers left.

I feel like a goose … I can’t believe I didn’t find it earlier.

1 Like

@filmote
The thing about the sound was the sound it makes when we die, it seems to loop until we get back in the game, so if you don’t press a button on the Try Again! screen it just loops forever.

I just finished level 9 with the latest version 0.99 and when climbing up to level 10, I couldn’t exit but the number of levels was going up (I stopped at Lvl 12). When restating my ardudboy I could start directly at level 12.

I’ll update right away!

Edit: after playing for a little while, some notes

+1 on the level not ending but adding to the level counter (its possible to engage the winning screen by doing this)

+1 on the death music playing forever

A new issue is when you reach the max levels and then go back to the main menu, if you choose resume game the Arduboy freezes and you have to turn it on then off again to begin, when it should just go to a new game.

Other than that, the men still seem to be kind of buggy. No good way to describe this, other than some random oddities when playing.

This game is really super fun!

The new version 5 release of the Arduboy2 library will probably get you some. I don’t know if it will be enough, though.