MVC pattern and (Game) State pattern

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 9:24 UTC
Read the original article Hit count: 469

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 classes, not 1).

What are practical ways of combining these 2 concepts?

© Stack Overflow or respective owner

Related posts about c++

Related posts about oop