If interested, my situation is a car racing game. The graphics code is in the client module, and the logic code is in the shared module. The player plays in the browser, and once finished, their input controls are sent to the server, that then replays the race in the logic code to make sure they didn't cheat.
Thus, the logic code is run in JavaScript in the browser, and in Java on the server.
In addition to that, players also race against replays of other players. Those replays are generated in the browser, again using the logic code from the recorded player inputs.
JavaScript has been rock solid, across all browsers and platforms (PC / Mac / Android / iPhone / Smart TVs, Tesla browser / ...) The logic code always outputs the same results.
Java not so much.
There is a pattern however:
- The failures always occur with races that have computer opponents (which is about 30% of the races).
- The failures always consistently fail with the same results. Ie: If I run a test with mvn test, I'll always get one result. If I run the same test with IntelliJ, I'll always get the same different result.
I'm trawling through the computer opponent logic code to see if I can see anything suspicious.
I have avoided obvious things like:
- Not using Math.sin, Math.cos, Math.atan, etc. as those return different results based on the platform.
- Not using floats, as they are not suported by JavaScript.
As Colin suggested, I'm also implementing the tests with GWTTestCase, to see if they pass or not.
Cheers.