Keeping game model and graphics/animation separate but in sync

Posted by AJM on Game Development See other posts from Game Development or by AJM
Published on 2011-02-15T23:37:22Z Indexed on 2011/02/16 7:34 UTC
Read the original article Hit count: 328

Filed under:
|
|

Suppose I'm building a chess game where I want to have animations. Pieces glide to their new squares when moved. Pieces perform attack animations when capturing other pieces.

I'm not sure how to effectively separate the data and logic needed for these animations and the actual game model (in the MVC sense). The pieces themselves should ideally not have to worry about their pixel coordinates or current animation frame. At the same time, many changes to the model are effectively driven by animations. A moved piece changes its position after (before?) its sprite is done gliding. A piece is removed from the board after the capturing piece is finished its attack animation.

How would you suggest I manage the game model, the graphics and animations, and their relationships? For example, where would the animations "live"? How would animations be created and managed in response to player moves? How would animations drive updates to the game model, or how would the game model drive animations?

© Game Development or respective owner

Related posts about architecture

Related posts about animation