You are browsing as a guest. Sign up (or log in) to start making projects!

9h 51m 22s logged

Unnamed Platformer - Devlog 12

Man* Realizes True Meaning of ‘If it ain’t broke, don’t fix it’

What I did: First I ported pushable blocks to SAT collision so they use the same system as the player and it’s not split between two systems. Well. That broke blocks.

so I spent 2 hours or so cross referencing my old versions and adding and deleting changes till it started working again. After that, I made sure blocks moved properly in zero-g. (they didn’t so I had to fix that too) Aside from that, I made a bunch of miscellaneous changes, such as fixing level progression bugs and altering player constants, but most importantly making sure blocks worked properly.

Somewhere along the line I was investigating how stacked blocks interacted. I noticed they were clipping through the ground because of collision checks happening after the position of blocks was updated, and after some thought I tried adding another collision check pass to my main game loop. It worked like a charm! I added two extra checks for safety and it stopped working like a charm.

The issue is my checkCollisions function is hella inefficient. 500+ lines of searching through every character in the tilemap (36x64, plus an extra column for new lines making it 36x65=2340) 6 times(!!!) Not only that, in some cases (block/player collision detection) I was nesting full passes within full passes, which caused insane lag, especially with my SAT collision which does a lot of math each frame. So I decided I wanted it to be more efficient (spoiler: it’s not efficient yet). I split my old tilelist into static tiles and dynamic tiles…and instantly regretted it.

Challenges: Basically when I split tilelist into two separate vectors (statictilelist which is everything except for blocks + dynamictilelist which is just blocks since nothing else moves lmao), I think I accidentally deleted a lot of existing logic that was the duct tape to my spaghetti code**. Aside from that, when I passed through tilelist it always passed through every tile, but with my new logic I had to decide which one to use. my stupid ahh didnt realize that there might be a chance I have to pass through both of them though 😭 well guess what there were a lot more gaps in my logic.

All of these combined into the logic I had spent the last few hours working so hard to perfect, falling apart in 5 seconds. Similar to the whole block to SAT thing I worked out most of the issues just by adding, tweaking, and removing a bunch of checks as well as looking back at my old logic to figure out what I forgot. Among these general changes I also added a new grounded member to the block class, and tried to get it to register if it’s on top of a player. Unfortunately it didn’t work. It’s ok I’ll brute force my way to the root of the problem tomorrow. (Btw this doesn’t even cover the issues I faced prior to this😭 ✌️ )

AI used, if any: Now that the core elements of the game (physics) are out of the way, I’ve pretty much been grinding through bugs myself since it’s just existing logic and I’m not really adding much that’s new or unfamiliar. Honestly, I think it’s gonna stay this way because I don’t intend to use AI to design the game, I was using it more to help solve physics issues and the like.

Plans for next time: I’ll try to hopefully fix the new block clipping issues. then idek anymore. Maybe i shouldn’t have tried to build the engine from scratch.

K bye guys

*I’m not actually over 18
**Tuff line?

0
7

Comments 0

No comments yet. Be the first!