MVC pattern and State Machine
Posted
by topright
on Stack Overflow
See other posts from Stack Overflow
or by topright
Published on 2010-05-14T09:22:45Z
Indexed on
2010/05/14
10:04 UTC
Read the original article
Hit count: 420
I think of a game as a state machine. Game States separate I/O processing, game logic and rendering into different classes:
while (game_loop)
{
game->state->io_events(this);
game->state->logic(this);
game->state->rendering();
}
You can easily change a game state in this approach.
MVC separation works in more complex way:
while (game_loop)
{
game->cotroller->io_events(this);
game->model->logic(this);
game->view->rendering();
}
So changing Game States becomes error prone task (switch 3 MVC objects, not 1).
What are practical ways of combining these 2 concepts?
© Stack Overflow or respective owner