Jump to content

  • Log In with Google      Sign In   
  • Create Account

adt7

Member Since 03 May 2009
Offline Last Active May 02 2016 02:59 PM

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

if(WIN32)
  # Tell CMake where to search for includes, libs and DLLs on Windows
  set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}
    "${PROJECT_SOURCE_DIR}/extern/glew"
    "${PROJECT_SOURCE_DIR}/extern/SDL2"
  )
endif(WIN32)
find_package(OpenGL REQUIRED)
if(NOT OPENGL_FOUND)
message(FATAL_ERROR "OpenGL not found!")
endif(NOT OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})


find_package(GLEW REQUIRED)
if(NOT GLEW_FOUND)
message(FATAL_ERROR "GLEW not found!")
endif(NOT GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${GLEW_LIBRARY})


find_package(SDL2 REQUIRED)
if(NOT SDL2_FOUND)
message(FATAL_ERROR "SDL2 not found!")
endif(NOT SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
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.


PARTNERS