Shattered Lands (a multi-part RPG saga for Arduboy)

Shattered Lands: Towers of Perdition(v 1.3)
title
Source Code
Binary Release (v1.3)
StrategyGuide.pdf (274.6 KB)
I have just finished working on my first RPG game for the Arduboy. I bought my Arduboy back in April '19 and have been hard at work on this project for a while now (though had a few months where I wasn’t able to work on it). By far the biggest challenge was balancing quality vs quantity. I could have more / larger maps but would sacrifice the battle mechanics (which was my favorite part). I was able to sneak in 7 pieces of background music using some procedural generation (each song ‘intelligently’ picks between 64 different notes to play and each song has a tempo which is the number of frames each note is held for). When you complete the game your data is saved registering to Shattered Lands 2 allowing you to continue your progress once I finish the sequel (shouldn’t take as long since all the code is now implemented and it’s just a matter of making content).

Next on my TODO list is put together my homemade Arduboy clone with a 64Mbit memory chip. From there I want to radically enhance this system to have a 2 person party with more maps and more content since all the content can be offloaded onto the memory chip allowing more space for more complex code.

EDIT: Will be uploading the code to github shortly. Currently uses 26,654/26,672 bytes. Also uploaded the strategy guide in the form of a booklet (print double-sided flipped on the short side).

EDIT: Updated the hex file because the firewolf battle graphic had a solid black line on the left. Checked over all the sprites and it was the only one. Also updated the strategy guide as I forgot to fill in the recommended levels in the walkthrough section.

EDIT: The songs used for each map was incorrect. It uses a single byte with the upper 3 bits indicating the song, but I set the overworld correctly and then just incremented the left hex number by 1 instead of by 2. This now uses the songs originally intended for each map.

EDIT: I forgot to include some way to mute / unmute the audio. There wasn’t enough space for a menu option or any simple solution. Holding down ‘A’ while booting will now toggle the audio and save it for future boots.

EDIT: The source code has now been uploaded to GitHub. Took a bit to familiarize with the process.

EDIT: Released 1.4 merging filmote’s PR saving 400 bytes and adding the arduboy.systemButtons() routine so audio on/off now works in the standard way (hold B when booting and push UP to enable audio and DOWN to disable audio).

10 Likes

Wow … nice work!

1 Like

this looks pretty good :smiley: i’ll give it a try soon!

1 Like

This is incredible! Where does the map size fit in relationship to Arduventure can you share?

I am interested to see how much content is in this game! Incredible work.

Too bad it is one of the things that crashes the embedded emulator :frowning:

Also when the embedded emulator crashes it seems that chrome mobile crashes. It must be something with chrome because I hear my desktop fans going crazy. Makes the cpu go nuts!

Where does the map size fit in relationship to Arduventure can you share?

The map is 64x64 tiles roughly, though it’s broken up into 8x8 chunks and 16 tiles per map. Each chunk uses 2 bytes (1bit/tile) indicating which tiles are used in that chunk. From there it determines how many bits to use for each tile in the chunk (0bits for 1 tile, 1 bit for 2, 2 bits for 3-4, 3 bits for 5-8, and 4 bits for 8+). This allows the chunks to be individually compressed based on their complexity. One of the things I noticed with Arduventure is it has a very large overworld map (with great details), but doesn’t allow room for sub-maps or much in the way of a battle system. I wanted to have a decent sized map (not exactly 64x64 max, but rather max of 64 chunks) while focusing primarily on the battle system. I’m working on getting the code uploaded to GitHub on my next day off so I can share the source code (licensed GPL v3.0). I’ve got detailed comments on how all the data is broken down, including the map events. I’ve also got a map editor using C++/Qt but I’m modifying it to be able to also edit the map events (that was painstaking creating them all by hand, and required setting the various bits and then using a binary to hex converter).

Too bad it is one of the things that crashes the embedded emulator

The game works fine in the emulator, just not through the forum iframe. Not sure why that’s the case, but if you copy the link to the hex file and paste it as the url in the emulators main site (like this) then it works just fine. Not sure why that is, but I noticed a few games that have that issue.

EDIT: Just tried inspecting the page source in chrome and copied the iframe src link and pasted it into the address bar and it works perfectly fine. Might be something related to the iframe.

Is there an option somewhere to mute the music? I need to be quiet where I am much of the time.

When your playing this game at work :slight_smile: try …

  • Hold the B button while powering up.
  • While still holding the B button, press the UP and DOWN button to toggle between sound on / off.
  • Release both buttons.

(This assumes the game is using the standard Arduboy technique. As the source code is not posted, I cannot verify myself as I am at work too).

1 Like

Thank you, it didn’t work so I guess it doesn’t have that feature at this time.

1 Like

Oh wow that was difficult. I only had 18 bytes available, but it turns out I still had the arduboy.clear() before arduboy.display() from before stripping the boot logo. Deleting that I still wasn’t able to free enough space to call arduboy.systemButtons() which handles the mute/unmute functionality. Instead I read the state of the EEPROM audio value and toggled it if the A button is pressed, then updated the EEPROM with the new value. Still had to free 8 bytes but the player’s battle sprite had 3 unused columns of 24 pixels (3 bytes) each so I cropped it and now my sketch uses the entire 28,672 bytes available. Editing the Initial post so as to keep the latest hex file at the top.

1 Like

See below post for details but it’s there now. Simply hold down the ‘A’ button while turning on the device to toggle audio (it will remember this for future boots as well).

1 Like

Great effort! When you post the code up, I bet a few people can think of interesting ways to save enough bytes that you can put systemButtons() back in.

That is now done. I added links to the top post to keep everything organized at the top for new visitors.

That would be interesting to see as it’s now using 28,672 / 28,672 bytes.

I have created a PR which should save you about 400 bytes - enough to get the systemButtons() in.

1 Like

This is really awesome. I never really looked much into using the ArduboyEX class.

Not anymore thanks to filmote saving 400 bytes. Turns out by not running the arduboy.systemButtons() routine it was freezing the embedded emulator.

1 Like

That’s an added bonus!

I’m heavily refactoring the code to separate the core engine components from the data. This will make it far easier to make improvements on the core that will propagate to each game. Plus once I get my all in one editor done it’ll be easier for people to make their own games with the engine. They just include the core and drop in the ‘data.h’ file created from the editor.

This won’t effect the final compile size, just a reorganizing of the code.

2 Likes

He says hopefully!

2 Likes

All done refactoring. Ended up creating a copy of ArduboyTones and stripping out everything that wasn’t needed (ability to queue up to 3 tones, volume control, etc). This freed ~600 bytes extra. While this extra space won’t be utilized for this game, it will allow for a lot more content in the sequels.

Since the sequels also don’t require the name entry portion there’s a total of about 1,200 bytes extra for their content (for reference the overworld map is 1,062 bytes).

2 Likes

You’re a wizard Justin!