Game Update: Blox multiplayer is now functionally complete! It doesn't look pretty yet, but dressing it up is the fun part. There are some notifications that I need to add in, like what powers are active at any given time. That's all display though, as the information is readily available. What's Next:
|
Design Update:
Not bad for an experimental project with MVC Code Control. So far MVC design has been really useful. It's bloated, as expected, but here are the main benefits I've found so far:
The only con I have so far is that I have to write two times more code to put in a new feature or actor. I've reduced this problem by creating my own MVC template and template generator (in editor!). Now making MVCs is quick and easy. You can find the download to my template generator in the Unity Code Control forums near the bottom. I'll make it available on my web site sooner or later.
Not bad for an experimental project with MVC Code Control. So far MVC design has been really useful. It's bloated, as expected, but here are the main benefits I've found so far:
- I always found a good home for everything. Usually in Unity, when my project size gets pretty big, it's tough to figure out where functionality should be placed. With MVC, data goes in models, design goes in view, and logic in controller. Simple.
- Disciplining myself to stick with strict communication rules (See diagram below) has made it easy to find bugs and problematic areas. If there is a problem with data values, the problem is likely in the controller for the model that data is stored in. Display problems are either caused by View code or incorrect controller instruction. etc...
- Low coupling has also helped with bug finding and plugging in new features. This should also help with re-usability, but I'll benefit from that next project.
The only con I have so far is that I have to write two times more code to put in a new feature or actor. I've reduced this problem by creating my own MVC template and template generator (in editor!). Now making MVCs is quick and easy. You can find the download to my template generator in the Unity Code Control forums near the bottom. I'll make it available on my web site sooner or later.
My Game Objects were categorized depending on their scope and responsibilities:
Services
Purpose: To manage certain persisted entities and serve actions on them through messages.
Life: Instantiated on init and persist through the entire game.
Examples:
Scene Managers
Purpose: These are controllers of game flow per scene. Instantiates relative MVCs.
Life: Instantiated on scene load and destroyed on scene unload. One per scene.
Examples:
Model View Controllers
Purpose: These define my Actors and GUIs.
Life: Relative to scene manager or service instruction.
Examples:
Messages
Purpose: Data classes that act as message payload for the Code Control messaging system.
Life: Relative to the message object's sender and receiver.
Examples:
Purpose: Define commonly used enums and structs.
Life: These are used by the user when needed.
Examples:
Services
Purpose: To manage certain persisted entities and serve actions on them through messages.
Life: Instantiated on init and persist through the entire game.
Examples:
- ServiceLoader - Loads and parents all services.
- LevelService - Manages scenes and services the loading of each.
- PlayerService - Saves/Loads player MVCs and services access to them.
Scene Managers
Purpose: These are controllers of game flow per scene. Instantiates relative MVCs.
Life: Instantiated on scene load and destroyed on scene unload. One per scene.
Examples:
- IntroSceneManager - Plays a list of splash screens and exits when finished.
- MainMenuSceneManager - Handles button events and triggers scene load on button press.
- MultiplayerSceneManager - Handles the flow of the multiplayer game.
Model View Controllers
Purpose: These define my Actors and GUIs.
Life: Relative to scene manager or service instruction.
Examples:
- MultiplayerBoard - The NxM grid playing field.
- PlayerHUD - Heads Up Display for in-game player information.
- MultiplayerGameSettings - The GUI for game settings.
Messages
Purpose: Data classes that act as message payload for the Code Control messaging system.
Life: Relative to the message object's sender and receiver.
Examples:
- LoadLevelMessage - Used by the LevelService to load levels on command.
- MatchMessage - Used to communicate the player made a match on the board.
- PlayerScoreMessage - Communicates player score updates.
Purpose: Define commonly used enums and structs.
Life: These are used by the user when needed.
Examples:
- PowerUp - Struct containing power up info.
- PlayerID - Enum with player IDs (PlayerID.One and PlayerID.Two)