Enable javascript to see screen shots.

prev next

Castlevania Demo

Project Members:
Programmer: Jason Eaton

Languages: C++
Libraries: SDL

Date Added: 4/8/2011
File Size: 171k
Download: castle.zip

This is a prototype for a castlevania style sidescroller. My goal here was to make a collision detection and response system that was event driven, so I could hook in any sort of behavior on objects without modifying the engine. It is difficult to decide which events should be captured, that would allow the most flexibility without having to mess with the engine. My initial idea was to have events that would trigger any time an object boundary was crossed. So when the lower bound of the player crossed the upper bound of a platform, an event would fire that contained all the info about what kind of boundary was crossed. In that specific case, I could just reposition the player on top of the platform on that event. Another use of this system would be to create splashes any time the player either crossed into water tiles, or crossed out of a water tile. The events there would be player bottom crossed into water top, and player bottom crossed out of water top.

There are still a lot of issues with this concept. For one, I have rotating platforms that collision behaves differently. When walking up ramps, the player's center decides positioning of the player, to give the appearance that the player is walking up the slope. The exact event that should fire there is a little ambiguous. Generally when the player crosses into a slope, the player is projected upwards to avoid sliding when the player is standing still. But the problem with this is if the player walks horizontally into a loft like ceiling. To detect the crush event, I check to see if the player was projected in two opposite directions in a single frame. In this case, the player would get crushed simply by walking horizontally into the wall.

A nice thing about this demo is that you can create the level right there in the game as its running. The readme file has all the commands to create platforms, size them, and even give them a path to move around the map. This makes testing a wide variety of collision cases quickly and easily.