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

learn more… | top users | synonyms

3
votes
1answer
56 views

How can I facilitate communication between “attack” and “movement” components?

I'm currently programming in Unreal, but this is more of a component oriented design question. I'm trying to follow a component driven aproach, and I have currently achieved creating a movement ...
0
votes
1answer
79 views

Entity System and “composite” entities

I'm new to the Entity Component System pattern and there's something I cannot figure out. Let's say I have the following entity: Player: { Components: [ Position: { x: 0, ...
7
votes
2answers
322 views

How do I avoid writing Manager classes?

I seem to keep reading it's a bad idea to use XxxManager style classes in game engine programming, yet even when I try to avoid their use I always end up with something that holds all the actors/...
0
votes
1answer
71 views

Adding network support

I am trying to implement a simple game "Bulls and cows" in c#. It is a final project of my university course about design patterns. The target of the game is simple - try to guess the opponent number. ...
0
votes
2answers
64 views

Behavior Tree with interrupted sequence

I'm reading up on Behavior Trees and would like to know how a good implementation for a scenario where the conditions can change or where a selector with a higher priority interrupts the current one. ...
5
votes
8answers
3k views

In Unity, how do I correctly implement the singleton pattern?

I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating and validating a singleton. Is ...
2
votes
2answers
917 views

Which Design Patterns Should I consider for Quest Management? [closed]

I am working on an fantasy RPG and I would like to get some ideas about how I am implementing Quests. Quests in my game are very generic. The quest goal can be almost anything in the game. The goal ...
1
vote
1answer
65 views

Entity-components pattern and memory management

I indent to use a level-entity-components hierarchy in my c++ game engine where level is just a placeholder for entities. However, since I'd like to setup all the levels at once (and thus entities and ...
1
vote
1answer
44 views

Categorizing Projectiles in an arcade shooter (multiple inheritance?)

I have been working on a simple arcade shooter in Java in the vein of missile command/space invaders. I've made a base Projectile class and have been extending other Projectile types from it. This ...
8
votes
3answers
2k 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 ...
0
votes
0answers
28 views

Platformer command queue - not sure how to proceed

While trying to figure out how to implement platform agnostic input handling for a platformer, I've discovered the command pattern and I liked the idea so I wanted to take it a step further. I got ...
1
vote
3answers
191 views

Unity - Toolbox pattern is not safe

When I create a toolbox such is in this tutorial. How do I defend against breaking the pattern with multiple instances like this: gameObject.AddComponent<Toolbox>(); gameObject.AddComponent<...
0
votes
1answer
26 views

design / data structures

I'm working on a game which I'm writing in Javascript and then porting to iOS/Android via phonegap/cordova. For the most part, I understand how to code and how to get what I want to happen, BUT I ...
0
votes
2answers
115 views

Java RPG class implementation (design pattern ?)

For my school project I'm making a little NFC based game on Android. The concept is simple, on each phone you create a character and you can fight with other people through NFC. The character will ...
4
votes
3answers
501 views

Manage user input and diffentiate it between the player and the app

I hope the title makes sense. Basically, I am trying to figure out how the app will know I the input I am sending it is meant for the app and not the player, and vice-versa. (It is very similar to ...
0
votes
0answers
33 views

what is an elegant way to add a border to a hexagonal grid

At the moment in my hexagonal map generator, I am working from the idea of generating the grid, doing some nasty conditional logic to check if grid position is within the scope of the border and ...
3
votes
3answers
132 views

Is it a bad practice to add helper methods if the class is intended only for data? [closed]

For example, if I have something like: class ItemData { public int cost; public int level; ... public List<ItemData> childItems; } And I'm aiming to separate ...
0
votes
1answer
64 views

Efficient way to store entities in javascript

I am trying to design a game from strach with Javascript. It's a 2D game (a kind of Zelda on old devices). I am trying to find an efficient way to store my data because I know I will have to face ...
1
vote
1answer
86 views

Buttons implementation with regards to a basic Game Loop

As the title states I am creating a game with SFML being the only library used. I am entirely unsure how to go about this. I want the buttons to be activated by simple mouse clicks (when the mouse ...
0
votes
1answer
85 views

Sprite quickly disappears after rendering

I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of ...
1
vote
1answer
79 views

How should I efficiently clear and redraw my canvas with lots of animated sprites?

My current solution is to clear the entire canvas and redraw all sprites on every requestFrame(). This works but feels inefficient: I only need to clear the part of the canvas made invalid by ...
0
votes
0answers
35 views

Unity State machine behavior practice

I have few scripting design question regarding the SMB. I am excited to apply the state machine pattern after learning about it to my players and monsters alike and was so happy that SMB is exactly ...
6
votes
0answers
117 views

Design patterns for live coding/script reloading [closed]

I would like to make C++/Lua combo and write scripts for a game with live script reloading. What design patterns should I be aware of so not to cause me unnecessary pain? For example if I have a ...
1
vote
1answer
43 views

Flexible projectile system?

Projectiles need to accommodate timed, homing, linear, and arced behaviours and have single, cone, and splash effects on hit. What is a good pattern to accommodate these different behaviours that ...
3
votes
2answers
877 views

What threading strategy does a game like Transport Tycoon use? [closed]

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 ...
1
vote
0answers
196 views

Tip on turn based game AI

I'm quite new in video game AI, and I'm trying to design an AI for a turn based game. The rules are simple: The battle field is represented by an NxM board. The game is between two team, each team ...
0
votes
1answer
79 views

Where to store persistent player data?

I'm working on a 2d game, where the player can take damage and die. And upon death, player object gets destroyed. However, some attributes of player shouldn't be affected by his death, such as lives, ...
2
votes
2answers
256 views

Obstacle spawn constraints in Jetpack Joyride

Jetpack Joyride: https://www.youtube.com/watch?v=3KENMuzsras tl;dr What's the best way to add constraints to obstacle spawning (algorithms) or how to design obstacle spawning to allow constraints? ...
3
votes
1answer
73 views

How to store renderer vertex / index data in scene graph objects?

I have a SceneNode class which contains a Mesh instance. The Mesh class stores client side information such as vertex and index arrays (before they're uploaded to the GPU). I also have an abstracted ...
4
votes
4answers
176 views

Better way of handling the relation between Bullet and Enemy

I was wondering how should I design this relation in terms of "better OOP"? Should I have a Singleton EnemyManager which contains a list of enemies (EnemyList); then Bullets can access the EnemyList ...
3
votes
3answers
4k views

C# Design for Ability System

I'm a novice programmer but I have completed a pre-university in web prog so I am not a total noob. I'm using Unity, but this is just C# for now. This is my first big project and I need some ...
3
votes
1answer
314 views

Implementing The Command Pattern - Undo And Entity References

I am trying to implement a replay/undo system for a turn based strategy game I am currently working on. A sample move could go as follows: 1. A players select a pawn and gives it an attack command. 2....
0
votes
1answer
34 views

Where should I cast new bullets? [closed]

Should I Cast new bullets from my Weapon class, which would test a flag when its updated that tells if mouse left is down, which is set by Input class Cast new bullets from my Input class, which ...
16
votes
2answers
2k views

How to design context menus based on whatever the object is?

I'm looking for a solution for a "Right Click Options" behaviour. Basically any and every item in a game, when right clicked, can display a set of options based on whatever the object is. Right ...
15
votes
3answers
2k views

Separating Game Engine from game code in similar games, with versioning

I have a finished game, that I want to decline in other versions. These would be similar games, with more or less the same kind of design, but not always, basically things might change, sometimes ...
102
votes
9answers
51k views

What are some programming design patterns that are useful in game development? [closed]

I have a few books on Design Patterns, and have read some articles, but cannot intuitively figure out which programming design patterns would be useful in game development. For example, I have a book ...
1
vote
1answer
983 views

How should I structure the implementation of turn-based board game rules? [closed]

I'm trying to create a turn-based strategy game on a tilemap. I'm using design by component so far, but I can't find a nice way to fit components into the part I want to ask. I'm struggling with the ...
0
votes
1answer
145 views

How to manage a vector of “Component” base class?

I'm trying to implement a component based design for a game i'm making. I decided to write it in c++ but i'm not very good at it. Coming from a java background I encountered a problem when trying to ...
1
vote
1answer
195 views

How can I handle invulnerability in an entity system?

I currently have an entity component system with messaging. The messages are delivered to each subscriber, but each subscriber gets their own copy, basically meaning that altering a message doesn't ...
0
votes
1answer
384 views

Handling AI with ECS in a turn based roguelike

I am trying to implement the Entity Component System pattern to use in a roguelike game. Right now, I have 3 systems. Input, AI, and Action. The input system basically is just a system used by the ...
1
vote
2answers
243 views

Design Pattern for card game objects

In my game, I will have more than 100 types of cards, and before the actual game, player can select 6 of them and will be shown as 6 buttons on the scene. The card have its own ID, card name, and a 3D ...
8
votes
4answers
5k views

Per-Frame Function Calls versus Event Driven Messaging in Game Design

The traditional game design, as I know it, uses polymorphism and virtual functions to update game objects states. In other words, the same set of virtual functions are called in regular(ex: per-frame) ...
2
votes
0answers
162 views

How to develop and optimize the illusion of meaningful character development between the player and NPCs? [closed]

How to develop and optimize the illusion of meaningful character development between the player and NPCs? It's very hard for a game developer to create unlimited dialogue options for just one NPC for ...
1
vote
0answers
78 views

Security-minded design patterns / paradigm for client/server application

I am working on a client/server application and am starting to take it from proof-of-concept to actual implementation. The client is an Android application and the server is in PHP. In similar ...
0
votes
1answer
50 views

Logical Dependencie Problem [closed]

I am working with Unity and C#, but my Problem is a more general programming problem. I am trying to keep things easy, but still make them global access able and easy to modify. So I have a ...
-2
votes
1answer
166 views

Is Minecraft component-based or does it have class for every block? [closed]

I'm wondering if Minecraft has class for every type of block or blocks are just IDs in code. EDIT And what about data like transparency, resistance, hardness, tool, etc? Are they hardcoded or stored ...
8
votes
2answers
190 views

Large scale iterative design

Typically in game development, linear development (waterfall model) is riddled with obstacles that drain the programmer's sanity (game turned out horrid, can't redesign). Enter iterative design. ...
1
vote
1answer
66 views

Observer pattern for clickable 2D Elements?

So i am currently thinking about the best way to handle and implement clickable 2D menu elements in a very simple DirectX Game. I very much like the idea of having subscribers to a event where they ...
0
votes
1answer
60 views

Design Pattern for “Default Object”

I'm making a first person dungeon crawler like Eye of the Beholder. During execution, I have a Map object. It contains Cell objects. Anc each Cell contains, at most, four Wall objects. The Wall ...