[WIP][Pine-2K] SkyBerron Vertical Shooter

Edit: Thanks to @FManga’s advice, I got it working!!!

I’m afraid there isn’t any “progmem” left, so there’s not much I can add to current version. It was very fun to write. Now thinking about the next Pine-2K game. :smile:


v-shooter by SkyBerron.zip (149.3 KB)

Previous version bug report:

I can’t complete my second game in Pine-2K because when I try to run the code, it hangs in black screen or crashes writing to flash, no matter what minor changes I make to the program. The code that triggers the bug is in update1() function, and I suppose it’s a compiler bug because it hangs even when the function is declared but not used.

The game is not finished yet as I cannot run it and tune the parameters by trial & error like bad programmers do :stuck_out_tongue_winking_eye:.

Plus some more “bugs” I have found so far:

  1. Function declarations like function foo() { crash the compiler while function foo(){ doesn’t.
  2. Calling not declared functions crashes the compiler without error message: using justpressed("A") instead of justPressed("A") crashes execution without throwing errors, which took me a while to notice.
  3. Tilemap displacements using tileshift() are limited to 0-7, so it doesn’t do the magic when using 16x16 tiles as you can’t place a 16x16 tile in (0,-1). It seems there isn’t an extra tile column left side (out of screen with no displacement) and an extra tile bottom row, so scrolling tilemap doesn’t look good in those edges.
  4. I got an error for exceeding max compiled size in 0 bytes. Unfortunately, I could not repeat it :smile:
  5. Due to not following operators precedence rules, you have to place parentheses everywhere. Even trivial code like 5 + a * 6 and if( a + b < c ) need to be rewritten as 5 + (a * 6) and if( (a + b) < c )
  6. This one is not a bug: The built-in gfx assets are only suitable for Fantasy RPGs. So they’re not so good for space shooters or other genres unless you use RPG characters for everything. Now I’m thinking about it, I could make some weird spaceships combining some shields and armors :wink:. I suppose writing a somewhat complete RPG in only 2K of code can be a pretty challenging task, but I’m not going to try as I don’t enjoy making RPGs.
  7. I still have not mastered this thing, but I think the constraint of 2Kb for compiled code can be a little short for some games specially if you need to add some helper functions. But I should blame it on having 16 GB of RAM in my PC and still complain it’s not enough.

v-shooter failing to run.zip (149.2 KB)

P.S.: don’t get me wrong, I love programming bugs, but preferably the ones I make and I can fix myself.


Quite a challenge indeed, but that’s the challenge I’m undertaking at the moment. I figured out a trick with save("filename", array) -> exec("scriptname.js") -> array = file("filename", 0) to basically put global variables in an array and share their values between multiple “states” with each state (such as menus, battles, and maps) being a separate 2k script. Will be interesting to say the least to see what I can do.

No worries, I love making RPGs cause I love coming up with interesting stories for them.

This might be caused from a function being too large. I experienced this during some of my stress testing. If you get a write to flash error then it’s most likely the compiled size of the function is too large but the compiler just gives up and continues. @FManga could probably help understand this better though.

Good luck with your game(s) for this, can’t wait to see what you’re able to do with it, including some interesting demo scenes (since I know you like making those).

1 Like

Thanks for the thorough report! Luckily, many issues were found by @Vampirics so they’ve already been fixed.

This happens when a conditional branch is too long. Basically, too much code inside an if/for/while. It’s due to a Thumb2 limitation and working around it would waste space in every conditional branch. Instead, the upcoming version will halt with an “Out of Range” error.

For now, you can get your code to compile by moving the for into the caller.

This one’s new to me. I added spaces to all the functions in your code and had no issues. Do you have a specific example?

I already have a fix for this one.

There is an extra tile row/column, but tiles are 8x8, hence the 0-7 limitation.

Oops, I had size >= 2048. Fixed it.

It’s a documented limitation… for now.
In the meantime, you can also write a * 6 + 5 instead.

That’s true, I didn’t want to take up all the flash space on the first release. I’m still on the lookout for good general-purpose tilesets.

A little short? I might have to reduce it to 1k, then! xD


Amazing! I’m looking forward to play your RPG game. I played some of them a lot when I was a kid.

Smart trick!!! You bypassed the 2K constraint and enabled a new world of “multicart” games!!!

Thanks!!! I’m also waiting for news on how your game dev is progressing.
When making demoeffects I try to optimize speed & resources in order to maximize visual quality and get some demanding effects running on the platform. But with Pine-2K I think I’m focusing on packing as much game logic as possible, even at the cost of losing some visual quality. Anyway, it’s a question of managing the resources you have to squeeze the most of them.

1 Like

Thanks for your tech support and excellent suggestions! Now I’m understanding how to code for Pine-2K, I can see this is an outstanding tool with very high potential.
Imho, you should write an article on your motivation and ideas that led to the creation of Pine-2K and how you designed and built this amazing tool.


i second that opinion