Hoarding Problems on Lua

I need a way of checking whether every entity does not have a value. That way, I can find out whether every opponent is not hunting. That way, I can check if the game can play the normal theme again.

I now also need a way of making either a system or a plain function that accepts two entities. This would work with the collision system.

This is hurting me.

My current plans are putting in “boilerplate” functionality that might work, writing the rest of the game while pretending that the functionality definitely works, then requesting the help from the people at Lexaloffle, but I am leaning ever more towards changing the platform to ChaiLove or even the Game Boy Advance, even though the game is about done and has assets that specifically target the pico-8.


Hoarding bytes?

The bad news is that, in my latest commit, Re-Hoard has 47,344 bytes, while the maximum is 65,536. I feel worried about running out, though, because I am getting close to the end plus I already put in did the audio-visual assets, I feel that I could fit everything in there.

The good news is that the latest commit also uses 4,628 tokens compared to a maximum of 8,192. That is a little over half of the maximum.

The real problem is the maximum compressed size, which is 15,360 bytes. Both of eevee’s games in Lexaloffle suffered from this compression. I already know of some ways of getting under that maximum, but I would rather code in full then optimize normally then test the code before I deal with that problem.


Earlier, I mentioned that Lua’s lack of an object-oriented system was restricting me.

These days, I learned that the alternative, the entity-component system, may be itself restricting. One thing is that I do not know whether I can check if every entity that has a component does not have a component set to a certain value. Another is functions (or, rather, “subfunctions,” because they are parts of systems); some functionality some systems have can be abstracted away into subfunctions, but I am not sure if the subfunctions would work with the entire entity-component system in general or that I need to give the components’ values before the subfunctions would work first.

This has me worry if I could actually do the game in the pico-8 at all.

This is obviously very bad because I am so close. All of the art assets, which specifically target the pico-8 are there. I planned everything I could thoroughly then added stuff that I needed to plan once I went along programming. I worked a lot of the game; the end appears to be in sight. The worst part is that I had been working on the game since the latter half of 2016. Development just picked up when I decided to knuckle down and actually plan the thing thoroughly, but I am taking too much time with this game.

I am still working on the game, regardless, but a change of platform is not out of the question.


(Despite the above, this has nothing to do with my decision to look at Red or ChaiScript. These problems were forming over the days.)

Hoarding sounds and sprites

Yesterday, I did something that I thought that would not happen any time soon.

I did all of the sounds and sprites that the game needed.

I think that part of the problem was that the amount of sounds and sprites needed was large. There was also difficulty in making a title screen and the music.

I already mentioned how I managed to solve the music problem. The title screen was a form of roundabout ingenuity. I wanted a title screen that has a font in this style, but I was willing to just take a bold font then “hollow out” the font. The font I ended up picking was Paytone One. I then wrote the title in GIMP (using a black-colored aliased font) then used the Perspective Tool in getting the title to look close to the perspective I wanted. I then resized the title in Paint.Net without using anti-aliasing. However, the Perspective Tool seemed to have anti-aliased the title already. I ended up manually filtering the pixels; any pixel that had at least 128 opacity was colored pure black while the lighter pixels were colored black.* I then copied the title to the Pico-8 pixel-by-pixel.

Getting the colors of the title working was difficult. I quickly realized that the text did not have the thickness that would have let me make the outlines of the font that I wanted to simulate. I ended up not drawing outlines that surrounded the inner “holes” of the title’s letters. After I made minor pixel-level adjustments in the title’s formation, I searched for the right colors. I had in mind a color scheme that used a yellow fill but suggested a castle (which is also the reason behind the high perspective), but I had to approximate, given the palette that the Pico-8 used.

After that, the whole thing was easy. After the experience in remixing the music, I made all of the sound effects in the Pico-8 tracker. I also noticed what a difference different octaves made in the Pico-8, I adjusting an earlier song that did not sound right because of the wrong octaves.

All that is left is the code. I am actually more worried that the code would actually work.


  • = Only later did I realize that I could have looked for a way that transformed the title’s perspective without anti-aliasing. A bit of searching said that I could have set the Interpolation of the Perspective Tool to “None.”

An analysis of two songs

I finished the first part of “Hotel Gomaden” from the Hackers game in the Shin Megami Tensei series. (The second part is, to my surprise, actually a slowed-down cover of Johann Bach’s “2-Part Invention #13”.) Before that, I managed to transcribe “Backstreets” from Boktai 2: Solar Boy Django.

The reason behind these transcriptions was because, not only did I like those songs a lot despite their spooky feelings, but those songs also happened to fit the mood of my game Reckless Abandon. I wanted to make my own song inspired by those two songs, which means that I need a lot of control in what song comes in the game. The result was a lot of time in and a lot of breaks from the Record MakerMatic in WarioWare: D.I.Y.

My Analysis

In terms of mood, “Backstreets” is mostly melancholic, though with a spooky undertone. In fact, the song implies a long-lost land from your past but is just not “there” anymore, whether that be because our lost land is in ruins or is just gone. Meanwhile, Hotel Gomaden has a feeling of “Welcome to my haunted land!”, that haunted feeling being front and center. This time, the implication is that you are entering the front room of someone’s haunted building. However, both songs end up being inviting: “Backstreets”  has stimulates your curiosity on what was that long-lost land; “Hotel Gomaden” stimulates your curiosity on what is the rest of the haunted building. (Strangely, the cover of “2-Part Invention #13” sounds to be purposefully made a sequel to “Hotel Gomaden,” sounding far more inviting while keeping the haunted mood and its instruments in the background. Hearing this after “Hotel Gomaden” implies that you moved farther in the imaginary haunted building.)

Speaking of instruments, analyzing these songs gave me, a newbie in music, taught me that instruments matter. Before my analysis, I thought that the functions of instruments were interchangeable. I suspect that they still are in a sense; otherwise, covers would not have their current flexibility. However, “Backstreets” would not have its long-lost melancholy if the harmonica was not there, while the organ gives “Hotel Gomaden” its haunted introduction. Both use a “haunted chorus” in providing that spooky backup that the songs and settings have.

In terms of structure, both of these songs have an “aided simplicity”. “Backstreets” plays mostly one instrument at a time while either of two rhythms play in the background. While a stringed instrument plays a looping, “quick-stepping” rhythm in the background, the harmonica plays first, then the chorus. After that, the chorus turns into a sparser backup role while one string instrument plays, then another before not playing any “main” instrument at all, leaving the backup chorus and the rhythm. The ending shifts focus to the rhythm; a lone harmonica melody plays while a new brass/chiptune rhythm gets more involved with the melody. The rhythm switches to a different chiptune instrument before going back to the brass/chiptune. Despite these supplements, there is only one main “instrument spot” where several actual instruments take turns.

“Hotel Gomaden” shifts this structure somewhat: the rhythm is actually one organ playing a note, another organ playing 2 notes, both alternating their parts in a single, regular tempo. The notes themselves do vary throughout the song, though the notes of one instrument do not stray far from the notes of the other instrument. The instruments take a backup role, that is, reverse of a normal song when the instruments are at front while the rhythm is at the back. After the rhythm establishes itself alone, a drum roll ends in a type of clap that introduces a sparse violin. After a cymbal note, another drum roll that starts and ends with a clap cuts the violin at the end, letting the rhythm re-establish itself. A slightly denser chorus takes advantage of the “cleaned up soundscape” after this. The climax breaks the conventions that the song has in both the front rhythm and the back instruments. More specifically, the first organ adds 2 premature notes during the climax while the rhythm fades out at the end of the song. Meanwhile, the chorus stops in the middle of the climax, letting the violin gets some notes before the chorus returns. Despite this pattern-breaking, everything, even the drum rolls, follow the mentronomic rhythm, albeit in varying levels of strictness.

The rhythms themselves have a special property: they imply steps. “Backstreets” has a quick tiptoe; “Hotel Gomaden” is more a march or a creep.

On the note ranges, they seem to differ per instrument in “Backstreets”. The harmonica has a general falling slope from the high notes to around the middle-high ones. When taking the main roles, the female chorus does the middle notes while the male chorus is around the low part. When taking the backup role, the female chorus goes to the middle-high range while the first stringed instrument plays high notes. The second stringed instrument, meanwhile, cycles a rising slope from an already borderline high range. Upon returning, the harmonica starts at the high range before gradually getting lower while playing around with slope directions before preferring downward slopes. The backup brass/chiptune start high, but go through a longer falling slope, straighten up a little, rise a little, go silent, then go back to their falling slope. During that pause, another instrument does a series of falling slopes, though the series shifts the pitch of the slope a bit every time the instrument plays a slope. In contrast, the instruments at “Hotel Gomaden” tend to stay at the mid-high range without any real slopes.

They both have a feeling of you being alone. “Backstreets” has that lone harmonica. “Hotel Gomaden” has a couple of organs that set a mood but sound from “nowhere”. All of the other instruments in both songs merely reinforce these main, “lonely” instruments or otherwise the “stepping” feeling.


A song in aided simplicity where one (or two) instrument plays at a time, other instruments (including a chorus) sparsely supplement the main instrument(s), all following a stepping rhythm and tending to stay within the high and mid-high notes… outright implying an actual place of spooky invitation… the only problem is translating that chorus into Pico-8 instruments.

Re-Starting Fundamental Algorithms

I have been looking into how to do the fundamental algorithms that run Re-Hoard:

  • Some way of generating a maze
  • Some way of drawing a maze
  • Some way of directing the opponent’s movements whether they be patrolling or hunting while respecting collision
  • Some way of generating fully-functioning opponents

Though I looked for several maze generating modules already written in Lua, especially accounting the tight restrictions the Pico-8 has, I ended up coding the Recursive Backtracker algorithm that Jamis Buck wrote in his presentation on algorithms. (What really confused me way how to iterate over a 2D table in Lua.) However, I still needed some way of implementing queues in Lua. I ended up with the Deque module. I only put the specific functionality the game needed, though. I ran the code, but I ended up stuck today on some odd syntax error when dealing with this line:

 if dungeon[(current_cell.1) - 1][(current_cell.2)] == nil then

current_cell holds a table (a list, actually) that simply holds the “current” coordinates ({x, y}). Out of some reason, though, Pico-8 keeps saying:

‘)’ expected near ‘.1’

…even though I already put a closed parenthesis.

Thankfully, I already made a quick code that draws the map, which is actually a table full of “true”, “false”, or “nil” values.

On the opponent AI, Scathe at the Lexaloffe forums suggested repeatedly directing the opponent to a specific point in the map. His posts use a Pac-Man-style algorithm while the Pico-8 Zine used the A* algorithm, instead. I picked A*. This requires some careful attention from me, though I realized that the pathfinding algorithm also solves the issue with collision: pathfinding algorithms are designed to find the shortest path to a goal while avoiding obstacles, that is, the same obstacles that motivate me putting in collision detection in my game!

I already have the actual collision detection algorithm fully understood and coded, by the way.

On actually generating these opponents, I found Entity-Component Systems which not only promise to be more efficient but also do away with the need of object-oriented programming (in theory), making them a good fit to Lua, which does not have native support of OOP.

I would push these changes to GitHub, but I put all these algorithms on a separate cartridge because I want to focus on understanding and testing those algorithms specifically.

Lua to the End?

From the beginning of my game career, I intended to make games that use Libretro, a C/C++ library that can be used in writing emulators and standalone games. The reason why I learned Lua in the first place was because, compared to using straight C or C++, writing games in Lua and relying on the Lutro core seemed to be the more comfortable option. Indeed, because Lua programs do not need to be compiled, I ended up saving myself plenty of precious time in my last two college projects back when I took my Master’s Degree. Developing my final project using LÖVE instead of trying to understand the Libretro library, especially given the one-trimester deadline, spared me from a lot of grief. That knowledge of Lua also helped me develop games for the PICO-8, an all-in-one platform that not only helped me get used to normal game development but also has several channels of delivery, my favourite one being uploading the game itself in image format. You can even play these games in your browser with little fuss!

However, I am starting to feel the limitations Lua has. While Reckless Abandon has simple code, Re-Hoard has a game plan that needs object-oriented programming when generating random anti-hoarders, each with their own patrolling and hunting styles, per stage. Lua does not have any object-oriented functionality; other people fake that functionality using metatables. Even with that fake functionality, I fear that I would be better off relying on the real thing. Besides, if Lua lacked true object-oriented functionality, then what else would Lua lack? Other consideration include less layers of abstraction that might interfere with my wanting to interact with Libretro itself, the bigger maturity of C++ tools and libraries, and practice in a language that is still in high demand in the workplace. In fact, the more advanced aspects of Lua actually use a C library!

On the other hand, the gains from the lack of a compilation time proved to be an assets when I debugged my college projects. Also, LÖVE games store their assets as-is instead of they being baked directly in the program; I can edit a sprite or switch around a song and see the effects when running the game anew.

Despite these benefits, I am seriously considering working on my new games with C++ from now on. In fact, though Reckless Abandon would stay a PICO-8 game, I might move Re-Hoard to C++.

I just need to figure out how to display and move .png sprites and implement collision detection while I use Libretro.

Reckful Spriting

I managed to do almost all of the graphics of Reckless Abandon. I was actually out of ideas by the time I stopped, but I thankfully got almost everything done there. Other than that, I still have to do the bonus exhibit and a secret or so.

I stopped temporarily because I both wanted to rest and celebrate. I wanted the ideas to come, but that needed me stepping away from the game. Even coding would not give the rest my mind needed in gathering ideas.

I think I got almost all the ideas I needed since then now.

I feel accomplished that I did so much. I hope that I can release both Reckless Abandon and Re-Hoard by the end of this month.

No help yet…

I posted in the Lexaloffle Forums, but I did not get a response even after about a week. I wonder what I did wrong in writing my post… I modified my post by making my request more specific, but I just do not know what else to write. I am so blocked; I don’t even know how to properly articulate what I need.

Maybe I can use this opportunity to “refresh” the code. I should branch the code, first, in case someone from the forums notices my edited post. Thankfully for me, posts that are edited also get “bumped” to the top of the BBS list, making unnecessary the need of “bump” posts and all that.

Delays and Re-Hoard

One of the most iconic quotes from Shigeru Miyamoto: “A delayed game is eventually good, but a rushed game is forever bad.” However, in the Internet, a couple of interesting rebuttals to this quote is Duke Nukem: Forever and The Mighty No. 9, that is, games that had a large development time but ended up underperforming terribly. The problem with that rebuttal is that both of them had undergone gross mismanagement during their long development times. Duke Nukem: Forever kept changing companies. The Mighty No. 9 was Keiji Inafune’s first time managing a game by himself, which involved him making horrible mistakes with his backer’s money among other things.

My time with Re-Hoard gave me an idea of the trouble Mr. Inafune had to stand. The only reason why I am not undergoing the same controversy is because, while Mr. Inafune as running on the money of a huge number of fans who wanted him to revive the same iconic MegaMan franchise that made Mr. Inafune historic in the first place, I am an unknown person who is making something entirely new on my own resources. Also, while The Mighty No. 9 had its development known far and wide, I made public only the source code of my game Re-Hoard because I do not want to cause such a fuss over any problems from my failing to deliver.

Of course, because this is my first game that I am fully developing and releasing, I have gone against a lot of mistakes on the overall development procedure, the most important being my own responsibility on development. More specifically, while I wanted to develop daily, I spent weeks without touching the game. Eventually, I did get around to work.


This is the farthest I could go in developing how the opponents were supposed to act in my game. I stopped in March 3rd.

…I soon remembered why I stopped in the first place. I was not just procrastinating; I was frustrated at not being able to plan how my game is supposed to run! This was the farthest I could do when planning the behavior of the opponents in the game. After that, I would still have to deal with the behavior of the player dragon, the switching between stages, the title screen, and the music, let alone the debugging! At least I managed to find good visual designs of the opponents and the treasure.

I feel stupid and useless over this inability. I spent 5 years in my Bachelor’s Degree and 3 years in my Master’s Degree; shouldn’t I be able to do this stuff by now?


I should not be so hard on myself here; this is actually the first time I coded around the Pico-8 API. A lot of things are still new to me. Writing this, I wonder if I went too fast before starting to code my game, even if my game is relatively simple.

I think this would be the best time that I would request help in the forums. I did not want to do so because that might leave a bad impression on others, that is, one where I would promise without delivering a game, but, because I want to actually deliver my game, I willingly put away what is, in the end, just an assumption.