[go: up one dir, main page]

Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(2 edits) (+1)

Thank you very much! :)

Diving into movement code of Quake-engine based games can become a bit of a rabbit hole. Since the original Quake code (and also Q3) has been open sourced it's not much of a mystery, how player character acceleration is calculated. The calculations differ slightly from game to game, but the general approach is mostly the same. I looked into Quake 3's code to emulate its movement model in Orbhead:

https://github.com/id-Software/Quake-III-Arena/blob/master/code/game/bg_pmove.c

Also there's a series of youtube videos taking a deep dive into Quake's movement:

Needless to say, it has its quirks, but it managed to feel great across many games sharing the Quake DNA.

An important realization I've made is, that you shouldn't let some built-in physics solver (PhysX in Unity, Bullet or Godot Physics in Godot) handle your movement. The only thing I'm using physics APIs for  is collision detection, and then I handle the outcome myself. So I ended up writing my own collider component which uses boxcasts for detection and adjusts the objects velocity/position accordingly. You also don't need any fancy capsule shapes. Axis-aligned bounding boxes are perfectly sufficient (they have been in Quake 3, HL2, and in many other FPS games). They are cheap, simple, and they don't have inconvenient round shapes.

I also handle vertical movement separately from planar movement. The player controller I've written performs a boxcast starting somewhere at the player's knees downwards to their feet. The downward distance of this boxcast is often called the 'leg height'. It defines what the maximum step height is the player can climb. This is how I detect steps, slopes, and whether or not the player touches the floor.

As for Possessor, I think that a slower paced movement works well with the theme and the overall character of the game. It reminded me a little bit of Thief or System Shock 2 (slower walking pace, high player eye level, as if on spindly legs, if you know what I mean). I think it was very fitting. If the movement would be faster and more fluent, I would've felt more compelled to engage into direct combat instead of strategize on who to posses next and how to take out a group of baddies. What the game wold benefit from is the ability to take steps/stairs without jumping.

(+1)

thank you for such a thorough response, really gave me a lot to think about! hence the long time to respond :)

yeah i never managed to get good-feeling results in my (many) attempts to create a character controller based on physics/rigidbodies (both in Godot and Unity). it almost feels like a trap option :D Possessor uses Godot's KinematicBody node for all character controllers and moving interactible objects in general (gun pickups, throwables (coming soon), etc)

// for those unfamiliar with Godot a KinematicBody is essentially just a Collider That Can Move and you move it solely via code, with a bit of Godot's collision detection sugar on top

i've seen both the "boxcast for collision" and "boxcast/raycast from knee height down" approaches used to great effect (particularly yeah, stair/slope/drop detection becomes a breeze as far as i can tell) but i've never tried it as it's honestly a bit daunting and i feel it's a bit beyond my programming skill level at this point. imo capsule works for the time being, but i might just have a tinker with this approach, just to familiarise myself

and yeah, i totally get what you mean about Possessor's slower, spindly-leg movement :D especially when i replayed it with your comment in mind. yeah, it's not as quick as classic fps movement, but hopefully it does feel, uh, agile enough to consistently dodge/peek corners. i kind of tried to emulate Unreal Tournament 99 a lil bit, not necessarily where it comes to sheer speeds at which you can run but more with the "sharp" feel to it - high acceleration / friction, quick changes to movement direction, that kind of thing

and yeah, you definitely did a great job of emulating that Quake feel in Orbhead! looking at Q3 source code tells me the movement mechanics in Quake 3 are MUCH more intricate than i expected - so it's cool that you managed to translate them so well into a completely different engine