Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrentChua

Posted 19 October 2012 - 11:28 AM

This is my own interpretation but i'll share my thoughts on MVC and Component design pattern.

You can think of MVC as a sub-set of the Component object model. MVC can be broken down into three main components:

Model - Data Component
View - Rendering Component
Controller - User/AI Input Component

MVC was made to try to explicitly separate the data, visual, and modifiers. While Components is more of a way to try to group specific functions. Some examples of a component would be:

Transform Component - Manages linear transforms
Camera Component - Handles all the camera specific functionalities
Text Renderer - Handles all text renderings
Model Renderer - Stores all the needed data buffers such as vertex buffers, index buffers, shaders, materials, textures AND handles the rendering of these data.

Notice that some of these components such as the Model Renderer not only store the data but also handles the rendering(view) and manipulation (animation - controller) of its data. But you can also make it such that inside the Model Renderer Component it breaks it into an MVC for storing, rendering, and manipulating data.

Just as what rip-off said, it depends on how complex your game is. But if you're also writing code to be reused later in your future projects, it might be better to do both.

To give you a better idea, the engine i'm currently developing uses something similar to MVC for the high-level application level functions and a component object model for my Actors(GameObjects).

My high-level application is composed of three main systems; The application, logic, and view layer.

Application layer - Manages all the low-level system data such as file system, renderer, process manager, input devices, and other OS specific systems.
Logic - Handles my game logic specific code. How do game objects react, all the rules in my game, etc2x.
View - Basically my rendering layer.

Inside my logic it manages all my actors and each of my actors contains components required to do their specific behaviors. A very simple scene example would be:

Actor1 - Contains Camera Component
Actor2 - Contains Model Renderer Component

Actor1's camera component is responsible for setting up all the requirements for rendering such as the view, project, camera culling. Actor2's model renderer component uses the info provided by Actor1's camera component to fully render the model.

Finally my renderer doesn't have to worry anything and just presents the rendered image to the screen.

LOL! I didn't mean to have this long explanation. But i hope this helps you understand more about MVC, and the Components design pattern a bit. Posted Image

#1BrentChua

Posted 19 October 2012 - 11:24 AM

This is my own interpretation but i'll share my thoughts on MVC and Component design pattern.

You can think of MVC as a sub-set of the Component object model. MVC can be broken down into three main components:

Model - Data Component
View - Rendering Component
Controller - User/AI Input Component

MVC was made to try to explicitly separate the data, visual, and modifiers. While Components is more of a way to try to group specific functions. Some examples of a component would be:

Transform Component - Manages linear transforms
Camera Component - Handles all the camera specific functionalities
Text Renderer - Handles all text renderings
Model Renderer - Stores all the needed data buffers such as vertex buffers, index buffers, shaders, materials, textures AND handles the rendering of these data.

Notice that some of these components such as the Model Renderer not only store the data but also handles the rendering(view) and manipulation (animation - controller) of its data. But you can also make it such that inside the Model Renderer Component it breaks it into an MVC for storing, rendering, and manipulating data.

Just as what rip-off said, it depends on how complex your game is. But if you're also writing code to be reused later in your future projects, it might be better to do both.

To give you a better idea, the engine i'm currently developing uses something similar to MVC for the high-level application level functions and a component object model for my Actors(GameObjects).

My high-level application is composed of three main systems; The application, logic, and view layer.

Application layer - Manages all the low-level system data such as file system, renderer, process manager, input devices, and other OS specific systems.
Logic - Handles my game logic specific code. How do game objects react, all the rules in my game, etc2x.
View - Basically my rendering layer.

Inside my logic it manages all my actors and each of my actors contains components required to do their specific behaviors. A very simple scene example would be:

Actor1 - Contains Camera Component
Actor2 - Contains Model Renderer Component

Actor1's camera component is responsible for setting up all the requirements for rendering such as the view, project, camera culling. Actor2's model renderer component uses the info provided by Actor1's camera component to fully render the model.

Finally my renderer doesn't have to worry anything and just presents the rendered image to the screen.

LOL! I didn't mean to have this insanely long explanation. But i hope this helps you understand more about MVC, and the Components design pattern a bit. Posted Image

PARTNERS