Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implements a more true to game code intceil calculation #93

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

theRTC204
Copy link
Collaborator

@theRTC204 theRTC204 commented Apr 14, 2020

This replaces all instances of Math.floor() and Math.ceil() with a calculation that more closely matches the C++ implementation in game. In the extracted code, the all values are passed through a function intceil() which is implemented as...

int intceil(float val)
{
    return (int)(val + 0.99999f);
}

In C++ the behaviour of casting to an int results in a truncated value, not a rounded value. As such, there are situations where using JavaScript's Math.floor() or Math.ceil() can result in a value that is off by one. By using Math.trunc(), we can more closely represent the C++ behaviour.

I know we already have reports of calculation issues, and there is a feeling that having a wider net of possible values can reduce the number of failed predictions, but I personally feel the wider net makes it more difficult to diagnose potential problems in this app's calculations. I feel it would be best to represent the in-game calculation as closely as possible.

Open to discussion of course!

Closes #47

This replaces all instances of Math.floor() and Math.ceil() with a
calculation that more closely matches the C++ implementation in game.
@mikebryant
Copy link
Owner

Sure, works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decreasing, spike, decreasing pattern: ceiling function should be applied to minimum spike value
2 participants