Separation of Concerns

Discussion in 'Game Development (Technical)' started by ccwscott, Sep 2, 2017.

  1. ccwscott

    ccwscott New Member

    Dec 30, 2013
    Likes Received:
    When you're building a game what general design pattern do you use? I was planning on having a game mechanics layer that handles the location of all the game objects and the rules about how they interact, and a layer with all the graphics entities that determines how to display the game state and interprets device input into actions on the game objects. My concern is that transferring all the data about the game state every time the screen updates would have too much overhead. My plan was to have some event driven back about game state changes or the like, but wanted to ask about how other people do it, or if there is a generally universally accepted approach to handle this.
  2. Scoper

    Indie Author

    Nov 5, 2015
    Likes Received:
    The design patterns I use depend on what I am building. I have not found one general-purpose design pattern to use for everything. Some of the patterns I use most commonly are: Factory, Singleton, Facade, Command and Observer.
    The answer to your specific problem will also depend on the type of game. For a board or card game type of game, it makes good sense to have a central controller for the location of all objects. For a shooter or platformer, it is better to have each object handle its own state.
    Concerning events and frame updates, it is generally considered bad practice to send events every frame - for the reasons you state. Events should be sent only when something happens or changes.

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer