Wednesday, October 30, 2019

Regression Analysis in Games.

I like Gameplay Programming. Why? Because change one value a little bit then feels very different. When I talk about the feel, I usually talk example of comparing Unreal Tournament and Quake series.

For instance jump. Feel of jump in UT and Quake are definitely different. Yes, they use similar vector calculation but different tune values.

There are another example which is Super mario. There are tons of different platformer games. but feel of jump in Super mario much better than other games. I don't know what values they use but I could use different method to make similar jump feel.

Using regression analysis, I could get a formula. First of all, you can visit http://physmo.sourceforge.net

Using PhysMo, you can get Mario's jump curve data such as


Time
Height
0
0
0.015683
0
0.033367
0.25974
0.05005
0.519481
0.066733
0.727273
0.083417
0.987013
0.1001
1.194805
0.116783
1.350649
0.133467
1.558442
0.15015
1.714286
0.166834
1.818182
0.183517
1.922078
...
...
0.500501
0.415584
0.517174
0.199842
0.523867
0
0.540551
0

With this data and use regression analysis in Excel then you can get the formula like below.





f(x) = -32.038x2 + 17.486x - 0.2101


with this f(x), we can get y value of Mario. it feels same as Super Mario. Of course we can't use it for Ground -> Air -> Falling situation and others but you get the idea how to use Regression Analysis in Games.


Reference
Original idea of Super Mario analysis by Kenton.

No comments:

Post a Comment

Task in UnrealEngine

 https://www.youtube.com/watch?v=1lBadANnJaw