[Game]Matti's Nightmare

You could:

  • Implement SD functionality in micropython so you can load rooms from the SD card
  • Try using tuples instead of lists in some cases
  • Find ways to use byte strings instead of numbered lists
  • Switch to C++
1 Like

Probably later, when there are tens or hundreds :wink: of rooms, that have to be done. For now, I want to keep this game playable also without SD.

Right, as tuples are immutable one would think it goes to rom. I could check it but as I have not seen that in any MP documentation I suspect it is still in ram…

Could you elaborate this?

Maybe, when @Fmanga gets the IDE to the same level regarding of integrated tools :wink:

You could also split the game into two separate bins if you have already a lot of rooms. A PokittoCookie can be used to make sure that the second bin can only be played once all levels in the first part have been completed.

1 Like

Why?

I was under the impression that most people have a micro SD for their Pokitto.

I was just thinking that they are probably cheaper/more lightweight than lists, but I don’t know for definite.

A quick glance at the micropython source code would imply that tuples are probably sizeof(size_t) bytes smaller than lists.
That’s not much, but it would soon add up.

If references can be generated at compile time then it’s possible that they could be stored in ROM, but if not then they’d have to be stored in RAM.

I would assume that:

b'\x3C\x0A\x00\x01\x01\x03\x02\x80\x00\x7F\x6E\x00\x00\x00'

Uses less memory than:

[60, 10, 0, 1, 1, 3, 2, -999, 0, 999,  14*8, 0, False, False, False]

Because ‘bytestrings’ should be using bytes.

But that also depends whether or not -999 and 999 are important.
I’m assuming from their values that they’re just supposed to represent a maximum and minimum, hence I translated them to \x80 (-128) and \x7F (127).

At the very least you might be able to pack the Falses into a bit vector if python has a ‘byte’ datatype.

What tools do you need other than ‘compile’ and ‘upload’?

I’m presuming from the fact you mentioned FManga you use the custom version of Code::Blocks rather than EmBitz or PlatformIO and an editor?


To me that seems like more hassle than requiring extra files on the SD card.

For one thing, to keep the .bins available for use on the go you’d need an SD card anyway,
at which point you may as well just make the game refer to files on the SD card in the first place since it would be less hassle for the end user (i.e. no need to flash .bins to change rooms).

Not necessarily, The SD game card is +5 euros if you buy a Pokitto. Thought, SD cards are so cheap that it is not a hard requirement to have that for a game.

Yes, that is what I already talked about in my previous post.

I was referencing to FemtoIDE discussed about in the Discord channel. An integrated pixel editor and sound importing would make life a lot easier. :slight_smile:

Check the video. Still need to do sound support, though.

I have at least 4-5 SD cards of various sizes lying around.
I’d be very surprised to encounter someone who doesn’t own a single SD card (be it micro SD or regular).

I don’t use Discord, so this is the first I’ve heard of this.

Phew! Finally!

I have now changed the room definition format to use less ram. Before, five rooms took about 10 KB, including list of sprites, tiles, etc. Now it takes about 3 KB :slight_smile: It was an exhausting task first to figure out how to save ram, and then change the room definitions and room “loading” logic accordingly.

This is what I did:

  • Used tuples instead of lists
  • Reduced the number levels in the tuple-tree
  • Packed all 8-bit values to one bytes literal

Now, one room definition looks like this:

    ( # *** room5
        
        "Nightmare begins",
        
        # Tile definitions
        (
            # id  bitmap               flags
            0x0, data.backgroundSurf0, 0,
            0x1, data.wallSurf1,      glob.TILE_FLAG_BLOCKING,
            0x7, data.backgroundSurf1, 0,
            0xC, data.floorSurf0,      glob.TILE_FLAG_BLOCKING | glob.TILE_FLAG_PLATFORM,
        ),

        # Exit triggers
        (
            # id, newRoom,   newX,                   newY 
            0xf,  3,    8,  -999,
        ),
        
        # Sprites
        (           
            # Scissors
            # Bitmaps
            (
                # bitmap         offset
                data.scissorsSurf0, (-2,0), 
                data.scissorsSurf1, (2,0),
                data.scissorsSurf2, (0,0), 
                data.scissorsSurf1, (0,0),
            ),
            # wx, wy,  bx1,   by1,      bx2,   by2
            60,   10,  -999,     0,   999,  14*8,
            #   id trg  vx  vy adu dir del bTy hfl vfl coi
            b'\x00\xff\x00\x01\x01\x03\x02\x00\x00\x00\x00',

            # Clock
            # Bitmaps
            (
                # bitmap         offset
                data.clockSurf0, (0,0), 
                data.clockSurf1, (0,0),
                data.clockSurf2, (0,0), 
                data.clockSurf1, (0,0),
            ),
            # wx, wy,  bx1,   by1,      bx2,   by2
            20,  17,  20,  -999,    90,   999,
            #   id trg  vx  vy adu dir del bTy hfl vfl coi
            b'\x01\xff\x01\x00\x01\x02\x03\x00\x00\x00\x00',

            # Juice
            # Bitmaps
            (
                # bitmap         offset
                data.juiceSurf0, (0,0), 
                data.juiceSurf1, (0,0),
            ),
            # wx, wy,  bx1,   by1,      bx2,   by2
            9,  44,  -999,  -999,   999,   999,
            #   id trg  vx  vy adu dir del bTy hfl vfl coi
            b'\x02\xff\x00\x00\x01\x02\x01\x00\x00\x00\x01',
        ),
    ),

7 Likes

Release v0.2
image

  • The boss fight is there, “The giant feet fleet”
  • The game can now be played to the end :slight_smile: Who will be the first?

Before i can call it a game, there are some missing things to do like the ending fanfare, but I want to give this to early testers already :slight_smile:

Here: https://haviital.itch.io/mattis-nightmare

8 Likes

I’m pretty sure I beat it:

Summary

I woke up! The nightmare is over!

However, I don’t think I played it the right way. I went back and forth between the “Nightmare begins” and “The worst mare!” screens and grabbed the cup in the first screen over and over until I had enough points to go down though the door requiring 4 coins. Maybe things that give coins shouldn’t respawn? I could only find 3 places that had a coin item (aside from the secret room), so I guessed that I needed to get one of them at least twice.

Whenever I press B, the sound cuts out for a second, not sure why. Also, how do I avoid getting hit right at the entrance to “The worst mare”? an enemy is right on top of me right when I enter the room.

I like the boss room, that was cool. All the room themes and music go well together. I like the secret room as well :wink:.

2 Likes

You were the first to solve it :slight_smile: Thanks for the comments too.

Yes, I need to fix this.

Good catch. I have left some test code there. Fixed.

Yes, I changed the timing now.

2 Likes

The game has now been released (v0.3) !

Here: https://haviital.itch.io/mattis-nightmare

Matti-anim

Changes, v0.2-0.3:

  • The animated startup screen
  • The info screen
  • Adjustments to the gameplay
  • “Game finished” music
3 Likes

Great! Would still like to see a way to restart after a Gameover other then resetting the Pokitto tho…

I thought it is not a big deal. Thought, it is not necessarily very hard to fix.
Btw. How do you like the startup screen? It just goes on and on :wink: There are some pretty nice fg/bg combinations further on.

1 Like

I really like what you did. And I know it’s an easy fix about the after gameover issue, it’s just making it so that it goes back to the title screen by pressing a button. Just feels more complete if you can do it. Either way, great job!

2 Likes

Yes, I think I will do it like that.

A small update (v0.4):

  • No more need to reset the device after game lost
  • Small fixes

Download: https://haviital.itch.io/mattis-nightmare

5 Likes

Could someone test if this works in Windows? It is the Pokitto Simulator running Matti’s Nightmare. It supports audio also.

Unzip the zip file and execute the MattisNightmare\run.cmd file.
MattisNightmare_v04.zip (2.5 MB)

Edit: It works for me but I want to be sure that needed dlls etc. are in the packet.

Works for me on Linux with Wine.

2 Likes

works great here on windows 10.
you can jump over the walls and glitch out.
Untitled

2 Likes