Single Status Update
Basically I fixed various teleporting glitches caused by specific scenarios. Now Twi can squeeze into tight passages without glitching out or getting stuck.
Should she for some reason get stuck, she'll be slowly pushed upwards, instead of being yeeted somewhere or causing the game to freeze. Initially I didn't consider the possibility of getting stuck inside a wall, but during testing I realized, that things happen, you never know.
The slopes add TONS of work in regards to collision, and tons of code too, due to many scenarios they add. When I handled one possibility (read: set of blocks' angles she was squeezing through), another one was causing troubles. I was toying and toying until I got them all "patched", so to speak... at least I think so. I guess time will tell.
- Show previous comments 1 more
Oh I thought I might be missing something obvious and overcomplicating things, but now that you mention it this way, I suppose it is what it is. I know some old games had a simpler approach to slopes - by basically limiting them to only the ground, keeping all ceilings square - and also keeping enough of space in tight passages to avoid going up into the ceiling. That was like the limitation of level design. It was in Metroid or something...
That indeed saves all the hassle, as the problem arises when the character starts touching ground and ceiling at the same time. Some sorcery has to be put to prevent from getting stuck. Given how much extra code I need to cover the scenarios shown above, I'm wondering if it really will be needed. Perhaps I too, should just keep the minimum space between ground and ceiling, so that any of this wouldn't be needed. ..But well, since for now it all works, I'll leave it be and try to take advantage from it in level design. Should the game happen to be a bit too demanding for older hardware, I'll consider simplifying the logic.
These are tiles, that have a limited amount of slope shapes. Using only full block, 1:1 slopes, 2:1 slopes and 4-pixel-tall-step stairs. To make it work though, precise pixel based collision has to be put to work.
Well precise pixel based collision makes it much easier, at leas in some ways. I don't even know how to start if you do tile based stuff. I think the way I did it was to check each pixel from foot to head in the direction the player was moving and simply have a max number of pixels that could be moved up and if there was enough space to move up. Or something. Point was if you had a situation where the player was touching ground and ceiling at the same time it would basically treat it as a solid wall. Did have code to keep you ducking if you didn't have room to unduck but I don't remember if it ever ducked automatically otherwise.
Also, honestly, maybe it's just me but don't you think most of the time when code exists to unstick the player from inside a wall it's exploited in the wrong way?
Basically I have something like this. The stepping up while moving forward is what requires a bit more attention. I might continue toying with this to wrap it all better or something.
Yeah, speedrunners will always find fancy ways. But I suppose it's better than just getting stuck and having to quit. Guess I prefer having someone abuse it and me patching it eventually, than someone complaining they keep getting stuck once in a while, losing progress and everything. There's no perfect solution for that, other than writing collision properly, so that there's no way to find yourself inside a wall in the first place. Until I get to this point, it's better to have something ready to handle this, to at least try to prevent from potential frustration.