ç§ã¯1幎åããŠããPixonicã®ããŒã ãªãŒããŒã§ãã æ°ãããããžã§ã¯ãã®éå§ãšéçºã«ã€ããŠã以åã«Habréã«ã€ããŠã®èšäºãæžããŸããã ãããªãå¶äœã®éçšã§ãããã«6ãæåŸãç§ã¯å€ãã®èå³æ·±ãçµéšãèç©ããŸããããããåã³å ±æããããšæããŸããã ä»åã¯ãã¢ãã€ã«ã¯ã©ã€ã¢ã³ãã§æ©èœãæ§ç¯ããã³ãŒããæè»ãªç¶æ ã«ç¶æããããã»ã¹ã«çŠç¹ãåœãŠãŸãã
ç§ã¯ã倧å€æ°ãå°ãªããšãäžåºŠã¯ããçš®ã®ãã«ããã¬ã€ã€ãŒã²ãŒã ãéå§ãããšç¢ºä¿¡ããŠããŸãã éå§æã«ãã¯ã©ã€ã¢ã³ãã¯ååãšããŠããã€ãã®éæ³ã®ã¡ãã»ãŒãžãæžã蟌ã¿ãæ°ç§åŸã«ïŒ1人ã®æåãªãã¹ã¯ãããã·ã¥ãŒãã£ã³ã°ã²ãŒã ã®å Žå-æ°åïŒããã¬ãŒã€ãŒã¯ã¡ã€ã³ã¡ãã¥ãŒã«ç§»åããŸãã ããããèµ·åããã»ã¹ã¯ããã¬ã€ã€ãŒã®ä»å ¥ãªãã«éåžžã«è¿ éã«çºçããèšå€§ãªæ°ã®ã¹ããŒãžã§æ§æãããŠããŸãã
- ãã¬ãŒã€ãŒã«æé©ãªå°åã®éžæã
- å€æŽã確èªããã²ãŒã ã®æ°ããèšå®ãããŠã³ããŒãããŸãã
- æ¥ç¶ã®ç¢ºç«ãšèªèšŒã®æåã
- ææ°ã®ãã¬ãŒã€ãŒãããã¡ã€ã«ããŒã¿ã®ååŸã
- ãã¬ãŒã€ãŒãæè¡çãªè©³çŽ°ã«æ²¡é ãããããšã®ãªãä»ã®å€ãã®ã¢ã¯ã·ã§ã³ã
ããã«ããã®æ©èœã¯ããã«å®å šã«èšè¿°ãããã®ã§ã¯ãªãããããžã§ã¯ãã®å šæéãéããŠåŸã ã«æ¡åŒµãããç¶ç¶çã«æ¹åãããŸãã èšèšè ã®ææŠçãªã¿ã¹ã¯ã®1ã€ã¯ã ççµåãåå©çšæ§ãªã©ã®åªããç¹æ§ã倱ããããªã³ãŒãã®éçºãé²ãããšã§ãã
ããããTKã®å°ããªãã¥ã¢ã³ã¹ãåå ã§ãç°¡æœã§å€ç®çã«èŠããã³ãŒãã¢ãžã¥ãŒã«ãã¢ã³ã¹ã¿ãŒã«å€ããããšããããããŸãã äžèšã§èšãã°ãã³ãŒãã§ãã«ãããèš±å¯ããã¹ãã§ã¯ãããŸãã-å€æŽãæ¥ãŠãããã«è§£ãããŠã¯ãããŸãã ã
ãã®èšèšäžã®åé¡ã解決ããã®ã¯ç§æ¬¡ç¬¬ã§ããããã§ã«1幎ã®éçºã®åŸãã²ãŒã ã¯ã©ã€ã¢ã³ãã¢ãžã¥ãŒã«ã®èšèšãå°ããããžãã¯ã«ã€ããŠèª¬æããŸãïŒé¢æ°ãè¿œå ãŸãã¯å€æŽããããšããã¹ãŠã®çŽ æã¯æç³»åã«ãªããŸãïŒã
äžéšã®äººã«ãšã£ãŠã¯ããã®è³æã¯åºãååã®åãªãå¥ã®è§£éã®ããã«æãããããããŸããããå®éã®å€§èŠæš¡ãªå®è·µã®äŸã¯ã圌ãã®ç解ãçµ±åãæ¹åããã®ã«åœ¹ç«ã¡ãŸãã
ã¢ããªã±ãŒã·ã§ã³ã¢ãžã¥ãŒã«ã説æãããã³ã«ãæ¥ç¶å³ã«è¿œå ããŸãã å³ã§ã¯ãã¢ãžã¥ãŒã«ã¯ç¢å°ã§æ¥ç¶ãããŸããããã¯ãããã¢ãžã¥ãŒã«ãå¥ã®ã¢ãžã¥ãŒã«ãåç¬ã§ææããã³äœ¿çšããããšãæå³ããŸãã ã¹ã¬ãŒãã¢ãžã¥ãŒã«ã«ã¯ãŠãŒã¶ãŒæ å ±ããããŸããã ãã®ã«ãŒã«ã«åŸã£ãŠãã¢ãŒããã¯ãã£ã¯åžžã«ããªãŒã®ããã«ãªããŸãã ç§ã®æèŠã§ã¯ãããªãŒã¯æè»ãªã³ãŒããšãã®æ£ããæ¡åŒµã®ã·ã³ãã«ã§ãã
ããããç¶è¡ããåã«ãããäžåºŠäºçŽããå¿ èŠããããŸãã
- å ¬åŒãªãªãŒã¹ã®åã«ãã²ãŒã ãã¶ã€ã³ã®æ©èœãæ確ã«ããããã²ãŒã ã®ãã¬ãŒã ã衚瀺ãããããããšã¯ã§ããŸããã
- æå®ãããã³ãŒãã¯ããããžã§ã¯ãã®ã³ãŒãã®æ£ç¢ºãªã³ããŒã§ã¯ãããŸããïŒããã¯ãäŸãç°¡åã«ããããã«è¡ãããŸããïŒã
- ãããã®ãã©ã¯ãã£ã¹ããã³ããããã³ã³ãŒãã¯ãä»ã®ãããžã§ã¯ãã«ã¯é©çšãããªãå¯èœæ§ããããŸãïŒãã ããèŠä»¶ãšãã¯ãããžã¹ã¿ãã¯ã䜿çšããŠãå¹æçã«æ©èœããŸãïŒã
ããã§ã¯ãæäžå±€ããå§ããŸããããã²ãŒã ãµãŒããŒãšã¢ãã€ã«ã¯ã©ã€ã¢ã³ãã®çžäºäœçšã§ãã
ãã©ã³ã¹ããŒãå±€
ãã«ããã¬ã€ã€ãŒã²ãŒã ã«ã¯ãçµ±åãããããŸãã¯ç¬ç«ããŠèšè¿°ãããããŒã¿ãã©ã³ã¹ããŒãããããŸããéä¿¡ãæŽåæ§ãè€è£œã«å¯Ÿããå察ãããã³éä¿¡ããŒã¿ã®äžæ£ãªé åºãæ åœãããããã¯ãŒã¯ãããã³ã«ããããŸãã
ç§ãã¡ã®æ°ãããããžã§ã¯ãã§ã¯ãAPIãæ®éçãã€åæçã«ãããããããã³å®è£ ã眮ãæããå¯èœæ§ãé«ããããã«ãæåããå®è£ ãæœè±¡åããããšã«ããŸããã ãŸããã²ãŒã ãã¬ã€äžã®é«é »åºŠé ä¿¡ãããã³ã«ã
äœã¬ãã«ãã©ãã³ãããã¯ãŒã¯ã䜿çšããŠãã²ãŒã ãµãŒããŒããã¯ã©ã€ã¢ã³ãã«ããŒã¿ã転éããé«é »åºŠã§ã²ãŒã äžã«çŽæ¥éãè¿ããŸãã ã³ãŒãã®æœè±¡åã®äœæã¯æ¬¡ã®ããã«ãªããŸããã
public interface INetworkPeer { PeerStatus PeerStatus { get; } // int Ping { get; } IQueue<byte[]> ReciveQueue { get; } // void Connect(); void Send(byte[], bool sendReliable); void Update(); // , Service PhotonPeer void Disconnect(); } public enum PeerStatus { Disconnected = 0, Connecting = 1, Connected = 2, }
ãã¹ã¬ããã»ãŒããããŸãã¯å¿ èŠã«å¿ããŠãã¹ã¬ããã»ãŒããã¯ãã€ã³ã¿ãŒãã§ã€ã¹ãä»ããŠèªãå¿ èŠããããŸãã ãæ°ã¥ããããããŸããããINetworkPeer APIã¯åæçã§ãããUpdateã¡ãœããã¯ãåŒã³åºãå ã®å®è¡ã®ã³ã³ããã¹ãã§äœæ¥ã®äžéšãè¡ãããããšã瀺åããŠããŸãã
ããã¯ç§ãã¡ã«äœãäžããŸããã
ã·ãã¥ã¬ãŒã·ã§ã³ã³ãŒãã§ã®äœæ¥äžãæ°ããæ©èœã䜿çšããæãéãæ¹æ³ã¯ãäœæ¥äžã®ã³ã³ãã¥ãŒã¿ãŒã«å€æŽãããã³ãŒãã§ããŒã«ã«ãµãŒããŒãå±éããªãããšã§ãã ãã®ã€ã³ã¿ãŒãã§ã€ã¹ã®2çªç®ã®å®è£ ãèšè¿°ããæ©äŒããããŸããããã®äžã§ããã§ã«å ±éã®ãµãã¢ãžã¥ãŒã«ã®ã³ãŒãã䜿çšããŠãããããã¯ã©ã€ã¢ã³ãèªäœããµãŒããŒã«ãªããŸãã
å°ãåŸã«ããã®çœ®æã䜿çšããŠãå€æŽãããã«ãŒã«ã䜿çšããŠããŒã«ã«ã·ãã¥ã¬ãŒã·ã§ã³ãäœæããŸããïŒãããã£ãŠããã¬ãŒãã³ã°ã·ã¹ãã ã¯ã¯ã©ã€ã¢ã³ãã§åäœããŸãïŒã ãã®ã¢ãŒãã¯ããµãŒããŒãäžå¿ èŠã«ããŒããããæåã®æ®µéã§ã€ã³ã¿ãŒããããã¬ãŒã€ãŒãå¿ èŠãšããŸãããããã«ãããééãã¡ã³ãã«ãæ¹åãããŸãã
ãã©ã³ã¹ããŒãã®ä»ã®å®è£ ã§å®éšãè¡ããå¿ èŠã«å¿ããŠå€æŽããŸãã äž»ãªçç±ã¯ããµãŒããŒã®å®¹éãšããã©ãŒãã³ã¹ãåäžãããããã®ã¡ã¢ãªãšã·ã¹ãã ã³ãŒã«ã®åŠçã®æé©åã§ãã
éã·ãªã¢ã«åã¹ããªãŒã
次ã®ã¿ã¹ã¯ã¯ãåä¿¡ãããã€ãé åãããŒã¿è»¢éãªããžã§ã¯ãã«å€æããããšã§ãïŒGameClientMessageã¿ã€ãïŒã ãã®ãããªã€ã³ã¿ãŒãã§ã€ã¹ã®èåŸã«ãããã®è²¬ä»»ãé ããŸããïŒãã®ã€ã³ã¿ãŒãã§ã€ã¹ã¯INetworkPeerã®å®è£ ã«é¢é£ä»ããããŠããªãããšã«æ³šæããŠãã ããïŒã
public interface INetworkPeerService { float Ping { get; } NetworkServiceStatus Status { get; } // void Connect(INetworkPeer peer); void SendMessage(GameClientMessage message, bool sendReliable); // DTO , . void Disconnect(); bool HasMessage(); // , . GameClientMessage DequeueMessage(); // } public enum NetworkServiceStatus { Disconnected = 0, Connecting = 1, Connected = 2, }
INetworkPeerServiceã¯INetworkPeerã®ã¿ã€ããç¥ã£ãŠããããããConnectã¡ãœããã§äœ¿çšããINetworkPeerã®å®è£ ã¯åæã«INetworkPeerServiceã«ã€ããŠäœãç¥ããªãããšã«æ³šæããŠãã ããã
ããã¯ç§ãã¡ã«äœãäžããŸããã
ãã®æœè±¡åå ã§ãã¡ãã»ãŒãžã®ã·ãªã¢ã«åã«é¢é£ããæ©èœãã«ãã»ã«åããå®å šã«éçºã§ããŸãã ç§ãã¡ã®å Žåãå éšã«ã¯æ¬¡ã®è²¬ä»»ã®æ§æããããŸãã
- LZ4ã¢ã«ãŽãªãºã ã«ããå§çž®ã
- ãããã³ã«ãããã¡ãŒã䜿çšããã·ãªã¢ã«åã
- ã¡ã¢ãªäœ¿çšãæé©åããããã®é åãã«ãšDTOã
- å¥ã®ã¹ã¬ããã§ã®ã³ãŒãå®è¡ã
æåŸã®ç¹ã¯éåžžã«éèŠã§ãããã¬ãŒã ã¬ãŒãã¯ããã¬ãŒã ããšã«åä¿¡ããã¡ãã»ãŒãžã®æ°ã«äŸåããªãããã§ãã ãŸãããªããžã§ã¯ãã®ããŒã«ãæ¡åŒµããæäœã®èªçºçãªåŽåããä¿è·ãããŠããŸãã
ãããã¯ãŒã¯ã¢ãã«ããã®ç¶æ ãããã³ãã³ãã·ã§ã€ã¯æé
ã²ãŒã ã«æ¥ç¶ãããšããåã«æ¥ç¶ã確ç«ããã ãã§ã¯ååã§ã¯ãããŸããã ã²ãŒã ãµãŒããŒã¯æ¬¡ã®ããšãç解ããå¿ èŠããããŸãïŒããªãã誰ã§ãããããªãããªããæ¥ç¶ãããŠããããããªããšã©ããããã ãŸããã¯ã©ã€ã¢ã³ãã§ã¯ãç¶æ ã®ã·ãŒã±ã³ã¹ãå€æŽãããå¿ èŠããããŸãã
- ãµãŒããŒãžã®æ¥ç¶ãéå§ããŸãã
- æ¥ç¶ãæåãããŸã§åŸ ã€ãããšã©ãŒãè¿ããŸãã
- æå³ã«é¢ããæ å ±ãéä¿¡ããŸãïŒãã¬ã€ã€ãŒéžæãµãŒãã¹ãç§ã«ã©ã®ãããªã²ãŒã ãéã£ããïŒã
- ãµãŒããŒããã®è¯å®çãªå¿çãåŸ ã£ãŠãããããã»ãã·ã§ã³IDãååŸããŸãã
- ã²ãŒã ã«é¢é£ããäœæ¥ãéå§ããå ¥åãéä¿¡ããåä¿¡ããããŒã¿ãžã®ã¢ã¯ã»ã¹ãæäŸããŸãã
- ãµãŒããŒããåæãããå Žåãå¿ èŠãªç¶æ ãåãå ¥ããŸãã
ç§ã®æèŠã§ã¯ãå·ã®èšèšãã¿ãŒã³ã¯ããã§æ確ã«ç€ºåããŠããŸãã 以äžã®äŸãããããããã«ããã®ãã·ã³ã¯ãŠãŒã¶ãŒããéããããŠããããã®è²¬ä»»ç¯å²ã§æ±ºå®ãäžãããšãã§ããŸãã
public interface IGameplayNetworkModel { NetworkState NetworkState { get; } // int SessionId { get; } // IQueue<GameState> GameStates { get; } // float Ping { get; } void ProcessNetwork(TimeData timeData); //Update , , Service void ConnectToServer(INetworkPeer peer, string roomId, string playerId); //INetworPeer INetworkPeerService.Connect(peer). void SendInput(IEnumerable<InputFrame> input); void ExitGameplay(); }
IGameplayNetworkModelã€ã³ã¿ãŒãã§ã€ã¹ã®å®è£ ã®å Žåãã³ã³ã¹ãã©ã¯ã¿ãŒã¯æ¬¡ã®ããã«ãªããŸãã
public GameplayNetworkModel(INetworkPeerService networkPeerService)
ããã¯ãäœã¬ãã«ãšã³ãã£ãã£ã®ã³ã³ã¹ãã©ã¯ã¿ãŒããé«ã¬ãã«ãšã³ãã£ãã£ãžã®å€å žçãªæ³šå ¥ã§ãã INetworkPeerServiceã¯GameplayNetworkModelãŸãã¯IGameplayNetworkModelã«ã€ããŠãäœãç¥ããŸããã NetworkPeerServiceãšGameplayNetworkModelã®äž¡æ¹ãã¢ããªã±ãŒã·ã§ã³çšã«äžåºŠäœæãããã¯ã©ã€ã¢ã³ããåäœããéãã£ãšååšããŸãã IGameplayNetworkModelã䜿çšããŠäœæ¥ããäžäœã¬ãã«ã®ãŠãŒã¶ãŒã¯ãINetworkPeerServiceãªã©ã®èªåããé ããããšã³ãã£ãã£ã«ã€ããŠç¥ãå¿ èŠã¯ãããŸããã
ããã¯ç§ãã¡ã«äœãäžããŸããã
æãéèŠãªããšã¯ããã®ã€ã³ã¿ãŒãã§ã€ã¹ã®ãŠãŒã¶ãŒããããã¯ãŒã¯ç¶æ ã®æäœã®ãã¹ãŠã®è©³çŽ°ããä¿è·ãããããšã§ãã éãã¯äœã§ãããå ¥åãéä¿¡ã§ãããã²ãŒã ã«é¢ããææ°ã®ããŒã¿ãååŸã§ãããæ¥ç¶æ倱ãŠã£ã³ããŠã衚瀺ãããã¯ãã§ãã äž»ãªãã®ã¯ãå®è£ ãä¿¡é Œããããšã§ãã
ç¶æ ãã¿ãŒã³èªäœã¯ãæ©èœãé ãããã®éåžžã«åŒ·åãªããŒã«ã§ãã èŠä»¶ãè€éã«ãªãã«ã€ããŠãæ°ããç¶æ ãçå®è¡ãã§ãŒã³ã«è¿œå ããã®ã¯éåžžã«ç°¡åã§ãã 次ã®äŸã§ããã®ãã¿ãŒã³ã«è€æ°åèšåããŸãã
ã²ãŒã ã²ãŒã ã¢ãã«ã ã²ãŒã ããŒã¿ã®è£éãšä¿åã®ã«ãã»ã«å
Unityã§ã¯ãUpdateïŒïŒã®åŒã³åºããéããŠãã³ãŒãã¯å®è¡å¶åŸ¡ãååŸããŸãããããã¯ãŒã¯ã²ãŒã ã§ã¯ãéåžž3ã€ã®ããšïŒç°¡ç¥åïŒãè¡ãå¿ èŠããããŸãã
- ãµãŒããŒã«éä¿¡ããããã®å ¥åãåéããŸãïŒååšããå Žåãããã³ãããã¯ãŒã¯ã¹ããŒã¿ã¹ãèš±å¯ããå ŽåïŒã
- ãããã¯ãŒã¯ã®ç¶æ ãæŽæ°ããå°çãããã®ãã¬ãŒã ã®åŠçã®æºåãã§ããŠãããã®ãåãå ¥ããŸãã
- ããŒã¿ãåéããèŠèŠåãéå§ããŸãã
ãã ããã¢ãã€ã«æ¥ç¶ãäžååã§é ä¿¡ãä¿èšŒãããŠããªãç¶æ³ã§ã®ç»åã®æ»ãããã®ããã«æŠãã«ã¯ãããã«æ¬¡ã®æ©èœãå®è£ ããå¿ èŠããããŸãã
- ãã¬ãŒã€ãŒå ¥åã®åéãšä¿åïŒã¬ã³ããŒã®ãã¬ãŒã ã¬ãŒããéä¿¡é »åºŠãšçãããªãããïŒã
- é ä¿¡æã«å ¥åããŒã¿ãè€è£œããŠãé ä¿¡ã®ä¿¡é Œæ§ãåäžãããŸãã
- å°çããäžçã®å·ãšãã®æ³šæã®ä¿ç®¡ã
- åä¿¡ããç¶æ ã«åºã¥ããŠçŸåšã®ãã¬ãŒã ãæ§ç¯ããããã«å¿ èŠãªããŒã¿ã®è£éã
- DTOã¿ã€ãããã®æœè±¡åã
- éä¿¡é »åºŠã®çµ±èšãç¶æããŸãã
- æéã®æäœïŒãµãŒããŒäžã®æéãåæããããŒã¿ãäžæçãªåé¡ã«é©åãããŸãïŒå ¥åé 延ãæžããããã«æéãé«éåããæ¥ç¶ãäœäžãããããŒã¿ãæ¬ èœããå Žåã«æéãäžæçã«é ããããã·ãããããããŸãïŒã
ç§ãã¡ã®å Žåãããã¯ã²ãŒã ãã¬ã€ã¢ãã«ã®ã€ã³ã¿ãŒãã§ãŒã¹ã®èåŸã«ã«ãã»ã«åãããŠããŸãã
public interface IGameplayModel : IDisposable { int PlayerSessionId { get; } // ICurrentState CurrentState { get; } // , . void SetCurrentInputTo(InputData input); // . void ConnectToGame(string roomId, string playerName, string playerId, INetworkPeer networkPeer); // void ExitGamePlay(); // void UpdateFrame(TimeData timeData); // . }
UpdateFrameã¡ãœããã®å®è£ ã§ã¯ãIGameplayNetworkModel.ProcessNetworkïŒtimeDataïŒãé©åãªã¿ã€ãã³ã°ã§åŒã³åºãããŸãã å®è£ ã³ã³ã¹ãã©ã¯ã¿ãŒã¯æ¬¡ã®ããã«ãªããŸãã
public GameplayModel(IGameplayNetworkModel gameplayNetworkModel)
ããã¯ç§ãã¡ã«äœãäžããŸããã
ããã¯ãã§ã«ã²ãŒã ã®æ¬æ Œçãªãããã¯ãŒã¯ã¯ã©ã€ã¢ã³ãã¢ãã«ã§ãã çè«çã«ã¯ããã¬ã€ããããã«ä»ã«å¿ èŠãªãã®ã¯ãããŸããã ãã®æœè±¡åã®å¥ã®ãŠãŒã¶ãŒå®è£ ãã³ã³ãœãŒã«ã¢ããªã±ãŒã·ã§ã³ãšããŠäœæããããšããå§ãããŸãã dotTraceããã³dotMemoryããŒã«ã¯ç§ãã¡ã®å©ãã«ãªããŸãããUnityãããã¡ã€ã©ãŒãããã¯ããã«èŠèŠçã§ãããããã«ãã©ã®ãããªåé¡ãããããäŒããããšãã§ããŸãã
ãã®éçšã§ããã®ã€ã³ã¿ãŒãã§ã€ã¹ã®å®è£ ãããã€ãäœæããŸãããããã«ãããéåžžã«å®äŸ¡ã«æçšãªæ©èœãæäŸãããŸããã
- ãªãã¬ã€ãèšé²ããã³åçããŸãã æžã蟌ã¿æã«ãå®è£ ã¯åä¿¡ããããŒã¿ãå¥ã®ãããã¡ãŒã«ä¿åããŸãã ãŸããåçäžãå®è£ ã¯ãŠãŒã¶ãŒå ¥åãç¡èŠããIGameplayNetworkModelã€ã³ã¹ã¿ã³ã¹ããŸã£ããå¿ èŠãšããã«ãåã«ãããã¡ãŒãã倱ãããŸãã
- æè¡çãªã¿ã¹ã¯ãšãã¹ãã®æ¥ç¶ã æœè±¡åã§ãããã¹ãŠã®ãã®ã¯ãå€ãã®å Žåèªååã§ããŸããçµ±åãã¹ãã¯ç°¡æœã«èŠããé«ã¬ãã«ã®ããŒã«ã®ã»ããã«æ²¿ã£ãŠãã©ãã°ããŸããã ãŸãããã®ã¢ãã«ã䜿çšããŠããã¹ãã«ãŒã ãäœæããç¹å®ã®ãããå ã®ã²ãŒã ãã¶ã€ããŒããå€æŽãããæ§æã転éããŸãã
ã¢ãŒãã£ãã¡ã¯ã
ããç¬éãããã°ã©ãã£ãã¯ã¢ãŒãã£ãã¡ã¯ããçŸãå§ããŸããã ãã£ã©ã¯ã¿ãŒãšãªããžã§ã¯ãã¯è»œåŸ®ãªåãã§åãå§ããããã¯Androidã¢ã»ã³ããªã§ã®ã¿åçŸãããŸããã ãµãŒããŒãšã®æéåæããè£éåŒãŸã§ããã¹ãŠãå®è¡ããå¿
èŠããããŸããã ããããæçµçã«ãUnityããŒãžã§ã³2017.1.1p1ãã2017.4.1f1ãžã®ç§»è¡åŸã«ãã°ãçºçãå§ããããšãå€æããŸããã ãµããŒããšèª¿æ»ããŠéä¿¡ããåŸããšã³ãžã³ã®Time.deltaTimeã®èšç®ã«ãã°ãããããšãå€æããŸãã-æéã®å·®åã¯æéã®ç©ççãªæµãã«å¯Ÿå¿ããŠããŸããïŒUnity 2018.2ã§ä¿®æ£ããããšãçŽæããŸããïŒã ã³ãŒãã§Time.deltaTimeãçŽæ¥äœ¿çšããã«ãæŽæ°ããªãŒãä»ããŠTimeDataãæž¡ããšããäºå®ã«ããã次ã®ããã«ç·šéãç°¡åã«è¡ããŸããïŒã³ãŒãããªãŒã®æåã®éšåã§ã¹ããããŠã©ãããéå§ããæåã§Stopwatch.Elapsedããã³ã«ãŠã³ãããããã«ã¿ã䜿çšããŠãæéã®ã¿ãä¿®æ£ããŸããã timeScaleã
äžè¬çãªã¢ããªã±ãŒã·ã§ã³ã¢ãã«ã ã¢ããªã±ãŒã·ã§ã³ã®éå§ãã«ãã»ã«åããã²ãŒã ã«åæ¥ç¶ããŸã
ããæç¹ã§ãç§ãã¡ã®ããŒã ã¯ããã¬ã€ã€ãŒãäœããã®åœ¢ã§æŠéãã姿ãæ¶ããå Žåããã¬ã€ã€ãŒãã²ãŒã ã«åæ¥ç¶ããã¿ã¹ã¯ãåãåããŸããã ã€ã³ã¿ãŒãããããªãã«ãªã£ãŠããç¶æ ã§ãã¹ãŠãæãããªå Žå
解決çã¯æ¬¡ã®ãšããã§ããã²ãŒã ãã¬ã€ã¢ãã«ã®ç¶æ ãç£èŠããå¿ èŠã«å¿ããŠåæ¥ç¶ãå®è¡ãããããé«ãã¬ãã«ã®ç¶æ ãã·ã³ãäœæããããšã§ãã ããã«ãéå§æã«ããã®ãã·ã³ã®åæç¶æ ã¯æªå®ã®ã²ãŒã ã®èšé²ããã§ãã¯ããããããã°ãã²ãŒã ãžã®æ¥ç¶ãè©Šã¿ãŠç¶è¡ããŸãã ãããŠæåŸã®ã±ãŒã¹ã§ã¯ããã®ãããªã²ãŒã ããµãŒããŒäžã«ããååšããªãå Žåãæšæºã®æºåç¶æ ã«æ»ããŸãã
ã¹ããŒã¿ã¹ãªã¹ãïŒ
- ã²ãŒã èšé²ã®æ€èšŒã䌎ãã¢ããªã±ãŒã·ã§ã³ã®éå§ã
- ä»äºã®æºåã
- ç¶æ ã¯ãã²ãŒã ã®é²è¡äžã§ãã
- åæ¥ç¶ã¹ããŒã¿ã¹
åœæã®ãã®æé«ã¬ãã«ã®ã¢ãã«ã®ã€ã³ã¿ãŒãã§ãŒã¹ã¯æ¬¡ã®ããã«ãªããŸããã
public interface IAppModel : IDisposable { ApplicationState ApplicationState { get; } // . . GameplayData GamePlayData { get; } // void StartGamePlay(GameplayStartParameters parameters); void PlayReplay(Replay replay); void RefreshRoomsList(string serverAddress); // , void ExitGamePlay(); void SetLastGamePlayInput(Vector2 input, ISafeList<SkillInputData> skillButtonStates); // . void SelectHero(int dropTeamMemberId, bool isConfirmed); // void Update(TimeData timeData); // , . }
ããã¯ç§ãã¡ã«äœãäžããŸããã
ããã«ãããã»ãã·ã§ã³éã§åæ¥ç¶ããããã®ãšã¬ã¬ã³ããªãœãªã¥ãŒã·ã§ã³ã ãã§ãªããåæå段éãæ¡åŒµããããŒã«ãæäŸãããŸããã ã©ããããããããã®ããŒã«ãæ倧éã«æŽ»çšããæ¹æ³ã瀺ããŸãã
äºåçµæ
責任ãåé¢ãã責任ãã«ãã»ã«åããããšã«ãããã¢ããªã±ãŒã·ã§ã³ã¯å€ãã®æ©èœãçµã¿åãããŸãã ãã¹ãŠã®ã³ã³ããŒãã³ãã¯äº€æå¯èœã§ãããäžéšã®å€æŽã¯ä»ã®ã³ã³ããŒãã³ãã«ã»ãšãã©åœ±é¿ããŸããã äŸåé¢ä¿ã¯ãããåºãèŠçŽ ããããç¹åããèŠçŽ ãžã®ãªã³ã¯ã®ãã§ãŒã³ãšããŠãã£ãŒãã«è¡šç€ºã§ããŸãã
å®éã«ã¯ããã®ãããªèšèšã¯éåžžã«åªãããµããŒããšã³ãŒãã®å¯å€æ§ã€ã³ãžã±ãŒã¿ãŒãæäŸããŸãã ç§ãã¡ã«ãšã£ãŠïŒãã¹ãŠã®ç· ãåããå³ããç· ãåããéåžžã®çç£/æ©èœã®å€æŽãèæ ®ããïŒãã³ãŒãã®å€æŽã¯è»œéã§ããããªãã¡ã¯ã¿ãªã³ã°ã¿ã¹ã¯ã¯æ°é±éã§èšç®ãããŸããã
ã¡ãªã¿ã«ã2çªç®ã®ãµãŒããŒãšã®å¯Ÿè©±ã®ãããã¯ã«ã€ããŠã¯ãŸã£ãã觊ããŠããªãããšã«æ°ã¥ãããããããŸããã
- ãŠãŒã¶ãŒã®ãã°ã€ã³æ¹æ³ã
- ã¯ã©ã€ã¢ã³ããçŸåšã®ãã¬ãŒã€ãŒã«é¢ããããŒã¿ãåä¿¡ããæ¹æ³ã
- æŠéã«å ¥ãæé ã¯ã©ãã§ããã
- ã©ãããã°æŠéã®çµæãåŸãããšãã§ããŸããïŒ
- 2ã€ã®ãµãŒããŒãžã®2ã€ã®æ¥ç¶ãèæ ®ããŠæ¥ç¶ã埩å ããæ¹æ³ã
ãã®ã¯ã©ã€ã¢ã³ãã®è²¬ä»»ã®ã»ããã¯ãã¢ããªã±ãŒã·ã§ã³ã¢ãã«ã¬ãã«ã®äŸåé¢ä¿ããªãŒã«ãçµã¿èŸŒãŸããã¿ã€ããšé¢ä¿ã®å¥åã®å€§èŠæš¡ãªãã©ã³ãã圢æããŸãã ãããã次åã«ã€ããŠã¯ã