Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Object-oriented programming. A paradigm using objects (instances of a class consisting of properties and methods) to design games. Techniques may include data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.

0
votes
1answer
55 views

Read access violation, pointer was nullprt

Im trying to figure out how to use pointers to make a single instance of an object that in this example will just change direction on x-axis. Splav.h (eng. Paddle.h) ...
0
votes
0answers
15 views

CYOA “Data Architecture” / OOP Question - Dynamically Evaluating Conditions?

I'm a programming novice trying to build a Choose Your Own Adventure game. In a CYOA game, players navigate through pages. Each page contains a description and two/three buttons which branch to other ...
1
vote
2answers
174 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 ...
1
vote
0answers
53 views

Making games on Structure programming language c or c++ [closed]

I am learning structured programming language C. I know about data type, control statements, loops, arrays, strings, functions, pointers, structures and STL. My question is, if I want to make game ...
35
votes
8answers
13k views

Should I avoid using object inheritance as possible to develop a game?

I prefer OOP features when developing games with Unity. I usually create a base class (mostly abstracted) and use object inheritance to share the same functionality to the various other objects. ...
0
votes
1answer
66 views

Unity Custom EventManager, multiple arguments, and order

I have some hard question for me... I have a nice EventManager, who handle multiple arguments. (no argument, one int, one bool, a GameObject and a bool... but for each sort, I have to create a special ...
1
vote
2answers
232 views

How to create custom methods for sprite groups in pygame?

I want to use sprite groups in my game using pygame and the default draw isn't enough. I have tried some tutorials but I failed. So, being more specific: I want to create custom methods for sprite ...
1
vote
1answer
194 views

why does a type alias to engine specific header violate encapsulation?

In a class called Sprite.h my teacher asked this question which I don't fully understand. A generic interface has to include an engine specific header in order to expose different sprites. This ...
0
votes
1answer
149 views

LIBGDX - group as child of an actor?

I've looked in forums, the doc, and the code, and I'm thinking this isn't currently possible, but maybe I'm missing something, so just to be sure: is there a way to set a group as child of and actor? ...
1
vote
1answer
213 views

Detecting Overlapping Shapes

I have two classes Circle and Square which derive from an abstract base class Shape. A <...
0
votes
1answer
90 views

Should I separate the Pathfinding info from the Tile Info class? [closed]

I have implemented A* on a Tile Based Game, my Tile class contains a lot of info like Position, TileType, Items, Characters, etc on it. Right now that class has the Edges references(neighbours), ...
1
vote
0answers
29 views

Javascript: world tile generator bug? collision not working, player falls down? [closed]

Hi I have a serious problem here, When I generate my tile map from an array with numbers [0,4, ...] (0 > for air, 4 for solid) inside of generateWorld()... the ...
0
votes
1answer
285 views

How to link my weapons with their corresponding ammo supply in the Unity Inspector?

In my game I would like to implement a universal ammo and weapon system that would be usable for any kind of weapon. So I declared an ammo class: ...
5
votes
1answer
127 views

When should I acquire game objects with dependency injection, find-with-tag, or singletons?

This is sort of a best practice/efficiency kind of question, and I haven't really seen any other question talking about these three things together. Essentially, Dependency Injection, Find with Tag (...
0
votes
2answers
96 views

Java - Declaring a random Vector affects a Vector in another class?

I'm working on a 2D game and I've come across something strange which I've been working to fix the whole day but can't. I'm trying to make an arrow fly, but modifying it's class affects my ...
0
votes
1answer
179 views

Three levels deep composition (player<-character<-spell), with preset character+skill sets

So I'm creating a rather generic strategy game similar to Warcraft or League of Legends, which needs to have: a Player class for representing the users playing the ...
0
votes
1answer
21 views

How to design a class for an object that its state varies over time

I have a soccer team with 14 players (11 active + 3 substitutes). The team is going on a tour participating in different matches across the world. I have two very different design ideas of how for the ...
1
vote
2answers
733 views

Component oriented programming for rich RPG world

I've asked this question on several forums but didn't get the proper answer yet. So, in my opinion, it is a really theoritical and deep, but I really can't deal with it by myself. What is my goal? ...
0
votes
2answers
69 views

How do I pass my objects to the update method?

I've had formal education in Java for around half a year now, and as a hobby I would like to attempt game development. I've downloaded the Slick2d library to help with this. I've run into a problem ...
5
votes
1answer
339 views

OOP design principles that fit with Unity

So my current concept is top-down arcade style game. Meaning you have a character and you walk around a closed space killing waves of enemies coming at you. My question is how to structure my ...
2
votes
1answer
284 views

AS3 move object to a point

I'm trying to make a room full of monster each side and the player stay in the middle. I have a problem, I don't know how I move each monster to the player and rotate each of them to face the player, ...
4
votes
2answers
329 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
6k views

UPDATED: Deserialise Nested JSON with JSON Utility Unity 5.4 [duplicate]

I am trying to deserialise a JSON with Unity 5.4's JSON utility (here). This is what my JSON looks like: {"series":[{,"points":[{"ts":"1473850836254","value":"11.27"},{"ts":"1473851256637","value":"...
2
votes
1answer
65 views

Behaviours: Should I always return a reference to the behaviour on its methods? [closed]

I'm writing a small game to sharpen my programming skills, and I've chosen to use behaviors (that basically is a class that modifies its parent, to do things like movement, damage and stuff) to avoid ...
1
vote
1answer
457 views

How to minimize the repetitive creation of component in libgdx ashley?

The below example is creation of character Entity. My problem is do I always need to call these engine.createComponent(...class) ...
1
vote
1answer
62 views

Deriving from base class but not calling base method

I am very new to C#, XNA, and OOP. This is my question: I have an abstract class called Sprite. Sprite handles position and drawing from the sprite sheets, from its update and draw methods, for my ...
0
votes
1answer
138 views

libgdx - Should I use OOP in ECS framework? [closed]

For example I have OOP class of Bullet and I have created the pool and factory. Should I convert it to componet based? Like BulletComponent, then handle by BulletSystem? by the way I'm using Ashley ...
1
vote
1answer
274 views

Designing PHP RPG game: Should I use multiple classes for each type of item or a single table?

I'm making a text-based role playing game written in PHP. I have a hard time figuring out how to handle items in game - there will be a few types of objects (weapon, machine, tool, building etc) each ...
1
vote
0answers
815 views

Making unity inspector accept classes that inherit from a base class

I have a base class that has a lot of classes inheriting from it, I want to make a script that you can drop one of these derived classes into. How do i do that? ...
1
vote
2answers
412 views

Organizing Setup(), Update() and Draw() function in a game engine

I'm creating my first game engine and I want help with organizing the Setup(), Update() and Draw() functions in the correct way. Here is how my main() function looks like ...
2
votes
2answers
210 views

Cost of Using Virtual Methods to Query Properties?

Let's say you're making a tile-based roll-playing game, and you're obsessed with OOP. You have an abstract base class Tile which will be inherited from by many ...
16
votes
6answers
5k views

How do I correctly use singletons in C++ engine programming?

I know singletons are bad, my old game engine used a singleton 'Game' object that handles everything from holding all data to the actual game loop. Now I'm making a new one. The problem is, to draw ...
5
votes
5answers
324 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
1answer
145 views

What techniques are useful for modelling Character Actions via OOP? [duplicate]

I'm trying to rewrite a legacy php Browser-Based-Game so that it uses object oriented programming. I find it relatively easy to model concrete nouns, like: new Npc(), new Character(), new Account(), ...
0
votes
1answer
35 views

sfml/opengl, two objects of same class are sharing variables

whenever I use the none-default constructor, it only adds to the coordinates of the previous class(in an array) ...
0
votes
0answers
112 views

Using an object as a model to avoid too many parameters - XNA/C#

I have 3 classes(Skill,Projectile and Status),Skill has Projectile and Projectile has Status, all of them need to read information from a txt and to avoid open it everytime I want to create an object ...
1
vote
2answers
825 views

Good design for skills (heal,dmg etc)

I'm trying to create a good designed "skill system" for my game, but curious if anybody knows a good design? Skills can Heal,Damage ofc, they can be single target,multiple(chain), AOE. Instant dmg/...
2
votes
1answer
227 views

Good approach in designing game classes [closed]

I took a semester-long course in java but I'm still a beginner in Object-Oriented programming paradigm. Suppose that I want to create a simple game where the player can go to different locations. Each ...
6
votes
2answers
1k 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 ...
0
votes
1answer
132 views

Is it better to make a cpp and hpp file for every new object or is it better to make one parent class and define types in there? [closed]

Let's say we make a game. The game has items, enemies, allies, etc and there are multiple of them, like zombies and robots as enemies. Do you think it would be better to make one parent class called "...
0
votes
1answer
170 views

Passing of board data in board games

Every time I make board game, I am faced with a decision. I have classes for the board and/or game logic, and another for the UI. I don't know how I should pass the board data to the UI. I could make ...
1
vote
4answers
1k views

Class design and data structures for a Tower Defense

I was trying to come up with a structure for a simple TD game that has following elements Tower Each Tower has a set of properties like range, damage, health etc There could be different types of ...
3
votes
1answer
830 views

How should my game characters store their abilities/spells?

I'm new to game development and a bit confused about how to effectively store an object's access to certain spells/abilities. The player and mob objects are all generated from the same class. However,...
3
votes
1answer
201 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 ...
1
vote
1answer
366 views

OOP design, keeping track of entities

First, I would like to say that I have no experience with this and am still getting my head around OOP, so if something is really obvious, just point it out :) I am designing a game and I am not sure ...
4
votes
1answer
2k views

Architecture to draw many different objects in OpenGL

I have some objects that I want to draw. I am not sure how I can create my architecture in a way where I can draw everything as fast as possible. As example: ...
1
vote
2answers
211 views

Command Interface design for RTS

Commands may have different target type; like NONE, COORD, UNIT. Some example commands may be: Attack (target UNIT), Move (target COORD), AttackMove (target COORD), Stop (target NONE), UseAbility (...
3
votes
1answer
102 views

Informing objects within a particular state of the world state

Following the State pattern, every state in my game is a derived object that reflects a particular segment of the game (MenuState, PlayingState, GameOverState, etc.) Each of those state objects holds ...
1
vote
2answers
270 views

OOP Question for Team System

I'm not quite sure right how I should create my "Team System". Lets say I have 2 teams with 4 players in there. The teams are Team Blue and Team Red. A team knows the amount of its members, the amount ...
1
vote
1answer
310 views

Game development for high-school with C++ and OpenGL [closed]

I've been teaching high-school students (12th grade) game programming in the last 2 years. The way I did this till now, was first to give them "half made" classes (for Point, Polygon, etc.) and they'...