I was hoping some of you smart folks can give me advice on the best practice for loosely coupled objects with id references.
What I would like to do is have separate structs that represent different entities.
I would like to create some kind of relationship between entities using the concept of DB foreign keys.
Enabling fast querying of related objects would also be a must-have.
Instead of tightly coupling things I would rather have it in a fast lookup table.
So an abstract idea example is
I have a player struct with an Id property.
There can be 1:N players each with a unique id
Each player can have 1:N associated objects in play at any given time.
When a player is terminated all the associated objects must also be terminated.
So in a phrase, the objects are "associated with" but not "coupled to" the player.
Any suggestions on creating that deal with this already or perhaps some design patterns you would recommend.