wxyz-abcd / node-haxball

The most powerful and lightweight API that allows you to develop your original Haxball(www.haxball.com) host, client, and standalone applications both on node.js and browser environments and also includes every possible hack and functionality that you can imagine.
MIT License
34 stars 13 forks source link

Room.modifyFrameNo #15

Closed wxyz-abcd closed 1 year ago

wxyz-abcd commented 1 year ago

Room.modifyFrameNo causes "Bad Actor" most of the time. Almost seems hopeless.

wxyz-abcd commented 1 year ago

It is worthy to note that some(or maybe most) of "Bad Actor" was caused by the wrong replacement of "requestAnimationFrame" in node.js. It was an interval with 0ms latency, and later changed to 16.6666666666ms in order to achieve 60fps. This might have fixed the issue. Have to check sometime.

punisherhaxball commented 1 year ago

Since the modifyFrameNo works only if you are client and unless room is created with noPlayer and the player of host is joined with ID: 1 as player the effects of modify framing won't happen on the player. There is some functions that share and communicate the frame no of clients between host and client and when it's overwritten it causes clients froze on their screen. We can work there to maybe create some modifier such as modifyPlayerFrameNo(frameNo, playerId). I will add some comments to the function for peoples interest if someone wants to work on it.

wxyz-abcd commented 1 year ago

Thanks, I will look into it in detail as soon as I publish the website project.

wxyz-abcd commented 1 year ago

Some people are saying that modifyFrameNo is working correctly now. I'm still not very sure, have to test some time.

wxyz-abcd commented 1 year ago

I think it's working. At least it's not causing bad actor now, so there's no more bug.