Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 May 2009
Offline Last Active Today, 02:49 AM

Posts I've Made

In Topic: Loading TMX files with SDL2 using Baylej's C library

23 March 2016 - 02:42 AM

tilecount is populated which would suggest that your tiles are getting parsed properly.

What do you see if you expand the tiles node in the debugger?

In Topic: Simple 2D collision detection for a platform game (easiest solution possible...

16 December 2015 - 03:43 AM

This is one of the best explanations of continuous collision detection using bounding boxes that I've seen:


You don't need to use 2 bounding boxes, nor do need to do the splitting into top/bottom and left/right boxes if you don't want, this technique works equally well with a single bounding box and I've used it to great effect in games that I've written.


Doing the same with a single bounding box is explained in this video, although it's explained mostly through code rather than diagrams:


In case the video isn't clear enough, the basic steps (regardless of how many bounding boxes you use) are as follows:

  • Calculate your desired move distance.
  • Choose an axis to resolve first (I tend to go with x)
  • Take your desired move distance in the chosen direction and extend the bounds of your bounding box by that much in that direction.
  • Get all of the tiles within your new bounding box.
  • Check for collision in the direction of travel against only the tiles within your new bounding box.
  • If there is no collision, move your full desired move distance.
  • If there is a collision, do whatever your collision behavior is (most likely, move as far as you can then stop)
  • Repeat for the other axis.

In Topic: Setting up CMake for SDL-GL

11 May 2015 - 06:46 AM

This is how I do this in my project. On Windows I populate CMAKE_PREFIX_PATH with the paths to the various library directories, and on OS X/Linux it "just works".

  # Tell CMake where to search for includes, libs and DLLs on Windows
find_package(OpenGL REQUIRED)
message(FATAL_ERROR "OpenGL not found!")
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})

find_package(GLEW REQUIRED)
message(FATAL_ERROR "GLEW not found!")
target_link_libraries(${PROJECT_NAME} ${GLEW_LIBRARY})

find_package(SDL2 REQUIRED)
message(FATAL_ERROR "SDL2 not found!")
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARY})


In Topic: Stuttering problem - first attempt at fixed timestep game loop

17 March 2015 - 09:07 AM

Have you tried making use of SDL_GetPerformanceCounter (alongside SDL_GetPerformanceFrequency) rather than SDL_GetTicks? It should give you a more accurate timing value.

In Topic: Which of these games would you like to read more about?

09 December 2014 - 04:00 AM

Based how on how great the series has been so far I'm happy to read about anything you're willing to write about! The first two parts have been fantastic and I'm looking forward to the third. Keep up the good work.