by DST » Sun Apr 20, 2008 8:14 am
yes it has everything to do with speed. I believe its the framerate problem - notice how the bullet doesn't draw in every xposition on the game, but rather 'teleports' from one location to the next? Well if the player was in the empty space between teleports, then the bullet never touched him.
Some simple solutions to this are to increase the framerate to 60 fps and reduce your velocity by half; everything will appear to be the same speed, but this will reduce the gaps between teleport locations, as the bullet will be drawn twice as often.
Using a thicker player, in addition, will increase chances of collision.
Another method used in modern games is to create a wireframe actor, and attach it to the bullet. This invisible actor will extend behind the bullet, turning in into more of an 'arrow'. if the wireframe is long enough, it will reduce the teleport gap to 0, and the collision will always happen. The downsides to this method are:
The wireframe is an extra actor to create and destroy, and you will have to remap your collisions to this actor and not the bullet.
There is a chance that the bullet itself may be on the other side of the player and had time to render 1 frame before the collision happens. But at least the collision will happen.
Also, it can sometimes be difficult to troubleshoot when using wireframe actors because you can't see them during gameplay, so its hard to know for sure what they're doing.
And, of course, its possible to be killed by a bullet that looks like it never touched you, like if you fell onto the wireframe but the bullet was already moved. Of course, if your bullet is moving fast enough to have this problem in the first place, then player 1 probably can't fall or jump fast enough to collide this way.
There many other methods, but most of them far more complex than any of these. Try the first two hear and see if you can't make it work right.