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

learn more… | top users | synonyms

1
vote
0answers
19 views

What's an optimal procedure to create a connected cyclic grid of nodes and edges for A* pathfinding

like the title says, I'm trying to create a grid of nodes that hold edges or connections to each other so I can perform A* algorithm to have objects traverse across them as seen in your standard RTS. ...
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 ...
7
votes
2answers
331 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
73 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
1answer
83 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, ...
1
vote
1answer
67 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
50 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 ...
0
votes
0answers
29 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 ...
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
116 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 ...
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 ...
1
vote
1answer
86 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 ...
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
80 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 ...
1
vote
3answers
193 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<...
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 ...
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 ...
0
votes
2answers
65 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. ...
1
vote
0answers
197 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
80 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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
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
197 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
385 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
248 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 ...
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 ...
3
votes
1answer
316 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....
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 ...
1
vote
0answers
66 views

Update function - design patterns [closed]

I started reading about game development design patterns and from my experience there are 2 options for update methods. The first one receive from the game loop and delta time of this update and ...
-1
votes
1answer
438 views

Implementing FSM on multiple class UNITY3D

I am recently implementing design patterns on my project, while researching around I came across many advance techniques like HFSM ,Behaviour trees. I did implemented behavior trees wherever required ...
5
votes
2answers
405 views

How should entities in a game reference each other?

I've been reading a lot about design patterns, but in using these patterns there's one question that I keep coming back to. How should my entities access information about each other? Let's say I'm ...
1
vote
2answers
118 views

Position problems instantiating lasers at the sides of a space ship

I'm developing a demo of a 3D Space Ship game concept in Unity, just for learning purposes. I have a cube representing my space ship in the scene, and a laser prefab that is instantiated at the 2 ...
-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 ...
0
votes
1answer
373 views

Organizing a Transform class to internally use quaternions

So, I'm interested in building a Transform class similar to the one used in Unity Engine, but in C++. My intent is for it to be user-friendly to change the position, rotation, and scale of a variable ...
1
vote
2answers
1k views

Elegant ways to handle rendering with DirectX 11

I'm looking for a design pattern that's going to help me to elegantly handle the rendering of my game objects. Lots of game development guides talk about how to handle the game objects themselves, ...
21
votes
3answers
3k views

Command Ordering Architecture of Dwarf Fortress

What is the most elegant way to implement a command ordering system for AI? for example in dwarf fortress when you mark a forested area for wood cutting, the dwarfs then would do the following ...
0
votes
1answer
72 views

Application components dependancy and decoupling

In my client application I have two major components: GameCore - wrapper that handles everything about running the actual game NetworkClient - A layer that takes care of communicating(receiving/...
2
votes
1answer
128 views

Design pattern for level editor modes?

In a level editor that supports multiple editing modes, written in an oop language, how would you go about switching from mode to mode, considering that data itself remains the same? I am using a MVC ...