Download

How would you implement a complex character?

Hi there!

I’m currently working on a action-adventure-like Game.
The character should be swimming, climbing, shooting, crouching walking, running, jumping, interact with objects etc.

I already implemented jumping, ledge-hanging/vaulting etc.
I’m not satisfied with the result now. I use a lot of booleans to determine which state the character is in
This is way too messy if you ask me and also feels non-deterministic.
86f6a09c21e2a69998dfe66cbad917f78f524b4c.png
c2a2be45813f0a81778efef49c087171f7cd628e.png
2016-03-27 (3).png

This isn’t extensible that easily.

How would you/How do you structure such a complex movement within a character?

I implemented a StateMachine (Switch over Enum) within Event Tick earlier. It felt more deterministic, and was a bit easier to extend. But I wasn’t sure about the perfomance

State Machines are the way to go. Enums aren’t bad at all for performance.

Its worth looking at FTC’s Adventure Kit. (Don’t have link but should be easy to find)
Deconstruct it to see how he does it and maybe also save on reinventing the wheel.