Design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
0
votes
1answer
45 views
Problem understanding finite state machine
I want to use the finite state machine for the ennemies AI in my game.
I implemented the pattern and it work fine for my first enemy (enemy A):
Enemy is in IdleState by default
When enemy see the ...
0
votes
0answers
65 views
Finite State Machine Input Handling
I'm working on a 2d Super Smash Bros like fighter in SFML/C++. As a game that handles a lot of inputs and states in a very detailed manner, I'm following the state pattern. So I have an abstract ...
1
vote
0answers
30 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 ...
0
votes
0answers
40 views
Unity 5: How to handle stacks of “windows”
I'm having a hard time coming up with a clean and simple way of implementing a window manager of sorts. I have placed some limitations below:
Windows can never move and its positions are fixed at ...
3
votes
1answer
82 views
how to make weapon charge up behavior using composition
I am trying to design different weapon behaviors.
Right now, there are 3 different types of weapon behaviors that i would like to implement.
When not pressing anything, weapon fires at a ...
4
votes
2answers
141 views
Ideas/suggestions to implement an item combination system
I'm designing a game where there is a relatively small set of items. A single player holds an inventory of item slots. Each item slot contains a single item. The inventory allows you to use the item ...
0
votes
1answer
36 views
store definition of “blueprint” of object (e.g. mesh)? … in top header = bad compile time
In my game engine, here is my mesh factory :-
//GraphicFactory.h
class GraphicFactory{
enum blueprint{
TURRET_01,CUBE,GRASS //a lot of things
}
void initialize();
...
0
votes
1answer
65 views
Pointer deleted by object manager on next frame
I have a class named GameManager, which job is to manage GameObject allocation and deallocations. The thing is, every GameObject can interact with each other, so there's a possibility that a pointer ...
0
votes
0answers
15 views
Design - Physics body and Scene node
I'm designing my own 2d game engine. I've wrote the PhysicsBody class and currently it works for collisions only.
For scene partitioning I use QuadTree and is used for decrease the number of ...
5
votes
2answers
159 views
How to design a multi-step game menu system?
I am getting started with game programming. I am designing a game that starts by taking you through a series of menu screens. I am interested in learning how this is typically structured in ...
1
vote
1answer
84 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
98 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 ...
11
votes
2answers
428 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
81 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.
...
1
vote
2answers
159 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
82 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
81 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
38 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
30 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
157 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
35 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
93 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
74 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
110 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
48 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
278 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<...
7
votes
8answers
7k 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
124 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
47 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
83 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
251 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
109 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
78 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
135 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
181 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
87 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
157 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
213 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 ...
1
vote
1answer
486 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
305 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
192 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
89 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
51 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 ...
4
votes
1answer
349 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
198 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
68 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
66 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 ...