Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Hey, good job so far! I remember one of my first games in C++ and SDL 1.1 way back in the day and it was tough, so mad respect!

A couple of suggestions if I may:

1) Have you thought about using a 2 dimensional array for your tile layout? I think it would be helpful since you'll be able to directly address any tile with that quick math you already figured out.
For example, since each tile is 64x64 and you know the absolute position of the player, you can find out the tile the player is in like:

tile = tiles[(int)playerX/64][(int)playerY/64]

So if the player is at x = 139, y = 73, the current tile is [2][1] or the third tile to the right and two down. Now, you only have to check 8 tiles to see if they're walk-able or not, and each of those are directly address-able as well! Of course, since you're allowing free movement it's not quite that simple since you could be on the border of two tiles, as you've discovered...

2) How deep is the 'interact' mode? Is it an actual state the player can enter? If so, can your player just not accept new velocity info while in this mode? Having not seen the code I'm sure the problem is tougher than this, but if you want some help debugging, I wouldn't mind looking at any code snippets you like to give!

PS

Oh yeah, your earlier issue with framerates and animation speed is exactly why a lot of old games are unplayable today because the simulation running on modern computers is so fast. You're right in that games today typically separate the simulation speed (or 'tick rate' in a multiplayer server) from the render loop. :)

(1 edit)

Hey! Thanks for taking the time to read my devlog and also share some of your wisdom too. I really appreciate it. You know what, I've tried actually doing the 2 dimensional array. And you're totally right, it's a lot more efficient to get it to work like this, Not only that, now that I think about it, this pretty much sets me up too for adding more properties on the tiles if there are other things i want it to do other than walkable or not.  What I did not think about that time was actually considering all 8 tiles like you mentioned, doing so will allow me to solve the edge case. Since i have velocity as well, it should be easy enough for me to determine which 3 tiles at most i'm likely to intersect with. I'm inclined to look into this again, but at the same time i'm worried too that i'd keep working on this one thing and not move on to other things and not finish. hehe


Actually I feel like i'm just not doing a good job at the moment keeping the state of the player, and that might be messing up my logic and checks for accepting the velocity. I've been asking myself if i really want to go the route of really disabling movement for the player when holding the action key.  if say for example the player wanted to dust the kid to sleep and requires 2-3 seconds of it holding the action key, I was thinking whether it would be easier and a better idea where if you pressed any movement keys while in action, it just cancels the action in progress. and still makes you move. 


Something I'm working on right now is to do a bit of clean up with my code. It's a bit of a mess and some refactoring could do me some good, and allow me to see clearly what's happening in my code. So I guess i'll do that first before fiddling with these two things again.  Thanks also on the offer on helping debugging stuff, I appreciate it! Are you on the discord server too?


Yeah! I totally remember the time i played the first diablo using a modern pc, damn it was so fast, it was virtually impossible to play. impossible to also do the item duplication trick haha~