Download

GameSession versus GameMode versus GameState?

I’m trying to really understand how those 3 classes come together when a game is running.

Currently my understanding is this:

GameMode: Exists only on server. Has some properties that are related to a match.

GameState: Exists on clients and server. It’s the data that the server sends to clients so clients can see some things, like current score, current match state, number of kills per player, etc… Only sends what clients ever need to know.

GameSession: Kinda confused about this one. Handles logging in somehow and the connected players, but I thought GameMode also does this. I think it’s also findable in matchmaking.

So I’d like to understand, how logging in, works for example. I’ve seen GameMode handle logging in, but I also see GameSession handle logging in. I’m a bit confused as to who does what exactly and what are the right places to put some of the things I need. I’m trying to study Unreal Tournament and Shooter Game source code, but I’m still a bit confused about which functions are called in what order.

I’ve seen that a GameMode manages a GameSession, but I’m confused as to why it’s not the other way around. What if one match is a Deathmatch game, and the next is a Capture the flag game. How can it support game mode switches without booting all players, unless GameSession is somehow passed to a different GameMode. But if so, then what manages the entire state?

And what if I wanted to maintain some kind of state between rounds, like Campaigns in Wolfenstein Enemy Territory and Quake Wars? What about maintaining campaign state in single player.

Is it possible to get a sequence diagram or step by step of how players log in and what functions are called and who manages what?