`
aigo
  • 浏览: 2530745 次
  • 性别: Icon_minigender_1
  • 来自: 宜昌
社区版块
存档分类
最新评论

[UE4]GameMode, GameInstance, GameState, PlayerState的区别

UE4 
阅读更多

whats the deferent between gamestate and game instance

https://answers.unrealengine.com/questions/189120/whats-the-deferent-between-gamestate-and-game-inst.html

GameState is replicated extension of GameMode, since GameMode it self is not replicated and exists only on servers memory for security reasons. So GameState let clients access some game data which you would normally place in GameMode, primerly scores and match time, stuff that you usually see on scoreboard. This is only info that client will have and GameMode should have info which only server should know. You can ignore GameState if you creating single player only game.

 

GameInstance is a class that which state persists switching of levels, game mode switches etc. where classes like GameMode or PlayerController are being reset and any data stored in them is deleted and put to defaults again. Any data that you want to keep beyond levels and matches, for example "what player did in specific moment so you can have consequence on other level" should be placed here. This class is mainly helpful for single player games... but it can find uses in multi player too ;] 

 

The GameInstance is itself not replicated, and exists only on the Server, so its variables won't be replicated either. Your best place for something you'd want replicated from the GameInstance would be the GameState, which is replicated.

 

 

For UI of multiplayer game you should use GameState and PlayerState ofcorse

 

=================================================

GameInstance官方解释

https://wiki.unrealengine.com/Game_Instance,_Custom_Game_Instance_For_Inter-Level_Persistent_Data_Storage

One of the new UE4 engine features as of 4.4 is the Game Instance class!

This is a globally accessible instanced UObject that can store any data you want to be carried between levels!

Where formally you would have had to write out data to a config file or to binary file, to transfer between levels, now you can use the Game Instance class!

 

 

===========================================

GameMode vs GameState

https://answers.unrealengine.com/questions/122429/gamemode-vs-gamestate.html

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

 

Rama

 

 

===========================================

Where should I create a manager class : in GameMode or GameState?

https://answers.unrealengine.com/questions/43894/a-manager-class-in-gamemode-or-gamestate.html

This is a bit confusing to me. UE alread has these 'manager' classes set up for you. All you have to do is use them.

You are tying to make manager classes to do the following:

Modify Gameplay - This should be done in the GameMode class

Update Scores - This should be done in the GameState class

Player Statistics - This should be done in the PlayerState class

Now all of these classes are replicated automatically. Check this out: Link to GameMode Docs.. .you can see that you set these all up for the engine to manage internally... you just use them.

What you are trying to do is implement a system that already exists.

Look at the Gameplay Framework Docs to get a better understanding of this.

Good 

 

 

===========================================

Gameplay Framework官方文档

https://docs.unrealengine.com/latest/INT/Gameplay/Framework/index.html

 

分享到:
评论

相关推荐

    GameState demo

    Port GameState Demo(use OIS) to OGRE SDK1.4.5 <br>the orignol demo is here tutorial : ... and it works well with OGRE SDK 1.4.5. I am very happy to share this code with you, if it is useful ...

    csgo-gamestate-spotify:聆听CS的原型

    反恐精英全球进攻游戏状态Spotify ...将gamestate_integration_glennserver_spotify.cfg文件复制到C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg文件夹

    GAMESTATE_GROUP5

    GAMESTATE_GROUP5

    Game_State

    Game_State

    PocketEngine:C ++中的游戏引擎

    掌上引擎C ++中的游戏引擎目前支持MacOS,iOS,...class Game : public GameState<Game> {public: GameWorld world; RenderSystem* renderer; GameObject* camera; GameObject* cube; float rotation; void Initializ

    Stratego_GameState:Stratego的游戏状态作业

    Stratego_GameState:Stratego的游戏状态作业

    pokercash-client:模拟扑克筹码的工具

    扑克现金PokerCash是一种开源远程工具,旨在替代玩德克萨斯州扑克游戏的扑克筹码。... GameState和PlayerData的数据结构: GameAPI和逻辑:即将推出: 在线多人在线版本的PokerCash正在开发中更好的样式和用户界面

    MF(俄罗斯方块)

    namespace KY_GAME { class ST_LOGO : public GameState , public Singleton<ST_LOGO>{ public: bool init() ; void paint(); void callFunc(); private: ST_LOGO(){}; ~ST_LOGO(){}; DECLARE_...

    MF(俄罗斯方块)

    namespace KY_GAME { class ST_LOGO : public GameState , public Singleton<ST_LOGO>{ public: bool init() ; void paint(); void callFunc(); private: ST_LOGO(){}; ~ST_LOGO(){}; DECLARE_...

    tictactoe-gamestate:井字游戏游戏状态

    tictactoe-gamestate 井字游戏游戏状态 这个模块是井字游戏状态 去做 添加使对角线检查通过的代码 在此自述文件中描述方法 检查游戏结束 检查猫状态

    node-csgo-gsi::water_pistol:零依赖反恐精英

    节点csgo-gsi 反恐精英:node.js的全球进攻性。 用法 将gamestate_integration_node.cfg安装到CS:GO cfg目录中。 示例: C:\Program Files (x86)\Steam\steamapps...Loading Game State Integration: gamestate_inte

    PrestigeModel:Prestige手游的Gamestate库,类似于纸牌游戏Splendor

    威望模型手机游戏的 Gamestate 库(目前处于),类似于纸牌游戏 Splendor作者由带给您,由 Rafał Tułaza(模型)和 Bartosz Stokrocki(机器人)编写。内容模型目录包含游戏模型的源代码和单元测试。 Arena目录...

    CSGO-Discord-rich-presence:从《不和谐》中的《反恐精英全球攻势》中显示当前游戏状态

    CS:GO不和谐的存在特色这是100%VAC安全,它使用 。 在Discord中显示来自CS...Linux 从下载适用于linux的最新版本和gamestate_integration_discord.cfg文件将gamestate_integration_discord.cfg文件移动到cfgs文件夹

    pico-boots:PICO-8的基于Gamestate的框架

    皮靴 这是的基于游戏状态的框架。 它包括: 可以用作单独库的模块集合 一些课程可帮助您将游戏作为FSM的一部分运行 作为和等项目的一部分,它正在积极开发中。 该旨在演示框架的功能和API。 完整的构建管道仅适用...

    C#游戏编程GameClasses

    C#写的游戏类 AnimatedImage.cs GameState.cs PlayerImageArray.cs GameTimer.cs ...........

    憎恶:游戏的憎恶就像地牢爬行者一样无赖

    在include / Game / GameState.hpp中编码您的游戏。 选修的: 将所有新状态添加到include / StateManager / States.hpp中。 按照与GameState.hpp或MenuState.hpp相同的模式创建新状态。 将新状态添加到srcs / ...

    TicTacToe:实现MiniMax的UI应用程序

    井字游戏 这是一个基于UI的井字游戏,您可以与AI进行对战... 这是一个多类程序,因此您需要下载所有类:GameAI,GameState,Log,MiniMax和TicTacToe。 要玩游戏,请运行“ TicTacToe”类,因为它是包含“ main”的类。

    everdell::chipmunk:在线玩Everdell!

    关键概念: 每个Game均按照一系列GameState (代表游戏当前状态的最新状态)建模GameState通过GameInput过渡到下一个状态(由客户端指定) GameState还拥有诸如Player , Deck ,丢弃桩,active Location , Event...

    everdellion2:牧羊人收集版

    关键概念: 每个Game均按照一系列GameState (代表游戏当前状态的最新状态)建模GameState通过GameInput过渡到下一个状态(由客户端指定) GameState还拥有诸如Player , Deck ,丢弃桩,active Location , Event...

    Snake:蛇-使用功能编程模式

    #蛇这个项目是我对蛇街机经典 ###特征: 蛇可以用箭头控制蛇食将随机放置在屏幕上蛇食在4到10秒之间有一个随机超时蛇在吃东西后​​会拉长自己每次进食可得1分当蛇与自己接触时,游戏结束了食物的尺寸应等于蛇段...

Global site tag (gtag.js) - Google Analytics