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
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:
The View is performing logic that should be done somewhere in the Model (such as checking if a player has died)
The Model currently has knowledge it shouldn't need about the View (for example so that it can update the city tiles when needed).
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:
I should really be able to play the game in the terminal by instantiating the game model and using the interface.
It is not up to the caller of the model interface to do lots of state checking first, the model interface should be robust enough and return appropriate errors/states for the caller to handle. This is of course within reason, if the errors can be caused by interface based input then this should be handled in the interface where possible too.
The model should be able to perform multiple related actions at once. (Such as conquering a city, and then killing the player if they have no more cities). It should then create some sort of report/event stack about what occurred which the interface can then query and interpret in order to display state change.
The use of a type of "event & state change stack" would allow the user interface to become totally separate from the Model. This has the benefit of offering potential performance improvements, as the Model processing does not have to be throttled by visual updates.
The text was updated successfully, but these errors were encountered:
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.
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:
The text was updated successfully, but these errors were encountered: