Cardboard RPG Movement Rework
The current movement rework actually got finished over a week ago, and was going to share a post with circular entity shadows. However those turned out to be more of a problem than hoped. As a result, the movement rework now gets its own post after all.
A downloadable executable of the change is available on Patreon for those interested.
The primary point of the change is to both simplify and improve movement interactions with unwalkable tiles such as deep water or steep hills. Previously the game used a simplified variant of the often misunderstood and as a result somewhat infamous “Speculative Contacts” technique as described in this article. While a very good technique that I will absolutely use again in the future, it was ultimately a bit overkill and would’ve become a performance bottleneck later.
It’s now been replaced by very simplified AABB on AABB predictive collisions without any moving-on-moving physics. In layman’s terms a single moving square (e.g. the player character) having its movement obstructed by any number of static squares (e.g. trees or terrain), taking into account starting position and movement over time so that fast moving squares cannot “glitch” through obstacles and corners can be passed smoothly. Interactions between moving entities still exists in a simplified way, which will either be refined or removed later. Having no moving-on-moving interactions at all would significantly simplify client-side prediction, for example.
The biggest lesson learned from all this is that physics - even heavily simplified ones as in the case of Cardboard RPG - are hard, and as a result require complex solutions even for seemingly simple problems. This also means that it is exceedingly likely I will have to re-visit this issue again in the future.