Alien Blitz: PC build

Weird movements near walls & sprites

I’ve finally corrected the player weird movements near walls (in certain situations) and around sprites (depending on angle).

It wasn’t an easy task at all, basically what happens in the game is:

  • Physic is applied at 30 fps in the game, monsters and such are updated at 30 fps
  • Rendering is done at 60fps, with movements interpolation
  • Player movements & camera are controlled at 60fps, synced to rendering
    This is done to avoid some weird artifacts when moving (up to 3 frames can be rendered before actually moving the player, resulting in some kind of like input lags, just worse)

So for the player most physics are applied at 30fps (projection when an explosion happens, gravity,…). But some need to be done during rendering also, else player could “go through walls” (just visually, physical engine is always “right” and will revert player position on its next cycle).

And that’s the hard part, both engine (rendering and physic) need to “agree” on what to do and not interfere.
This can lead to some strange situations where the rendering engine wants to revert the player position, but the physical engine still needs to know the player was trying to go into a wall (because that’s how is made auto jump, if you try to walk into a small wall the game will make you auto jump).

Next engine I build will definitely have the physical engine plugged into the rendering engine, having two threads is way too tricky.

That being said, this is now corrected 🙂 The rendering engine does more collision check but still let the physical engine decide what to do, I had to cheat here and there, but it works !

I am very pleased, these artifacts were driving me crazy, once I began noticing them I couldn’t unsee them… A “regular” player would not have seen them that much I think (players don’t tend to touch monsters as there is no close combat weapons), but it’s just a lot cleaner now.


PC build

I ran into some troubles on my laptop when using the Intel card (right part of the screen was always in the fog of war, but just on Windows, not Linux), but it ended up being a driver problem, updating it corrected everything.

I am now continuing tests on the alpha/demo version and alpha/full version of the game. It seems all right so far, but still needs more testing.


Comments are closed.