Meigyoku-Thmn / ThMouseX

A piece of software that enables mouse control in Touhou Project series.
19 stars 23 forks source link

Smoother movement? #3

Closed IntOverflow-maxwell closed 3 months ago

IntOverflow-maxwell commented 4 months ago

While playing in Touhou 8 IN, I noticed that Reimu was only moving in diagonals, and after looking at the code, I've been experimenting with implementing Bresenham's algorithm for smoother movement, by effectively "drawing" out straight lines via movement inputs, effectively making Reimu beeline for the mouse. I've made a fork and changed InputDetermine.cpp with a rudimentary implementation. I'm not sure if this is a good addition or if it's portable across games, so I'm opening an issue.

Meigyoku-Thmn commented 4 months ago

I actually had the same idea several years ago, but had no idea how to do it correctly. Most games have 8-directional control, but the concrete implementations vary, in every Touhou game I know of, diagonal Δ (dΔ) is the same as horizontal Δ (hΔ) and vertical Δ (vΔ), Pythagorean theorem doesn't apply (dΔ ≠ √(hΔ² + vΔ²)), so I'm not sure if Bresenham's algorithm can be used. Then you have to take into account that the player will be constantly moving the mouse. You are welcome to make a pull request, it can be an option per game so it's not necessary to be suitable for every game.

Meigyoku-Thmn commented 3 months ago

Close issue since it is done in https://github.com/Meigyoku-Thmn/ThMouseX/pull/4