You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ClientGame.js is currently mostly a dump for everything that the client should do and it includes helper functions such as lerp and interpolate , network functionality and game logic in the same file.
I can see at least 2 different concerns which should be abstracted out of the ClientGame.js:
Helper Methods: this includes functions like interpolate(), lerp() etc. I think the usage of those should be optional because I may be using a client game library which most probably already provides this functionality for me.
Abstract Client Methods: these would be moved to AbstractClientGame and called by CustomClientGame.js. This would serve to abstract the interface with the engine so it would include things like all the network layer code . For instance: CustomClientGame.updateInput() would have my custom game logic to process game inputs because this changes on evry game. After the custom code is done, CustomGame.updateInput() would call AbstractClientGame.updateInput(inputData) which would call network.sendData(inputData), thus the game logic doesn't need to know how to interface with the network layer
I will provide more suggestions on what could be extracted when I have a better understanding of the code but I'm having a hard time figuring out how it all works.
I apologize for the long post, thanks for reading!! 😃
The text was updated successfully, but these errors were encountered:
jgamedev
changed the title
Extract all logic that is not game specifi from ClientGame.js
Extract all logic that is not game specific from ClientGame.js
Jul 3, 2016
Thanks for the suggestions 😄 . I was going to start with issue #2 you posted. I'll probably do some refactoring and take these thing into consideration.
ClientGame.js is currently mostly a dump for everything that the client should do and it includes helper functions such as lerp and interpolate , network functionality and game logic in the same file.
I can see at least 2 different concerns which should be abstracted out of the
ClientGame.js
:Helper Methods: this includes functions like
interpolate()
,lerp()
etc. I think the usage of those should be optional because I may be using a client game library which most probably already provides this functionality for me.Abstract Client Methods: these would be moved to
AbstractClientGame
and called byCustomClientGame.js
. This would serve to abstract the interface with the engine so it would include things like all the network layer code . For instance:CustomClientGame.updateInput()
would have my custom game logic to process game inputs because this changes on evry game. After the custom code is done,CustomGame.updateInput()
would callAbstractClientGame.updateInput(inputData)
which would callnetwork.sendData(inputData)
, thus the game logic doesn't need to know how to interface with the network layerI will provide more suggestions on what could be extracted when I have a better understanding of the code but I'm having a hard time figuring out how it all works.
I apologize for the long post, thanks for reading!! 😃
The text was updated successfully, but these errors were encountered: