https://metaplay.io logo
Accessing GameConfig from any Server Entity
# questions-and-feedback
d
Hi, I am writing a Matchmaker Entity and I would like to access the game config. I can see the PlayerActor providing this and i can see it's not trivial. The config I would like to access is not config that would change per player and as such i'm not even sure if ShareGameConfig or ServerGameConfig are even the right place to have this. I've just spent time re-reading the docs and still not very clear what the approach should be. Thanks for any help Andre
j
PlayerActor is indeed a bit complex as it deals with Experiments which allows config have different values per player. But generally: GameConfig is the most convenient place for all game configurations that you might want to update without client or server rebuilds. The right place for configs depends on use case: * GameConfig is good for game business logic configuraton, like economy values, and everything you want to to be able to update to a live server. * Shared GameConfig is for values that are visible for both server and client * ServerGameConfig is for server only, good for hidden game configuration * Runtime Options system is good for server per-environment configuration, such as allowing debug operations on debug environments. * If values are inherent to the code itself and not really updateable, hard-coding them in code is totally an option. But generally I'd suggest trying out using the ServerGameConfig / SharedGameConfig. To access the the currently active config (with no per-player experiments):
Copy code
SharedGameConfig gameConfig = (SharedGameConfig)GlobalStateProxyActor.ActiveGameConfig.Get().BaselineGameConfig.ServerConfig;
// or
ServerGameConfig gameConfig = (ServerGameConfig)GlobalStateProxyActor.ActiveGameConfig.Get().BaselineGameConfig.ServerConfig;