GameMode vs GameState

来源:互联网 发布:幼儿园软件设施 编辑:程序博客网 时间:2024/06/06 07:41

Hey all,

So I'm setting up a GameMode and GameState for my project. After reading online a lot about the differences between the two, I've downloaded the shooter game to get an idea as well.

So I want to see if I had the correct idea... in super laymen terms.

GameMode seems to be the referee, while GameState is kinda of like the assistant ref, just keeping an eye one the clock, who's on what team, what the score is as a whole (PlayerState keeps track of individual scores), and possibly where those players might be on the field if we care about that sort of thing, but mostly TEAM stats - not individual state.

If I hit a player, I don't tell GameState. I tell GameMode and it will decide whether I really hit the player or not. Also, no variables, whether public, private, or protected, should ever changed within GameMode, as those are the rules that are to be set and maintained through the match. If I want rules to change in the middle of a match, whether it's a major or minor change, should I make a separate GameMode and just swap the GameMode?


They Are Very Different In Multiplayer Game

Game Mode = Only Exists on the server, and controls how players login to the match, and how player units are spawned. You can stop a player from joining a multiplayer game here, or know when a player has left. And again this actor only ever exists on the server.

Game State = Ideal for managing all aspects of a replicated world, such as world time, world object positions not owned by a player, AOE damage zones, neutral replicated gameplay elements of any kind.

This actor exists for client and server and allows for each client to know stuff about the world.

Again a great example is World time where you want the client to know what what the session / turn / current mission time is as propogated to each client from server calculations that are done in Game State class on the server, and replicated to each client using a replicated Time variable.

The bulk of actual game-time related stuff in multiplayer game has to be done in Game State if it is anything you want clients to know about locally :)


0 0
原创粉丝点击