Questions tagged [design-patterns]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
1k views

Entity-Component-System design

I read a lot about ECS (strategy) pattern and have a few questions. Consider simple space game. We have stars there. Obviously star is an entity. What if I want to ...
Jasper's user avatar
  • 13
1 vote
1 answer
166 views

Terrain and Path Architecture

I am trying to figure out how to not break the SOLID principles with a collection of classes I am writing. Currently, I have two stacks of classes that cater for editing and rendering Terrain and ...
Zack Brown's user avatar
  • 1,459
1 vote
1 answer
196 views

Where to put graphic representation of game entity?

I am working on simple 3D version of Snake game. I created classes like snake and grid so far. My concern is, putting all render ...
AbstractProblemFactory's user avatar
1 vote
1 answer
960 views

Making specific Enemy Classes

So I was just looking through an old game I had made for android, and was second guessing how I was sub-classing enemy for each particular enemy in my game. My enemy class had all kinds of properties,...
Kevin DiTraglia's user avatar
1 vote
1 answer
285 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 ...
Tamás Szelei's user avatar
1 vote
1 answer
369 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 ...
nihohit's user avatar
  • 595
1 vote
1 answer
63 views

Designing a system for delivery

I'm writing a game where deliveries are made to specific people. These people act in different ways depending on what the delivery is. At times one character might ask the player to make a delivery to ...
Sock's user avatar
  • 11
1 vote
1 answer
494 views

Implementing ability system with ability parameters

I am trying to implement an ability system in Unity for a game similar to XCOM (turn based, team consists multiple of units, grid based). Every unit have X action points per turn. I would like to do ...
Kostej's user avatar
  • 33
1 vote
2 answers
420 views

How to script sequential events in GameMaker?

I am wondering if there is an elegant way to script sequential events in GameMaker 2. In Godot 3.1, it is very easy to chain events together using yield() and ...
DyingIsFun's user avatar
  • 1,307
1 vote
1 answer
211 views

How to control JavaFX's animations execution order when animations "queue" is being altered in run-time?

What is the proper way of handling synchronization between GUI animations' execution order and the user's dynamic input? More specifically, I would like to know how to enforce some logical ...
Julian Broudy's user avatar
1 vote
1 answer
381 views

Handle states in character in functional programming way

How to handle any change of state of a character with functional programming? If I'm using functional programming the character should be stateless, in my understanding. With that said, I should ...
renno's user avatar
  • 115
1 vote
1 answer
282 views

Can I have a scene graph translation node with multiple parent nodes?

I am trying to write a C++ scene graph structure. While designing the node classes I am facing the below issue. I have a scene graph to represent a house. I would like to have another house next to ...
Abhishek's user avatar
1 vote
2 answers
5k views

Design pattern for turn based strategy game in C++

I'm studying computer science at university. So far I've created several programs for school projects and homeworks in C++. They were usually smaller programs up to 1000 lines of code. Now I want to ...
kocourOggy's user avatar
1 vote
2 answers
341 views

Register Enemies in game development

I'm working on a game to learn the basic for game concepts. I end up with the following problem. I got a class called enemy, but now I want different types of enemies. These enemies extend from this ...
Jota_sk's user avatar
  • 51
1 vote
1 answer
296 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. ...
bazz_boyy's user avatar
1 vote
1 answer
188 views

How can I defer the initialization of my level's entities until I need them?

I intend to use a level-entity-components hierarchy in my C++ game engine where a "level" is just a container for entities. However, since I'd like to setup all the levels at once (and thus all ...
ibe's user avatar
  • 41
1 vote
1 answer
357 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 ...
user3772547's user avatar
1 vote
1 answer
296 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 ...
loremIpsum1771's user avatar
1 vote
1 answer
91 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 ...
JPtheK9's user avatar
  • 2,031
1 vote
1 answer
176 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 ...
CS Dude's user avatar
  • 123
1 vote
1 answer
100 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 ...
puelo's user avatar
  • 145
1 vote
1 answer
223 views

Handling creation of entities on level creation

I'm currently working on a 2d physics based plat former, kinda in the style of super meat boy. In super meat boy, you have multiple levels and I want a similar sort of thing but is there a general way ...
Sun's user avatar
  • 367
1 vote
1 answer
717 views

Data Locality and Polymorphism [closed]

I've been reading over the various chapters available at http://gameprogrammingpatterns.com, and in particular his chapter over Data Locality(http://gameprogrammingpatterns.com/data-locality.html) has ...
Daniel Martin's user avatar
1 vote
1 answer
605 views

Best practice child and parent script [closed]

What is the best practice coming to where to place the code in this scenario. I have a gamobject called player. It has lots of child objects. One of them is sword. Like this: Player Body Head ...
Daarwin's user avatar
  • 829
1 vote
1 answer
172 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 ...
Walker's user avatar
  • 113
1 vote
1 answer
584 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 ...
Honorable Chow's user avatar
1 vote
1 answer
283 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? ...
wkm's user avatar
  • 161
1 vote
3 answers
96 views

Unity Game Architecture

I'm working on a relatively simple game, but even simple games have a lot of moving parts, and I'm running into some architecture issues. Just to be clear, everything works fine, but it feels dirty, ...
manwithcode's user avatar
1 vote
1 answer
109 views

What is a "controller"?

I'm in the process of refactoring my camera code the goal is to try and simplify things using a struct instead of a class or at the very least try something new since I always jump straight to classes/...
Konjointed's user avatar
1 vote
0 answers
96 views

Good practices for making a manager class?

I found this post for designing a camera system the post mentions having a manager where you could register and set different cameras such as debug, player, script, etc and I kind of like this ...
Konjointed's user avatar
1 vote
0 answers
41 views

How could I build components for a composable loot system like one in RuneScape without using OOP?

I looked at some entity component systems, and noticed that they sometimes list static polymorphism as a feature, and ECSs and data oriented programming seem to be touted as holy grail of modern game ...
shinyoi's user avatar
  • 11
1 vote
0 answers
207 views

Why does ROBLOX use an object-oriented system rather than an entity component system? [closed]

I decided I would develop a game engine in c++, so I was thinking about different ways of handling objects. I also have experience with ROBLOX, so I know that it uses an object-oriented design as ...
AcinonX's user avatar
  • 311
1 vote
0 answers
160 views

Am I doing something wrong in my ECS architecture if I must choose between coupling or copying code?

I'm developing a somewhat simple, small roguelike game as my university project. Early into development I heard about Enity-Component-System and decided to go with that as my game's architecture. ...
aallfik11's user avatar
1 vote
1 answer
91 views

How do I solve a problem where sometimes recursion is untenably vast and sometimes it is not?

I am writing a programming language of my own. (I've done two Turing complete ones in the past, but this time I'm trying to actually be useful.) Now, one thing that should be especially easy with ...
user1833028's user avatar
1 vote
0 answers
572 views

What design pattern would be most suitable for RPG skills?

I'm developing a small Java digital card game project. In my game, players can perform skills when using cards. Each skill does different things, like deal damage, heal etc.. I'm looking for a way to ...
uchi23's user avatar
  • 11
1 vote
0 answers
38 views

How do I change a specific set of spawned buttons from gray to green?

I'm a self-taught programmer. I have a button class runs like this: ...
spirits's user avatar
  • 21
1 vote
0 answers
84 views

Is there an accepted architecture for these classes? [closed]

I am coding a game in python and so far so good, but I feel like my classes are not very modular. This is a simplification of what I've done: ...
Cristian Desivo's user avatar
1 vote
1 answer
221 views

How to organize passing data to shaders in cross-API render system?

I try to create rendering system that supports DirectX and OpenGL. I am trying to create class for constant buffer, but DirectX constant buffers and OpenGL uniform buffers have different memory ...
Nikolai's user avatar
  • 27
1 vote
1 answer
296 views

How to design AI Manager [closed]

I am currently building a AI system for a game. I am familiar with State design pattern and implemented different states for each agent in my game. Different states are like Running, Attack, Idle, ...
LebRon's user avatar
  • 252
1 vote
1 answer
299 views

Problem with Factory Method Pattern when I try to create a Weapon:MonoBehaviour

I'm learning about Design Patterns using Unity and I'm not sure about how to solve the following problem with the Factory Method Pattern: I want to read a XML file and using the Factory Method ...
user264560's user avatar
1 vote
0 answers
89 views

Interaction between entity and tiles

In my game, I have a player, ennemies and tiles like Mario. And each entity has a different behavior when it touches a tile. For exemple, when my player walks on spike he dies. But a certain type of ...
Liddelfranks's user avatar
1 vote
0 answers
67 views

Strategy for abstracting rendering from draw surface

This question might be a little vague because I don't know how to do this myself and I might be asking something rather silly. So here we go. Up to now, when I did my personal graphics code I used ...
meguli's user avatar
  • 185
1 vote
0 answers
137 views

Pluggable modifiers to game engine

I'm currently working on a clone of an old turn-based strategy game "Stars!" and am looking for solutions to a challenge in game engine implementation. The premise The premise of the game is that ...
Misza's user avatar
  • 121
1 vote
0 answers
674 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 ...
GGC's user avatar
  • 11
1 vote
0 answers
217 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 ...
erik's user avatar
  • 1,378
1 vote
0 answers
138 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 ...
MyNick's user avatar
  • 121
1 vote
1 answer
559 views

2D Collision : detection and design [duplicate]

So, listening to this very smart piece of advice, I've already completed a basic Tetris game. Moving on, I started a small breakout. But suddenly : a nightmare came. Collisions. Since I've been ...
Rivten's user avatar
  • 13
1 vote
0 answers
585 views

What is the right way to use a QStateMachine for a text adventure game? [closed]

I have seen a couple topics about this already but they were a bit vague for me so I decided to make this. I'm working on a little adventure game just for fun in Qt, its basically just text on the ...
pureooze's user avatar
  • 111
1 vote
0 answers
638 views

State Machine with State per Entity [closed]

I have a generic state machine implementation like this: ...
me--'s user avatar
  • 942
1 vote
0 answers
3k views

Where can I learn 2D game architecture [duplicate]

Possible Duplicate: Good resources for learning about game architecture? I know that game architecture can vary greatly, especially with the type of game being built, but I know that there are a ...
Freyday's user avatar
  • 135

1
3 4
5
6 7