May 6, 2012

Funny how things work out for the better when you don't intend them to.

I decided to try to "streamline" the engine by scripting a complex-yet-simplified collision checker. Rather than relying on place_meeting() or collision_line() (aka line_collide() in GMvania), I opted for a 3- or 4-point collision checking system. The idea is rather than checking every point in an area ( place_meeting() ) or every point alone a line ( collision_line() ), it would be better to just check critical points in a collision.

When checking for collisions above or below an object, the critical points are the left and right corners and in-between. When checking for collisions left or right of an object, the critical points are the top and bottom corners and in-between. I tried using 16px spacing (for 3-point collisions), but when testing on Trevor it was causing errors with left/right checking, so it seems 8px is the magic number.

After working out numerous bugs (you would think if it's simpler and more efficient, there wouldn't be many bugs), I tested it and noticed a bug I had fixed in previous versions of GMvania had reared its head again. Or had it? I booted up reVamp, tweaked the starting stage, then tried to recreate the bug. Lo and behold, it was in CV3 as well! So what I thought was a bug before wasn't a bug, but previously it was leading to a bug and the new collision checker prevents that bug from happening.

So now GMvania is even closer to handling like CV3.

No comments:

Post a Comment

©TheouAegis Productions™. Powered by Blogger.