Kind of a late reply, as I fixed this about a day after my original post, but I figured I'd post an update about this problem. What caused this was not a problem with the build, but of course, a stupid error on my part.
Say you have code like this (The following is C# btw, not JavaScript, but the same principles apply):
- Code: Select all
void Update() {
transform.position = new Vector3(transform.position.x, transform.position.y + speed, transform.position.z);
}
What this is going to do is move the GameObject this script is attached to "speed" number of units each frame. This is what was causing my problem. In a web build, the FPS are limited to around 60fps, and everything looked fine. But on beefy systems, the Windows build could reach upwards of 500fps at the time. So instead of moving 60 units each second, it was now moving 500.
What I had to do was the following:
- Code: Select all
void Update() {
transform.position = new Vector3(transform.position.x, transform.position.y + (speed * Time.deltaTime), transform.position.z);
}
What this did is multiply speed times the amount of time between updating the last two frames. By doing this, it is now moving "speed" number of units per second, instead of per frame, thus making the game frame rate independent.
Whats funny about this is that I did exactly this for vertical movement, but not for horizontal. So the ship would move up and down at the right speeds, but would fly abnormally fast when running at high frame rates.
But now our game works properly.
