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

discId #2

Open wxyz-abcd opened 1 year ago

wxyz-abcd commented 1 year ago

setPlayerDiscProps uses a loop over all player objects to find the player disc that has id=discId. (This is basro's original method.) Instead of this, creating an object that maps all discIds to player objects will possibly improve performance. The issue here is that basro uses array indices as disc ids. It causes problems when a player joins or leaves the room. Let's also be careful about that.

wxyz-abcd commented 1 year ago

This player loop is also used in a lot of different places in a similar way. We certainly need an id-to-player map data structure.