Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Collision response finally working well

Sign in to follow this  
CC Ricers


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.
Sign in to follow this  


Recommended Comments

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

Share this comment

Link to comment

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.

Share this comment

Link to comment

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!



Share this comment

Link to comment

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).

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!