Closed momander closed 5 years ago
The playerId is a unique id which is assigned to each player. GameObject.playerId
is a reference to the current player. So GameObject.playerId
should reference GameEngine.playerId
(rather than the other way around).
I considered renaming GameObject.playerId
to GameObject.ownerId
but that proposal has its own disadvantage: then the attributes have different names and their relation is not as obvious. GameObject.owningPlayerID
is clearer, but it's a bit long.
In any case, the code did not implement playerId in the base object GameObject
, rather it was added separately to each subclass (DynamicObject
, PhysicalObject2D
, and PhysicalObject3D
). That should be fixed.
The doc for
GameEngine.playerId
says:This is confusing. I thought at first that this meant the
id
property of the GameObject. It seems it refers to theplayerId
property of the GameObject. But that property is not listed in the doc for GameObject, so there is no way of finding out about it, short of reading the code.How to fix:
Document
GameObject.playerId
and point to it from the doc forGameEngine.playerId
.In other bug reports I have seen talk of an
ownerId
property. That is perhaps a better name, as it seems one player can own many GameObjects? If the switch is made toownerId
, update the docs for GameEngine and GameObject.