https://metaplay.io logo
Hi guys. Is it possible to do Hot-
# general
s
Hi guys. Is it possible to do Hot-loading Game Config Data for non-offline mode? I see you stated that hot-loading is default behaviour for offline server and I'd really like to make hot-load for all players when shared config is updated. Any tips? Thanks
j
Heya, This is currently not supported out of the box, there's a bunch of tricky cases to handle on a game specific level that'd we have to require each game to handle. For example, what happens if the game config changes mid purchase and the item the player is trying to purchase is no longer available, or what if the user experience changes drastically while the user is playing? You can however, still achieve this behaviour, if you enable the Forced Rollout option (see picture), players will be disconnected when a new config is published. The client can detect this by checking if the disconnect reason is
SessionForceTerminateReason.GameConfigUpdated
, the client can then initiate a reconnect and make it as silent as possible. https://cdn.discordapp.com/attachments/1391437700565045501/1391678902996303922/image.png?ex=686cc57a&is=686b73fa&hm=bd2ae509dcc03ef80ea79518a55852393616cc5b69974cf0099c0ed0af1f5945&
s
Hi, thanks for your answer. I'm trying to imitate this situation by publishing new config to localhost and waiting for connection time out. However on IMetaplayLifecycleDelegate.OnSessionStarted playerModel still has old config. Am I doing something wrong or this is desired behaviour?
what I'm trying to do is to detect if there was config update at IMetaplayLifecycleDelegate.OnSessionStarted and update game state accordingly. In other words make ingame changes if there was config update after OnSessionStarted
j
If you used the forced rollout while publishing the game config then it shuld be immediately available upon reconnect, if you did not, then what I think you're seeing is that the backing player actor on the server stays alive for ~30s after the client disconnects. This happens as it's quite common to disconnect and reconnect, and thus setting everything up again would be wasteful (while keeping it alive for a bit is very cheap)
s
Seems like I forgot to mention that I did not use forced rollout and would like to avoid using it until crutial part of config is changed. But for small balance changes or other type of "soft" config changes I'd like to make an ability for players to receive new config after MaxSessionRetainingPauseDuration. So game is not closed nor disconnected Maybe my explanation is a bit complicated 🙂 but so is the requirement)
so flow goes like this -> while game is running new config was published w/o force rollout after game unpauses (ofc if it was on pause) game checks if there was a new config (this is where I stuck, I see new config id but it is the same config) if config was changed after connection pause do some ingame actions
j
New configs are only automatically downloaded on session start, you can download it later if you wish but afaik we don't have any built in solutions for that. On the client, the easiest way to swap the playermodel for a new one with a different gameconfig is to create a new MetaplayClientState, however I don't think that is easily possible without starting a new session. On the server, the PlayerActor has a method
SwitchToNewModelImmediately
. However if there's a session on going, you have to make sure that they're switched at the same moment in the action execution timeline, otherwise your actions will not be deterministic anymore and you might get checksum errors
All in all, this is not something that we can support easily, the best way to do this is to kill the session and recreate it by using forced rollout