Original Post
Hi, First Question: I’ve been recently reading up on some design patterns that have successfully used with game programming. One of these is the Model-View-Control design. Although I haven’t seen any code example for this pattern yet, I think I got the full idea and can put this pattern in my code. There was only one point that I couldn’t understand how it’s done. Everyone who explained said that, although the Controller has all the functionality to control a ‘Model’, It’s doesn’t do any controlling (doesn’t control the ‘Model’ directly). Instead, the ‘Model’ ‘queries’ (God I hate that word -_-) the controller for the changes. How does this work?? I can’t seem to visualize it. Second Question: What is the best way to check if a value has changed without using conditions or loops? For example, let say I have a Player Character class with a ‘m_health’ member. How can I design this so if the value of m_health changes, other parts of the game get informed of that (like the GUI health bar)? I know that sending an ‘Event’ with the changed member and value is enough to inform the rest of the game. But who or what sends that ‘Event’ in the first place? Thanks in advance