GameMode vs GameState

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 :)


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值