Design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.

learn more… | top users | synonyms

13
votes
2answers
1k views

Design of a turn-based game where actions have side-effects

I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the ...
4
votes
2answers
551 views

Making character's skills and abilities as commands, good practice?

I am designing for a game that consist of characters who have unique offensive skills and other abilities such as building, repairing, etc. Players can control multiple of such characters. I'm ...
6
votes
4answers
2k views

Retrieving components from game objects (entities)

Using C# and XNA 4, I've made the decision to go for an entity-component based design for my game after reading such posts as this and this, but I'm now struggling to find how to retrieve components ...
8
votes
3answers
276 views

How to have operations with character/items in binary with concrete operations?

I have the next problem. A item can have a lot of states: NORMAL = 0000000 DRY = 0000001 HOT = 0000010 BURNING = 0000100 WET = 0001000 COLD = 0010000 FROZEN = 0100000 POISONED= ...
1
vote
1answer
223 views

How can I refactor my code to use fewer singletons?

I started a component based, networked game (so far only working on the server). I know why singletons can be bad, but I can't think of another way to implement the same thing. So far I have: A ...
-1
votes
3answers
270 views

correct pattern to handle a lot of entities in a game

In my game I usually have every NPC / items etc being derived from a base class "entity". Then they all basically have a virtual method called "update" that I would class for each entity in my game at ...
1
vote
1answer
126 views

How to model / where to store relational data between classes

I'm trying to figure out the best design here, and I can see multiple approaches, but none that seems "right." There are three relevant classes here: Base, TradingPost, and Resource. Each Base has a ...
1
vote
2answers
1k views

References about Game Engine Architecture in AAA Games [closed]

Last weeks I focused on game engine architecture and learned a lot about different approaches like component based, data driven, and so on. I used them in test applications and understand their ...
1
vote
2answers
187 views

Which are the cons of using only non-member functions and POD?

I'm creating my own game engine. I've read these articles and this question about DOD and it was written to not use member functions and classes. I also heard some criticism to this idea. I can ...
3
votes
1answer
369 views

Settings object with singleton pattern

I need to build an object that will have only one instance because this Object is dedicated to the storage of vital settings for my application and I would like to avoid a misuse of this type or a ...
5
votes
1answer
265 views

Dynamic Components

I am attempting to design a component-based architecture that allows Components to be dynamically enabled and disabled, much like the system employed by Unity3D. For example, all Components are ...
4
votes
3answers
958 views

How can be data oriented programming applied for GUI system?

I've just learned basics of Data oriented programming design, but I'm not very familiar with that yet. I've also read Pitfalls of Object Oriented Programming GCAP 09. It seems that data oriented ...
8
votes
1answer
673 views

Pattern for performing game actions

Is there a generally accepted pattern for performing various actions within a game? A way a player can perform actions and also that an AI might perform actions, such as move, attack, self-destruct, ...
2
votes
1answer
319 views

Techniques for separating game model from presentation

I am creating a simple 2D game using XNA. The elements that make up the game world are what i refer to as the "model". For instance, in a board game, i would have a GameBoard class that stores ...
3
votes
2answers
1k views

Monster's AI in an Action-RPG

I'm developing an action rpg with some University colleagues. We've gotton to the monsters' AI design and we would like to implement a sort of "utility-based AI" so we have a "thinker" that assigns a ...
-3
votes
1answer
483 views

The most popular pattern for game-related programming in C++ [closed]

As the title says, what are the most popular design solutions when creating a new game or a new game engine?
3
votes
2answers
654 views

Design pattern for creating multiple enemies

I'm currently attempting to implement a factory method pattern for creating multiple different enemies after loading data from a file. But I'm having second thoughts on what would be the best design ...
1
vote
1answer
407 views

Trouble with the State of things in XNA

I'd decided to break the mold and make my first game based on RPG mechanics (note sarcasm). An RPG style action bar would be a reasonable and fun way to get started as it's limited in scope but still ...
6
votes
1answer
188 views

Applicability of Business Architectures in XNA 4

I've done a lot of C# programming and the architecture we use of late is a MVC => PresentationService => Domain Service And/OR DataService => Repository with a UnitOfWork and a messaging bus. In web ...
1
vote
0answers
269 views

State Machine with State per Entity [closed]

I have a generic state machine implementation like this: public abstract class State<TOwner> { public virtual void OnEnter(TOwner owner) { ... } public virtual void OnExit(TOwner ...
0
votes
1answer
183 views

Design patterns for effects between actors and technology

I'm working on my first game, and taking the opportunity to brush up my C++ (I want to make as much of it as portable as I can.) Whilst working on the technology tree and how it affects actors ...
0
votes
1answer
226 views

How to keep balance / Unlock items / achievement rules

I'm working on an engine for a game, too learn javascript and just because its fun. I'm a flashdeveloper, I know how to build websites. Now making games is a different challenge, javascript is a ...
3
votes
0answers
539 views

Any recommended books/resources on component-based design? [closed]

I come from a background with heavy use of the classical object-oriented paradigm for software development. The company I am a part of switched to Unity not too long ago, and we're all very excited ...
0
votes
4answers
753 views

Separating game logic from animation

For non-game applications the model-view-controller pattern is typical where data, logic, and visuals are separated. But for a game how would you architect the game logic and the animation system in ...
3
votes
1answer
548 views

Design patterns in Game Physics

In the frames of a number crunching compatible programming language (say.. C++), what would be an elegant solution for adding self collision, external collision and integration step (Euler, etc.) ...
2
votes
2answers
356 views

AS3: Using singletons for sound managers [duplicate]

Is it necessarily a bad thing to use a singleton for a sound manager? I am having a really tough time determining whether or not I should go ahead and use a singleton (which is easy/it works) or if I ...
1
vote
1answer
245 views

Where in code to for collision? In object class? Mainline code?

Making a simple game in Love 2D framework where if I click on an object then it disappears. Do I check to see if I've clicked the enemy inside a function in the enemy object? Or just in my main.lua? ...
1
vote
1answer
267 views

Unit selection - logic & screen communication

I'm building a game using SFML, with disconnected logic & screen systems that run on different threads and communicate through synchronised buffers. Now, this system worked perfectly well when I ...
1
vote
3answers
519 views

How to expose game data in the game without a singelton?

I'm quite new to cocos2d and games programming, and am currently I am writing a game that is currently in Prototype stage. Everything is going okay, but I've realized a potentially big problem and I ...
35
votes
5answers
3k views

How to avoid the GameManager god object?

I just read an answer to a question about structuring game code. It made me wonder about the ubiquitous GameManager class, and how it often becomes an issue in a production environment. Let me ...
0
votes
1answer
778 views

In some games, we just let the main() loop be the Player object or Table object?

I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for ...
3
votes
1answer
177 views

Using allocators for different systems

I am going over the memory architecture for my game and even though I know my memory budgets may not be final, I at the point where I can start using them in a general sense. I know that I will need ...
2
votes
4answers
950 views

Templates and game consoles

I have overhead in several times that templates should not be used on video game consoles, however, I never heard why or understood why. Why shouldn't templates be used on video game consoles, and if ...
10
votes
3answers
4k views

Custom allocators used in game development

I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done ...
7
votes
3answers
447 views

Profiling and containing memory per system

I have been interesting in profiling and keeping a managed memory pool for each subsystem, so I could get statistic on how much memory was being used in something such as sounds or graphics. However, ...
9
votes
1answer
422 views

Is it worthwhile to use particle pools in managed languages?

I was going to implement an object pool for my particle system in Java, then I found this on Wikipedia. To rephrase, it says that object pools aren't worth using in managed languages like Java and C#, ...
0
votes
1answer
73 views

What is the best way to implement host-migration application design?

I'm trying to wrap my head around how any one of the clients could become a new host should the current host leave the game. I'm not looking for any code, but more of a high level application design ...
5
votes
2answers
382 views

Software engineering theory for hobbyist developers

In playing around with my hobby projects in various object oriented languages, I have realized that creating good class structure and program architecture is both crucial and not straightforward to ...
3
votes
3answers
829 views

How to refactor and improve this XNA mouse input code?

Currently I have something like this: public bool IsLeftMouseButtonDown() { return currentMouseState.LeftButton == ButtonState.Pressed && previousMouseSate.LeftButton == ...
2
votes
3answers
368 views

What is the ideal way to separate presentation and logic, and when is it OK to combine them?

I'm still somewhat new to "proper" design, but I'm trying to keep with it as much as possible. I thought I was OK but I've run across a slight dilemma: how should I be implementing the actual drawing ...
12
votes
3answers
725 views

Design patterns for rules systems?

As a quick fun project, I tried writing a solitaire game. But when getting to writing up the rules systems, I felt dirty, because my code felt completely unstructured and inextensible, mainly because ...
19
votes
4answers
3k views

“The Game Object” - and component-based design

I've been working on some hobby projects the last 3-4 years. Just simple 2d and 3d games. But lately I have started a bigger project. Soo in the last couple of months I've been trying to design a game ...
2
votes
1answer
708 views

How to encapsulate game objects (entities) in Box2d

I am currently learning Box2d, a 2D physics engine within libgdx. But Box2d seems to be in every game framework these days so I am not really talking about libgdx. I understand Box2d comes with lots ...
2
votes
1answer
677 views

What threading strategy does a game like Transport Tycoon use?

Transport Tycoon is a simulation game where you control a transport company, place railroad tracks and trains, airports, bus depots, boats etc. Now the game is about 15 years old and I remember ...
7
votes
1answer
477 views

Design of a camera system

Thinking about a common game, doesn't matter the type of the game, it's very likely that we need some camera type. For example: Debug camera: controlled by keyboard and mouse, with that we are able ...
3
votes
2answers
364 views

How can I improve this architecture?

In a roguelike I'm developing in Ruby, I started with a traditional object hierarchy where all game logic relevant to creatures were contained in the Creature class. Movement logic, for example: ...
13
votes
6answers
4k views

Game Components, Game Managers and Object Properties

I'm trying to get my head around component based entity design. My first step was to create various components that could be added to an object. For every component type i had a manager, which would ...
7
votes
2answers
877 views

Is Domain Driven Design good for games?

I've just read about Domain models and it enlightened me since I've been developing a game that has a class which only holds data (few behaviors/methods). I assigned the job of handling these classes ...
19
votes
2answers
1k views

If “ResourceManager” classes are considered bad, what are the alternatives?

I'm hearing conflicting opinions such as: "Dedicated Manager classes are almost never the right engineering tool" "Dedicated Manager classes are (currently) the best way to survive a large project ...
12
votes
1answer
4k views

Designing a ResourceManager class

I've decided I want to write a central ResourceManager/ResourceCache class for my hobby game engine, but am having trouble designing a caching scheme. The idea is that the ResourceManager has a soft ...