goofy hacks

// September 16 2024, 2 min read

// #heartgirl #game design #programming #pico-8

I've been struggling with a few problems in #heartgirl[1]. One is my utter lack of creativity which makes level design an incredibly difficult task for me. The other was implementing platforms that the player can jump through from the bottom and stand and move on the top.

[1] #heartgirl

Initially I tried to do this using the existing tile-based collision detection, as the levels are defined via tiles. Well, mostly via tiles. I also create "level elements" via code based on the placement of certain tiles. Such elements may include moving platforms (horizontal or vertical), enemies, the items you pick up, conveyor belts, etc. The source tile is then blanked out at run time once the element is created. All collision for these elements is handled slightly differently, by pixels.

Now, the math _should_ have worked for jump through tiles using the tile-based math. But it just would not work no matter what. So after a year of struggling with this issue (I barely touched the project during that year), I came back to it a couple days ago and realized: I can make level elements for these things, _because I've already solved the jump-through issue using pixel-based math._ You've been able to jump through conveyor belts and moving platforms the entire time they've existed. Why am I bashing my head trying to force the tile-based one to work?? And lo and behold, generating invisible elements and NOT blanking the source tile yields the _exact_ behavior I've been looking for.

It was a real quick little change and it's opened up a whole new aspect of level design.

I kept trying to go the tile-based route because I shouldn't have to have shove these little invisible elements into memory. It should be basic functionality that just works with the structure I already had.

The only real downsides are more memory usage, but frankly my game is so simple I'm not using that much memory anyway.

But game design is FULL of goofy little hacks like this. We're all familiar with a player finding a random apple in a game map, often hidden out of bounds, and the developers going "yeah the whole game crashed if we took that out and we couldn't figure out why, so we decided to just leave it in" thing. Or that Half-Life's trains were actually human-shaped NPCs with a train model for a head. I need to learn myself that sometimes it's better to implement something the way it does work rather than the way it should work.

linked tags

#heartgirl

#game design

#programming

#pico-8

-=-=-=-=-=-=-=-=-=-

View this page on web


Source