Wednesday, 12 December 2007

Physics headaches...

It seems like the simplest thing in the world when you're playing it. It's for that reason that I attempted to recreate it as my first 3D game; it looked easy. When the player presses an arrow key, move in that direction. When they hit a block or a wall, stop. And yet the physics for such a game are actually ridiculously hard to program; I just can't work it out!

You'd assume that all you have to do is use the collision detector to make the sprite stop moving when it hits the block, wouldn't you? Nope. If you try this it'll stop it from moving whenever it's touching a block, so once you hit one you can't move again as it thinks the sprite's constantly colliding with the block. So surely you could make it so that rule doesn't apply while the player's touching something? Computer says NO. If you collide with a wall and then slide along it, you'll go straight through the other side of the screen and any intervening blocks as you're touching the wall when you hit them. So, couldn't you simply "de-activate" individual objects as the player hits them? WRONG. If you were sliding right and hit a block, you could then press right again and sail merrily through it as it would be deactivated at that point.
So, the question remains:

I have absolutely no idea how to go about this. Whenever an idea pops into my head it starts to collapse when I poke holes in it, so I add little supports, then it turns out the supports aren't waterproof, so I add umbrellas, which blow away in the wind, so I put up wind barricades, which stops sunlight getting in, so I install windows, which magnify the sunlight and end up setting fire to my original idea. So to speak. It's a phenomenon I'm naming Self-negating Solution Syndrome. And it's rather annoying.

More annoying is how easy it looks in Pokémon Silver, I can't bear to look at that section now. It just... works. There are no hack-around artefacts, no dodgy collisions, not a single bug. It's perfectly tile-based, you can't even get close to defying the grid. My thinking cap goes off to the programmers at Game Freak; they have some real geniuses working there.

I know that I got this 'working' in Slipslide 1, but that one used so many hack-ups and took advantage of so many coincidental engine glitches that you had to handle it with soft furry gloves while playing it; the number of bugs was ridiculous. The player was a grain of sugar and the game world was a sieve. I could attempt to copy the logic system from that (and transpose it into 2D), but that would not only take ages, it'd also result in a really bug-filled game. And that's not the ExeSoft way. Therefore, I'm going to attempt to look at this laterally, and try to come up with a physics system tomorrow.

*re-dons thinking cap*

No comments:

Post a Comment