Answered step by step
Verified Expert Solution
Question
1 Approved Answer
7. Design Patterns [Points: 30] A downloadable standalone game software needs to be created with an MVC architectural pattern where game engine is the
7. Design Patterns [Points: 30] A downloadable standalone game software needs to be created with an MVC architectural pattern where game engine is the controller (GameController); the scenes are the views GamePlay View, GameCombat View, and GameConfigView; the game & gamer info is the model GameModel, which is essentially an entity class. Also, we need the controller, which is the game engine to be built with Singleton design pattern. The views are created from the abstract base class Game View. The GameModel will have the following attributes: playerName: String, score: int, level: int, and sceneID: int. Be advised that it is just an entity class. The GamePlay View, GameCombatView, and GameConfigView will be subclasses created from GameView abstract class. These views will display information about the player and the related scene identified by scenelD. You can assume about which sceneID (such as PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW) will display what additional info about the scene. The display can be a simple string with all relevant info. You should create a enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. GameController class will be a singleton. You will have to implement the controller class. Follow the MVC design pattern implementation shown in the example in Lecture 14 for the model, its controller, and the corresponding view. Use provided Game View abstract class as the base view and extend this to create GamePlayView, GameCombat View, and GameConfigView concrete classes. Create the GameModel class as the model. You will also need a Driver class to create all the components of the MVC architecture and make 3 calls to the controller to edit model and show view. Implement the followings: based on this problem statement: i. 11. 111. IV. V. vi. Implement the GameModel with the information provided earlier. [2.5] Implement the enum called ViewType with the entries: PLAY VIEW, COMBAT_VIEW, GAME_CONFIG_VIEW. Use this enum in the Game View abstract base class. [2.3] Implement the Game View abstract base class. [2.5] Implement the concrete observer classes GamePlay View, GameCombat View, and the GameConfigView from the base class GameView. Make sure to show appropriate view information based on the view type along with the model info. [6] Implement GameController Class as Singleton and as the controller for MVC in Java (make sure to provide all controller related methods as shown in Lecture 14). The GameController class will have only one parameterized constructor which will take GameModel as the parameter. [4.5+ 4.5=9pts] Complete the implementation of the Driver class. Here the static method "getFromDB" (provided below) in the Driver class as the mock connection with the Database to retrieve GameModel info. [7.5] public class Driver { public static void main(String[] args) { GameModel model1 = getFromDB("StarCommander",1000, 5, 10); //create 2 more models with different data //Instantiate the three views with three view classes // Get or create Game Controller instance with one model and one view //display the view using the controller //modify the model and view for the controller with the 2nd model and 2nd view //display the view using the controller // just modify the model for the controller //display the view } public static GameModel getFromDB(String name, int score, int level, int sceneID) { return (new GameModel(name, score, level, sceneID)); }
Step by Step Solution
★★★★★
3.47 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Below is the implementation for the described problem statement Ill provide code snippets for each part Implement the GameModel ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started