Unfinished Platformer with Level Editor

Hey! A while ago, I made a platformer for the Arduboy, but I didn’t release it. It has some awful spaghetti code, but I’m sorta proud of it. There’s not really any actual levels for it, aside from the two already there. Here’s the source code.

Features:

  • Hopefully good controls
  • 4x4 tiles (32x16 levels)
  • Exciting get-to-the-door gameplay!
  • There’s no gameplay!
  • A test level
  • A level editor
  • Neat bitmap graphics for the menus
  • Basic sounds
  • Not very helpful code comments
  • A UI that makes no sense

Controls:

Directional buttons: move
A: Jump
B: Pause

How to use the editor:

  1. Open it from the menu. You can reach the menu by pressing B. If you played a level in the “play” mode, it will show up here and you can edit it!
  2. You will see a blinking X in the top left. It may be obscured by the tiles though. This is your cursor, and you can move it with the directional buttons.
  3. Press B to open the tile select menu. Select a tile with the left and right buttons.
  4. Press B to go back to the edit screen. Now you can place your tile by moving the cursor and pressing A!
  5. If you go back to the tile select menu and pick the player tile, you can place the player on the level and play it!
  6. To play this level you made, go to the tile select menu and press A. Your player should be controllable now!
  7. If you want to return, just open the pause menu and go back!

Advanced editor stuff:

  • Press Up to go back to the title screen! Warning: if you choose “Play”, your level will be overwritten!
  • Press Down to go to the mode menu! Here you can set modes for your level that cause special things to happen, like triggering a switch every time you jump, or not being able to see the whole map!

Known Issues

  • Slowdown happens if you place too many tiles. If you know a solution, please tell me!
  • Water physics can be weird.
2 Likes

I was thinking you were handing this over to someone else to finish as you had lost interest. So you are looking to complete it?

It works fine*, it just needs polishing, and improving with a few techniques I suspect you don’t know about yet.

(* That’s an understatement, it’s quite well written overall.)

I spent some time editing it (partly cosmetic changes, partly readability changes, partly space savings).

Before:

Sketch uses 20202 bytes (70%) of program storage space. Maximum is 28672 bytes.
Global variables use 1831 bytes (71%) of dynamic memory, leaving 729 bytes for local variables. Maximum is 2560

After:

Sketch uses 19164 bytes (66%) of program storage space. Maximum is 28672 bytes.
Global variables use 1804 bytes (70%) of dynamic memory, leaving 756 bytes for local variables. Maximum is 2560 bytes.

That’s a saving of 1038 bytes of progmem and 27 bytes of RAM.

(I’m 90% sure everything still works, though I didn’t test everything.)


By the way, yes 257 bytes per level does matter.

If you used run-length encoding and unpacked the levels into memory then you could fit way more levels into progmem. At least double if they’re all as sparse as this lot.


Now I’ve done some digging, is this what this question was all about?


Unrelated:
I always wanted to buy petit computer but it took so long for it to be released in Europe that I gave up in the end.

2 Likes

Looks like a good project for you @Pharap

I don’t think @V360 is handing it over for others to finish, I think they’re just showing it because they don’t want it to die in the dark even if it is unfinished.

Either way my changes weren’t an attempt to take over, just an attempt to claim back some space and tidy up a bit.
As per my mandate, none of my changes have affected actual gameplay mechanics, they’re all just equivalent exchanges.
(And I never get tired of showing off that making code more readable often results in smaller code.)

There’s room for more savings as well, but I didn’t want to go too mad for now.

1 Like

Yep … he will need every byte to squeeze in those levels.

2 Likes

Wow, this has so much potential! Great job! The level editor alone is really fun to use. I say it’s worth sinking more time into that one for sure.

3 Likes