Collision response finally working well

Published January 02, 2015
Advertisement
Started off the new year well with my game. I finally got to the point where my collision box code works almost the way I want it to! I say "almost" because there is one slight bug but nothing really game-breaking. Adapting some code from the XNA platform game sample really helped also. The most difficult part is adding in the Z axis for proper collision response with horizontal movement, and last night I was fudging around with the code a lot until I got it to work predictably and sensibly.

Since it's all based on a platform game sample, I'm also left with many arbitrary numbers for variables to compute things such as drag, jumping time, acceleration, etc. I understand the code in which these numbers affect the movement but I don't like how the numbers don't seem to have any meaningful relation with each other. Oh well, at least I can use them for many things, like reducing the drag when you're on slippery surfaces.

Also, I have uploaded the first video of my voxel engine in action (in 60 FPS to boot). This recording is actually 2 days old, so no collision box demo here.



Other updates include some changes to the graphics code to get it to work with the XNA Reach profile. This didn't involve many changes, just limiting the number of vertices in each buffer to a 16-bit amount and changing some shader semantics. I really want to keep this compatibility, because I want the visuals to be simple yet still look great while running on low-powered graphics cards, in order to attract more potential players. The video above might as well be running on the Reach profile, as it looks exactly the same.

Back to the collision code- the slight bug I found is that when you collide with a wall, you keep sliding in one direction until the bounding box touches the edge of the next block. This only happens moving in one direction along each axis (eg. I can slide indefinitely while increasing on the X axis but not decreasing), but you do not get stuck on the wall, you just stop.

So I can now render a bounding box that moves around in the world and can jump. The camera is still not tied to player movement, and makes movement awkward. So that's next on the list of things to fix. After that, I will post another video showing it.
4 likes 7 comments

Comments

Aardvajk
Looks good. What did you use to capture the video? I have CamStudio but the frame rate is crap.
January 02, 2015 08:56 PM
CC Ricers

Looks good. What did you use to capture the video? I have CamStudio but the frame rate is crap.

I use nVidia's ShadowPlay feature. It's able to record the last five minutes of gameplay. I don't notice any lag from turning it on in my game, using a GTX 750 Ti.

January 02, 2015 09:23 PM
riuthamus

Looks like cubeworld. :)

January 02, 2015 11:29 PM
CulDeVu

Gotta say, those mountains look absolutely amazing. Nice work!

January 03, 2015 01:48 AM
CC Ricers

Looks like cubeworld. smile.png

Thanks, Cube World is a big inspiration for this game, especially since it apparently stopped updating and got stuck in alpha.

Gotta say, those mountains look absolutely amazing. Nice work!

Thanks!

January 03, 2015 03:40 AM
Icebone1000

Is it all AABB? or theres OBB too? or even more complex?

January 03, 2015 01:06 PM
CC Ricers

Is it all AABB? or theres OBB too? or even more complex?

AABB for now. I don't know yet whether I want characters using a OBB or if a cylinder will work well enough (which would be simpler to do).

January 03, 2015 09:10 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement