2025-08-30 01:11 UTC
Replies (1)
-
@dolanor@hachyderm.io 2025-08-30 01:23
I also implemented the collision system in ECS following https://www.fatoldyeti.com/posts/roguelike4/ But some places I could go through walls, and sometimes I was blocked by some invisible blocks. I couldn't see the pattern and the tiles seemed to be at the right places. So I decided to debug it the classical way: `printf` to the rescue! `.` are the floor and `#` are the walls. They should be all around, but clearly, they aren't. There is a pattern to figure out, but it eluded me until I counted it. For performance reason, all the tiles were added in a slice, instead of slices of slices. I added them one after another in a double loop. Basically, I inverted x and y, and so it was creating a slice of column first then rows. But I was displaying them and computing them by rows first and column next. Pretty basic error, but the debug print made it all clear very fast. #golang #g3n #roublard #3d #RogueLike