Monthly Archives: August 2019

This week, I made good progress on engine stuff, but I also wiped myself out. Have to take it easy this weekend.

I’m still just staring at a little dude in a prototype walkabout area… Gah. It’ll get better eventually.

Funny… player clones actually kind of work in the engine now. In Hibernator, a bunch of player state information was stored in global variables, which caused total chaos when more than one player actor existed.

Reading up on LÖVE’s GLSL shaders. Hope to eventually have palette swapping and color cycle / ramping support.

 

Getting closer to working slopes. The player is now correctly positioned on a tile which has slope attributes, but there are still glitches when the player crosses vertical tile edges (teleporting one tile up in the air, not locking to the slope when walking downhill, etc.)

It’s important to me that the player’s bottom-center point is used to determine positioning on slopes. This does come with its own problems, since I want to keep using the full width of the player’s bounding box for collisions against solid square tiles, and those two kinds of collision detection can interfere with each other. It’s probably too much to get into here (I love to ramble on about this, maybe in the next Bolero project update), but I can think of a couple of games off-hand that use the bottom corners for slope placement, such that the player kind of juts out into the air, and it just doesn’t feel right. Likewise, I can think of at least one game that uses the bottom-center point for landing jumps on platforms, and it’s the game’s biggest shortcoming. I need both kinds of checks.

There are a few ways that one can implement slopes in a tilemapped environment. For now, I’m making slopes a property of the terrain def, and specifying two numbers in the range of 0.0-1.0, which represent the height of the left and right sides of the tile (0.0 is the top, 1.0 is the bottom.)

A four-tile-wide ramp would look like this:

name  slope_left  slope_right
-----------------------------
4xa1  1.0         0.75
4xa2  0.75        0.5
4xa3  0.5         0.25
4xa4  0.25        0.0
4xb4  0.0         0.25
4xb3  0.25        0.5
4xb2  0.5         0.75
4xb1  0.75        1.0


....  ....  ....  ..##  ##..  ....  ....  ....
....  ....  ..##  ####  ####  ##..  ....  ....
....  ..##  ####  ####  ####  ####  ##..  ....
..##  ####  ####  ####  ####  ####  ####  ##..

4xa1  4xa2  4xa3  4xa4  4xb4  4xb3  4xb2  4xb1

When the player’s bottom-center point is overlapping a tile with slope attributes, linear interpolation is used to get a height value from the left and right slope values, using the player’s center X coordinate (with some additional modulo / divide operations to get it down to a number between 0 and 1) as the input.

I was going to go by pixel count instead of 0-1, but if the tiles have to be resized for whatever reason, I think 0-1 would be less of a headache to convert. Likewise for collision bitmasks.

I’m excited about finally getting slopes working, bugs notwithstanding. I wanted them in Hibernator early on, but got frustrated, and decided it was for the best to push on without them. Hoping to eventually get this all working with in-game actors besides the player.