0
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Good compared to what alternative? Good for what kind of game? Good for what kind of priorities in your development process? \$\endgroup\$ – Philipp Feb 6 '17 at 0:00
  • \$\begingroup\$ This Q&A site is usually better at answering questions of the form: "Here's something I need to do / problem I need to solve. What solutions are there?" rather than "Here's a solution (MVC) - what should it be used for?" My general advice would be, if you're not sure you need MVC for the task you're working on now, don't worry about trying to find a way to slot it in. Do what makes sense for the feature you're developing. If you're not sure what makes sense for the feature you're developing, then ask about that specific feature - there might be solutions worth discussing that aren't MVC. ;) \$\endgroup\$ – DMGregory Feb 6 '17 at 0:03
  • \$\begingroup\$ @DMGregory thank you for answering. the matter is I started working with a team that they used mvc pattern. so I had to know how it really works on games. no matter. thanks \$\endgroup\$ – virtouso Feb 6 '17 at 0:22
  • 1
    \$\begingroup\$ If they use it, and it works for them, and they're making games, then it works for games. ;) At least, the kinds of games they're making, made the way they make them. For anything more, we'd need to know details of the specific problems you're trying to use MVC to solve. \$\endgroup\$ – DMGregory Feb 6 '17 at 0:25
2
\$\begingroup\$

Unless you're making a game like solitaire or minesweeper, the design pattern that games typically use is called the game loop.

  1. Read Inputs
  2. Update State
  3. Draw
  4. Go to 1.

You can see that it has similarities to MVC, but there are some differences. MVC typically does all 3 steps per action. The game loop takes all actions then does all updates then draws everything. MVC is typically reactive to input. The game loop does all three steps every frame whether there was input or not (ai always needs to update).

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.