pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

Micro:bit based Arcades - Crashing to a white/blank screen

Open KitronikLtd opened this issue 10 months ago • 12 comments

Description: We have seen at least three instances from customers, where a Micro:bit based arcade will lock up with a white screen at seemingly random intervals. The bug can be reproduced on any Micro:bit based Arcade (not just our Arcade) - suggesting that the issue may be related to the software, rather than the hardware. We were first made aware of this issue on the 19th of February 2025.

Reproduction: Attached is an example game where the lockup issue has been noted: https://makecode.com/_3U6aocWm45Hx At seemingly random points, a Micro:bit based arcade will lock up with white screen, whereas a D51 based arcade does not appear to show the same behavior.

Screenshots:

Image

Image

Desktop:

  • OS: Windows 10 (Version 10.0.19045 Build 19045)
  • Browser: Microsoft Edge (Version 133.0.3065.82)

KitronikLtd avatar Feb 25 '25 09:02 KitronikLtd

Able to repro.

This is likely the device driver bug recently fixed for pxt-microbit: https://github.com/lancaster-university/codal-core/commit/1bc6d4d10c47f4fe34e2a54004530d5071e892d4

Have the same bug in pxt-common-packages

thomasjball avatar Dec 01 '25 21:12 thomasjball

Will bring this fix over for arcade shields for the mIcro:bit in pxt-arcade

thomasjball avatar Dec 01 '25 21:12 thomasjball

Brilliant, thank you!

JakeAtKitronik avatar Dec 02 '25 08:12 JakeAtKitronik

Fix from pxt-microbit doesn't solve this problem. Will investigate further. Smaller repro: https://makecode.com/_R50XkoabdH7T

thomasjball avatar Dec 04 '25 04:12 thomasjball

Ah, no worries - let us know if you find something!

JakeAtKitronik avatar Dec 04 '25 09:12 JakeAtKitronik

@JakeAtKitronik - so, the above smaller version of the game doesn't crash with arcade.makecode.com. Very interesting... this the main game loop where the crash was always happening before. Will need to do some delta debugging to figure out what feature is exposing the crash/hang.

It looks like it arises only in the presence of https://github.com/riknoll/arcade-story, which creates its own game.update and spawns fibers. Will work on getting a smaller repro.

thomasjball avatar Dec 05 '25 23:12 thomasjball

Here is a small version that still hangs: https://arcade.makecode.com/S72793-23201-69196-55025.

If you replace call to Storyline with call to game2, it works fine. So there seems to be some interaction with the story extension: riknoll/arcade-story. Here is the story code from the app

function Storyline () {
    // we need to have this story part to trigger the bug
    story.queueStoryPart(function () {
        mySprite = sprites.create(img`
            ELIDED
            `, SpriteKind.Player)
        mySprite.setPosition(14, 80)
        // [1] commenting this out removes failure
        story.spriteSayText(mySprite, "\"Where am I?\"", 15, 1)
    })
    story.queueStoryPart(function () {
        sprites.destroyAllSpritesOfKind(SpriteKind.scenery)
        sprites.destroyAllSpritesOfKind(SpriteKind.Player)
        game2()
    })
}

thomasjball avatar Dec 08 '25 18:12 thomasjball

  • also note that music doesn't play in the failing run, once we comment out the spriteSayText, we get the music...
  • the say text plays clicks (updatecore as the text appears)

Likely we have some bad interaction with music and play sounds...

thomasjball avatar Dec 08 '25 22:12 thomasjball

indeed, if we stop the tick sound that arcade-story does, everything works fine!

thomasjball avatar Dec 08 '25 23:12 thomasjball

Here is a minimal repro: https://makecode.com/_biwd9hLvmhz3. Sounds don't play; screen goes blank within 30-60 seconds.

thomasjball avatar Dec 08 '25 23:12 thomasjball

This program works fine, but adding a call to tenTicks() before music.stopAllSounds() causes the failure


function tick () {
    music.setVolume(20)
    tickSound.play();
}
const tickSound = new music.Melody("@20,10,0,0 c5:1-150")

function tenTicks() {
    for (let index = 0; index < 10; index++) {
        tick()
        pause(90)
    }
}


music.stopAllSounds()
music.setVolume(50)
music.play(music.createSong(hex`006e000408040109010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c800920000000100010008000900020d0e14001500010018001900020d0e20002100010024002500010028002900020d0e2c002d00010034003500010038003900020d0e40004100010048004900020d0e4c004d00010054005500010058005900020d0e600061000100640065000211046c006d0002120670007100011274007500030c120678007900030e12067c007d0003101206`), music.PlaybackMode.LoopingInBackground)
music.play(music.createSong(hex`006e000408040205001c000f0a006400f4010a0000040000000000000000000000000000000002360000000400012414001800011e18001c0001221c002000012220002400012440004400011d54005800011e5c006000011b60006400011d09010e02026400000403780000040a000301000000640001c80000040100000000640001640000040100000000fa0004af00000401c80000040a00019600000414000501006400140005010000002c0104dc00000401fa0000040a0001c8000004140005d0076400140005d0070000c800029001f40105c201f4010a0005900114001400039001000005c201f4010500058403050032000584030000fa00049001000005c201f4010500058403c80032000584030500640005840300009001049001000005c201f4010500058403c80064000584030500c8000584030000f40105ac0d000404a00f00000a0004ac0d2003010004a00f0000280004ac0d9001010004a00f0000280002d00700040408070f0064000408070000c80003c800c8000e7d00c80019000e64000f0032000e78000000fa00032c01c8000ee100c80019000ec8000f0032000edc000000fa0003f401c8000ea901c80019000e90010f0032000ea4010000fa0001c8000004014b000000c800012c01000401c8000000c8000190010004012c010000c80002c800000404c8000f0064000496000000c80002c2010004045e010f006400042c010000640002c409000404c4096400960004f6090000f40102b80b000404b80b64002c0104f40b0000f401022003000004200300040a000420030000ea01029001000004900100040a000490010000900102d007000410d0076400960010d0070000c800e4000000010002020504000500010508000900040d0e04050c000d0001051000110002000514001500010518001900040d0e03051c001d00010720002100010524002500010528002900040d0e04052c002d0001053000310002000534003500010538003900040d0e04053c003d0001074000410002020544004500010548004900040d0e04054c004d000105500051000201055400550002040558005900030d0e055c005d0001076000610002020564006500021105680069000204056c006d00021205700071000312010574007500040c12040578007900030e12057c007d0003101206`), music.PlaybackMode.LoopingInBackground)

scene.setBackgroundColor(9)
let mySprite = sprites.create(img`
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . . . . . . . . 
    . . . . 3 3 . . . . . . . . . . 
    . . . 3 . . 3 3 2 2 . . . . . . 
    . . . 3 . . . . . . 2 . . . . . 
    . . . . . . . . 2 2 2 2 . . . . 
    . . . . 2 2 2 2 . . 2 2 3 . . . 
    . . 2 2 2 2 2 2 2 2 2 2 . . . . 
    . . 2 2 2 . 3 2 3 2 2 . . . . . 
    . . 2 3 2 . . 3 2 2 2 . . . . . 
    . 3 2 . 2 3 3 2 2 2 . . . . . . 
    . . 3 2 2 2 2 2 2 2 . . . . . . 
    . . . 3 3 3 . . . 2 . . . . . . 
    . . . . . . . . 2 2 . . . . . . 
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . . . . . . . . 
    `, SpriteKind.Player)
controller.moveSprite(mySprite)

thomasjball avatar Dec 09 '25 00:12 thomasjball

That is certainly odd, but at least it sounds like you are making progress!

JakeAtKitronik avatar Dec 09 '25 08:12 JakeAtKitronik