ExperimentalPlayground is designed to receive *engine.Object and pass it through to engine.Map. *engine.Object contains an actual game object. Therefore, there is a necessity to manage *engine.Object somewhere on the layers above ExperimentalPlayground which turned out to be a quite complicated and awkward situation.
Rewrite ExperimentalPlayground to manage *engine.Object inside of ExperimentalPlayground:
Rename *engine.Object to *engine.Container with regards to the purpose it serves
Define engine.Object interface as an empty interface interface{}
Make all methods of ExperimentalPlayground receive actual game objects engine.Object and wrap them into engine.Container before passing to engine.Map
Store the mapping of game objects and their containers in ExperimentalPlayground: map[engine.Object]*engine.Container
Add sync.RWMutex to regulate access to the map
Rewrite tests for ExperimentalPlayground and add some if necessary
Conduct a benchmark test to estimate the gains and loses of the new solution
Add comments to ExperimentalPlayground
Accept empty locations as valid when registering objects
ExperimentalPlayground
is designed to receive*engine.Object
and pass it through toengine.Map
.*engine.Object
contains an actual game object. Therefore, there is a necessity to manage*engine.Object
somewhere on the layers aboveExperimentalPlayground
which turned out to be a quite complicated and awkward situation.Rewrite
ExperimentalPlayground
to manage*engine.Object
inside ofExperimentalPlayground
:*engine.Object
to*engine.Container
with regards to the purpose it servesengine.Object
interface as an empty interfaceinterface{}
ExperimentalPlayground
receive actual game objectsengine.Object
and wrap them intoengine.Container
before passing toengine.Map
ExperimentalPlayground
:map[engine.Object]*engine.Container
sync.RWMutex
to regulate access to the mapExperimentalPlayground
and add some if necessaryExperimentalPlayground