Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract all logic that is not game specific from ClientGame.js #6

Open
jgamedev opened this issue Jul 3, 2016 · 1 comment
Open

Comments

@jgamedev
Copy link

jgamedev commented Jul 3, 2016

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:

  1. 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.

  2. 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!! 😃

@jgamedev 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
@arjanfrans
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants