ben-ryder / Conqueror-of-Empires

A turn-based strategy game where up to 4 local players battle to be victorious, by expanding their empires, and controlling units to conquer cities and attack the enemy.
GNU General Public License v3.0
39 stars 10 forks source link

Improve MVC interface #12

Open ben-ryder opened 4 years ago

ben-ryder commented 4 years ago

Describe your feature I suggest improving the MVC interface between the different game classes.

Is your suggestion related to any problems? This was brought to light because of GH-11 and fixing GH-10.
The cause of both of these is that links between the Model and View are quite blurred, and both are having to interact with each other in ways they shouldn't.
For example:

This has become an issue for working on GH-2 as some logic needed for the game is processed in the view, but the computer player's actions take place in the Model.

Suggested Implementation Whatever happens, this will require some large scale refactors of the code! I will have to decide the exact framework I want to employ but a few things to think about are:

ben-ryder commented 4 years ago

Just to add another idea: event listeners could be added. These would effectively hook controller methods into the user interface. When the hooks are triggered this causes the method to run which could then update the model.