I am reading one great book, Game Coding Complete, and that book strongly recommends using MVC (Model-View-Controller) approach, with three key layers:
- Game Application Layer
- Game Logic
- Game View
To me, this approach looks like an overkill for a mobile computer game.
What is your opinion, please? Is it worth of implementing this architecture, even if it adds extra communication needed between modules? Can this design consume so much CPU power, that at the end, the result would be significantly slower, than if it weren't implemented?
Answer
I somewhat support using an MVC structure even for a simple mobile game. If nothing else, it helps with an issue that plagues developers who haven't gotten bitten by it enough times: separating the display code from the game logic.
I'll also say, though, to keep in mind that MVC, like all design patterns, exists to make your life easier. That means that if, at any given time, staying within some set of rules about what you should and shouldn't do when using MVC is making your life harder, ignore it. One of two things will happen: 1) you'll get bitten later, and then will understand why doing it differently in the first place would actually have made your life easier in the long run, or 2) no consequences whatsoever.
Computer programming, by its nature, gets a lot of rule-followers who value adherence to elegant principle over actually accomplishing anything, and they love to propound their value system; don't let them make you one of them. The most important thing that can happen to your game is shipping it.
No comments:
Post a Comment