• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Michael Santer
      Hi!
      We're currently two programmers and a game designer working on a turn-based tactics fantasy board game. For reference you can search for images of "Tactics Arena Online", a fairly dated game that used to have a lot of depth and complexity.
      Our goal is to use the same combat concepts, but giving it a much needed modern touch as well as a whole new set of heroes to choose from with additional abilities. The game is a mix of isometric and 3D and we plan to release the game on Steam and hopefully Android & iOS as well.
      We are looking for someone to work with us pro-bono (just like we're doing) as a 3D character artist. The skills needed are creativity, a hard working attitude and an ability to make minor animations (things like idle, walk, block and very rudimentary attack animations). A perk to have would be the ability to make some VFX. If the game makes it on steam and money starts coming in, you'd obviously be compensated for your hard work, but as it stands this is a hobby project to garnish your portfolio.
      A bit more about the game:
      This game will be an online multiplayer game where each user gets to pick up to 10 characters to place on his half of the board (this would be done before even entering matchmaking. Think runes in League of Legends for example). The user can place his 10 units of choice anywhere he likes on his half board. Some units can be used more than once. So if you want 4 knights and 2 mages or even if you want 10 clerics, you can do as you please. You can then save your setups for future use. The goal of the game is to wipe out the enemy team.
      Each character or Hero (except premium and abyss characters) start with 1 ability and they can ascend (either by playing a certain amount of matches with the character or by forcing the ascension with real money) to gain a new ability or passive. Acquiring a new character can be done by using in-game currency that you earn from playing matches or using real money with the exception of Abyss characters which can only be acquired by winning certain rare matches. The goal is to offer a freemium game with lots of customizable elements while making sure that no user can "buy power" with real money. We want everything that a paying user can get to be available to non-paying users who play the game a lot.
      Ultimately we want this to become a competitive game that people can enjoy and really get invested in. Each character is designed with options for counterplay in mind and synergy with other heroes.
       
      We sincerely believe in what this game can become and we home to find someone just as passionate as we are to get involved in this project!
    • By CrazyApplesStudio
         Hello , i would like to showcase my first game project, a simple endless casual arcade game called Apples Mania : Apple Catcher. The game has simple goal , scoring as high as possible by collecting falling apples while the difficulty gradually increases. Different apples are worth different amount of points and there are also 2 power-ups to help you in your challenge.
        The game took me about 2 months to complete and polish and i made everything except for the music tracks and some of the sound files. Made in unity and blender3d.
        Would appreciate any kind of feedback.
      Google Play Link
       
        A trailer showing basic game-play:
       
    • By Paszq
      Troglodytes are a playable races in Arpago - they usually don't talk much and most of them lives near water sources.
    • By Paszq
      a Fox in a dungeon :)
    • By Paszq
      Fox Folk is one of 3 playable races in Arpago.
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity is mvc design pattern good

This topic is 435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how mvc design structure works in game development and specially in unity game development.

 

I know what mvc is and how it works but in coding structure for game development specially in unity I don't know how it really works.

 

as you may know is it a good structure for developing video games? if its a yes, why and how it should be used?

 

thank you for helping

Share this post


Link to post
Share on other sites
Advertisement

The MVC pattern

  • Model. The Model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the View), and responds to instructions to change state (usually from the Controller).
  • View. The View manages the display of information.
  • Controller. The Controller interprets the mouse and keyboard inputs from the user, informing the Model and/or the View to change as appropriate.

The Controller notifies the View. Both the View and the Controller depend on the Model. However, the Model depends on neither the View nor the Controller. This is one of the key benefits of the separation. This separation allows the model to be built and tested independent of the visual presentation.

03xpn.gif

And of course the Controller cannot be the only one who changes the Model. For that reason there are indeed some variations:

 

The passive model is employed when one Controller manipulates the Model exclusively. The controller modifies the Model and then informs the View that the Model has changed and should be refreshed. The Model in this scenario is completely independent of the View and the Controller, which means that there is no means for the Model to report changes in its state.

 

The active model is used when the Model changes state without the controller's involvement. This can happen when other sources are changing the data and the changes must be reflected in the Views. Because only the Model detects changes to its internal state when they occur, the Model must notify the views to refresh the display.

 

Note that this is only a UI design pattern and most Model-View-Controller connection combinations will work, but do not necessarly correspond to the MVC pattern (i.e. it is tricky to implement and stick to a pure MVC pattern as one can easily break the conventions...)

 

 

Is it any good for games?

 

The MVC pattern imposes a lot of connections which can become a design flawn in large codebases. One could alternatively use event/message buses.

Edited by matt77hias

Share this post


Link to post
Share on other sites

pehaps MVC comes to mind when thinking about games because of the similarities.

 

the Model is similar to the thing the game is simulating - such as shooting aliens (space invaders) - or running around in a medieval fantasy world (skyrim).

 

the Controller is simply the input devices (mouse, keyboard, touchscreen, etc)

 

and the VIew is of course, the output devices. Screen, audio, VR goggles, etc.

 

you might rename "model view controller" to "system, output, input" - which generally describes more or less all software.

 

 

in 40 years of game coding, "patterns" i've noticed include:

 

a main game loop with input, update, and output (render, audio,etc) capabilities.    Implementations vary widely - but pretty much all games contain these things somewhere. they are the basic components of simulation software. and almost all games are a form of simulation software.  in fact you might define a game as an entertainment simulation (apologies to you interactive story fans out there).

 

initialization, use, and un-initialization of assets and game data.   from how many squares there are in tic-tac-toe, to papyrus scripts for skyrim.   it may be hard coded or data driven - but its in there somewhere.

 

modules with init, run, and un-init methods. such as program, game, and mission modules.

 

lists of things (including lists of size 1) , and methods that operate on  the list or individual elements of a list.

 

there are other "patterns" in games, but it seems most all games have the ones mentioned above. 

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

Those are some patterns, but certainly not the only ones.  I've seen hundreds of named patterns, including every one from the old GoF Patterns book. I've also seen countless other things that are still patterns, just not named and studied patterns.  On my bookshelf I've got a collection of good books describing patterns, smells, designs, and practices; all are variations of the same things with different names. If you look through any large code base you'll see the same fundamental patterns repeated everywhere.

 

 

 

Don't look at a pattern or design and say "I want to do that".  It is backward. That's having a solution and crafting a problem to fit the answer.

 

When you have a problem you are trying to solve, ask "What are the similar existing solutions?"  This will generally lead you to several well-studied patterns, each with well-known behaviors and pros and cons. Then you can quickly evaluate which existing pattern is a good fit, and adapt it as necessary for the problem at hand.

 

For example, if you have a problem where you have one set of data, you want to keep the manipulation of the data insulated and decoupled, and you want the display or other presentation of the data to also be decoupled, then MVC is one possible solution. MVVM and MVP patterns immediately spring to mind, but so do some other patterns for messaging, or for event handling and hierarchies passed between chains.  Many solutions may fit, each with their own small variations and quirks.

Share this post


Link to post
Share on other sites

I should also point out that following patterns religiously is in itself an anti-pattern.

 

The whole point of design patterns is to give you ideas on how to reason about how a system can work. How it can separate data and how information flow works. Often people take it way too literally and try to write classes with everything named "controller" or "view" or something.

 

The question should more be: in what scenarios is this pattern useful, or a variation of this pattern. Is there something I'm having trouble with that it could make easier or more intuitive.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement