Colliding Walls
So, when I brought back the map generator, I noticed something funky: those lines between each block were showing up. At first, I thought it was a size or position issue, but turns out, it was only happening in the game view, not the scene view. After tweaking some camera settings, I clocked the issue: it was the MSAA causing trouble. You know, that thing they use to smooth out the edges? Turned it off, problem solved.
Tried to get the player moving towards a point, stopping if they hit a snag. But, man, that solution hit a brick wall real quick.
To get those collisions just right, I had to predict where the player was headed and check if the next spot was a go or a no-go. Easy enough to figure out the target spot from the player's current position, right? Well, not quite. Ran into a nasty snag: players were phasing through diagonal walls. Total headache. So, came up with a new plan: scoped out all the spots between where the player was and where they wanted to go. It formed this little 2x2 or 1x2 grid, depending on which way they were headed. If all the spots were clear, smooth sailing. This tweak fixed those pesky diagonal collisions, but just when I thought I had it licked, another problem reared its ugly head...
Being game devs, we're no strangers to having a killer algorithm that just doesn't vibe with the gameplay. Like, in the video, you see this clunky, awkward movement that's like trying to navigate through a crowded bar. Picture this: you're in a building, zombies hot on your tail, and you get stuck because of wonky movement. Not cool, right? That's when I decided, "Nah, this ain't it, chief."
So, I branched out, ditched the old setup, and started fresh to figure out a better way to handle collisions. Got this wild idea: what if I marked out four corners around the player, forming a little square, and checked which spot each corner landed on? Gave the player way more freedom without being tied down to one spot.
This new approach was slick, but hit a snag: smack into a wall, and bam, you're at a dead stop. Felt like hitting glue. Needed a way to keep the momentum going, you know? Came up with these tangent lines that basically guided the player along the wall, so they could slide smoothly instead of grinding to a halt.
Took a ton of trial and error to nail down the collision direction and which corners were involved, but dang, it paid off. Movement feels way more natural now, like you're really in the zone. No more getting stuck on every corner. Now, I can design those tight, claustrophobic corridors without worrying about players getting stuck. If they get chomped by zombies, it's on them, not the wonky movement.
Files
Get Z-Engine
Z-Engine
Status | Prototype |
Authors | Argendel, [Random Adjective] |
Genre | Survival, Simulation |
Tags | building, Minecraft, Sandbox, Singleplayer, Top down shooter, Voxel, Zombies, zomboid |
More posts
- Graphic StyleJun 08, 2024
- Personal InventoryMay 25, 2024
- Inventory SystemMay 17, 2024
- VerticalityMay 08, 2024
- XRayMay 06, 2024
- FOVMay 02, 2024
- MiniaturizationApr 26, 2024
- First ProblemsApr 24, 2024
- World Edit ToolApr 11, 2024
Leave a comment
Log in with itch.io to leave a comment.