I want slopes. I want’em bad.
As a step toward this, I got jump-through platforms working. A code typo from earlier prevented terrain attribute lookups from returning any real data, and I had to do some digging to figure out the root cause. I added more debug draw functions to help narrow this down.
On today’s episode of I Can’t Do Basic Math: incorrect bracket placement causes all actor spawnpoints to skew downward the further right they are on the map
Chipping away at collision detection and platforming state, trying to make these functions work with multiple actor types, and be easy to work with.
These test enemies fall when walking off of solid terrain, something no non-player creature in Hibernator was capable of. I think the closest thing to it was the little crawling spike guys, who would change direction if the ground tapered off in front of them.
Got nothing done today, besides recording the sound of a small desk fan and trying to make it sound vaguely sinister with the vocoder plugin in Audacity
Made a screenshot map of Hibernator that I’ll include when I update the project this weekend. While I didn’t have the foresight to write a function to screencap all of the areas in pristine condition, I did have the benefit of being able to disable the HUD and window border, and toggle player visibility with a temporary shortcut key.
Made some progress on the cell / tile / terrain definition mix-up that I inherited from Hibernator. Following this convention now:
- cells are the raw integer values taken from map data. On their own, they map to whichever tileset is associated with the map, left-to-right, top-to-bottom. Within Lua and LÖVE, they are one-indexed, and everywhere else (Tiled, GraphicsGale), they are zero-indexed.
- Tilesets contain a sparse array of tile_defs, which represent additional handling data for a tile, including a string referring to what kind of terrain it’s supposed to be (along with the animation info I threw in earlier).
- terrain_defs are tables of key-value pairs that describe how higher-level game logic should treat a particular tile, such as whether it’s intended to be an obstacle to the player.
Cells are just integer numbers, tile_defs are per-tileset, and terrain_defs are project-wide.
If you’re curious, here’s the Hibernator terrain mapping. This was annoying but generally livable, since the game only had a single tileset, and I could cross-reference it using the grid snap mode in GraphicsGale. But it was holding things back quite a bit in the current project.
The tile ID values mapped to the following:
1 = default
2 = empty
3 = solid
4 = hazard_passable
5 = hazard_impassable
6 = ladder
7 = water
During development, I used the “1-8?” blocks to keep track of how many jump power-ups were necessary to travel through various routes of the map. The “default” and “empty” terrains being effectively the same but technically different caused some subtle bugs at times.
Planning to release new versions of Hibernator and Faux Amis this Sunday with a few bugfixes.
For Bolero 2, I spent some time rewriting animation functions, which haven’t been changed much since Hibernator. They only supported uniform frame dimensions, playback speed, XY offsets (the “hot spot” in Klik parlance) and the like. Now, every frame is a separate table, and all of those fields can be specified individually, and new frames can be appended to an animation as needed. In the future, I may add flipping/mirroring, rotation, RGBA tint, or other things of that nature. The main limit still imposed is that all frames of a given animation need to be sourced from the same spritesheet, and the spritesheet needs to be registered in the resource system first before the animation is declared.
Played through Hibernator again to compare-and-contrast where I am with the current engine. With some distance between me and that project now, I can say definitively that bumping up the base tile resolution from 12×12 to 16×16 was the right choice.
(Also found a bug in Hibernator, where the ending art of all things doesn’t display sometimes. Gah.)
Platforming now looks proper, with the main player sprite centered within the bounding box that’s used for terrain collision, and weird platforming physics wrinkles ironed out. Renamed and organized a nightmarish tangle of ALL_CAPS_GLOBAL_VARIABLES into a platformerState table.
Jumps feel tight. This is the first time I’ve been able to play around with this character design plugged into any kind of game engine, and I’m still not sure if this is the one I should go with, but I’m feeling a little more confident about the project as a whole now.
Got the platformer code to the point that collision detection and walking across solid terrain now works again. Man, how did I survive with the collision and platformer code that was in Hibernator? This needs work.