Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >

Questions tagged [oop]

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
71 views

What is the neatest way in a strict OOP language (c++ say) to avoid the following circular dependency. Imagine I create a character class and a world class. A character requests data from the world to ...
BadUsername's user avatar
1 vote
0 answers
80 views

I'm working on a simple 2D game using C++ and SFML. In this game, I have a class WorkbenchBlock which inherits from class Block. ...
CyberMonkey0925's user avatar
0 votes
0 answers
89 views

I have created a dynamic library that contains all the tools I want my game executable to have. Additionally, I want to create a world editor/tools for my engine to be more user-friendly. I'm ...
Benzait Sofiane's user avatar
0 votes
3 answers
247 views

I'm a bit conflicted when it comes to the use of classes currently, I use them all the time, but I realized through the KISS and YAGNI principles I can simplify things by not using them, but is there ...
Konjointed's user avatar
1 vote
0 answers
143 views

I am learning about networking for game development and need some insight. My knowledge of Unreal Engine is that it uses RPCs and replicated variables for actors. I also know that Unity has Networked ...
Gus Funder's user avatar
3 votes
2 answers
2k views

I am developing a game engine in C++ (for an idea of what kind of design I'm going for, think of ROBLOX, if you're familiar with that) and I need help with a problem I have. So basically, the objects ...
Bunabyte's user avatar
  • 331
0 votes
0 answers
89 views

If I'm making a small library for handling 2D shapes, should polymorphism generally be avoided? I know that it can worsen performance but it's not like polymorphism is never used in game development ...
JensB's user avatar
  • 157
0 votes
2 answers
207 views

What would you call the groups of cards in a card game, including both piles (draw, discard...) and hands? I'm coding a generic card game engine and I've been unable to find a good name for the base ...
Jérémy Quentin's user avatar
0 votes
2 answers
114 views

I have three classes Location, Item, Character. Every ...
Michael Moreno's user avatar
0 votes
0 answers
120 views

I am creating a tower defense game. Currently I have 2 different tower types 'Shooting tower', amd 'Unit tower'. I have a Scriptable object to initialize the tower. It contains some tower properties ...
Taras Fityo's user avatar
1 vote
1 answer
406 views

It does not seem like a good idea to include this functionality in the game logic like that even if the concrete implementation of the sound or graphics effect is abstracted away. Ideally, the game ...
codymanix's user avatar
  • 394
0 votes
1 answer
773 views

This is my base class ...
Sean Carey's user avatar
0 votes
1 answer
113 views

I want to be able to render sf::CircleShape (representing pointwise charges) when pressing mouse buttons on the window. The problem is easy enough, however the ...
user avatar
3 votes
1 answer
2k views

I'm trying to design a character system for my game. Considering I'll need a player and non-player characters - and non-player characters will further come in many more forms, making use of ...
Marty Cagas's user avatar
0 votes
1 answer
200 views

i have made this bullet class but i have a problem with the firerate. Sometimes i'm not able to shoot even when the little delay (700ms) between the two shots has ended. I guess it's due to the ...
Salem's user avatar
  • 226
0 votes
1 answer
160 views

I have a World class that currently only has one instance. It has data and methods that need to be accessed by all other game objects. Right now I'm hardcoding a ...
EnderShadow8's user avatar
0 votes
1 answer
87 views

I'm making this 2d collecting game in Unity where you collect fish. However I can't get them to face the direction they are going. I've asked on some Discords and got no answer. Thanks in advance. ...
Ratman's user avatar
  • 1
0 votes
0 answers
43 views

I moved from C to C# so I am a novice in Object Oriented Programming. I wanted to implement OOP in my character movement, but it didn't work the way I expected. My character is instantiated when the ...
Gorlomi's user avatar
0 votes
2 answers
693 views

If I have a class called Enemy: // Simplified version class Enemy { float xPosition_; float yPosition_; int hp_; }; Should this class also contain the ...
JensB's user avatar
  • 157
0 votes
1 answer
480 views

I have a ScriptableObject that's already used extensively in my project: ...
Commodore Yournero's user avatar
0 votes
0 answers
92 views

I'm trying to make different behaviours for workers of different buildings, let's say an agricultural worker would need to sow wheat seed and collect the wheat grain when it's grown. let's call that <...
MilitaryG's user avatar
0 votes
1 answer
94 views

I am making an FPS game in Unity, trying to keep myself to OOP principles as much as I can but I found dead-end. I want to add recoil to my game, now logically thinking the amount of recoil should be ...
66Gramms's user avatar
  • 135
2 votes
0 answers
171 views

I'm writing a simple physics based game in C++ using SFML. I want to trigger a scene change when my playerCharacter collides with a door. Since C++ does not have any native Event Sender/Listener ...
john_shreds's user avatar
0 votes
1 answer
124 views

First of all, I want mods in my game, as stated in a previous question, I want to do that via registries. Users make content known to the game in the form of 'Registering' it, then it can be used in ...
Faih Faih's user avatar
0 votes
1 answer
105 views

I have three types of UI buttons that go on a cooldown bar: A traditional cooldown bar button where once the corresponding key is pressed, a timer shows over the button and dims the texture. A button ...
Thisisstackoverflow's user avatar
0 votes
2 answers
113 views

Right now, I have a Player.cs class that handles button pushes, movement speed, damage, Update() etc. At the moment, all of the logic for button presses triggering an ability, and the logic ...
Thisisstackoverflow's user avatar
0 votes
0 answers
53 views

I've been stuck doing this in a very inefficient way and really want to know if there's some design pattern that solves this because it seems like a pretty common problem to have. I have a system ...
Taceo's user avatar
  • 1
0 votes
1 answer
131 views

I dont know why but my jump method does not work. My character can only jump on one single object. The other obstacle haven't any influence on the player. I really don't see my mistake ...
MoonyTown's user avatar
1 vote
0 answers
649 views

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
0 votes
0 answers
45 views

I'm making an RGP board game where I have different heros, each one of them belongs to some types for example ("Aatrox" is a Dragon and a Ninja hence he belong to these two types),and each player has ...
Joe's user avatar
  • 1
0 votes
1 answer
2k views

I am making a game with SDL and C++. I am trying to render simple image to the screen but I can't. I am not getting any error but I see only black screen. I think because the renderer in ...
younlok's user avatar
  • 19
3 votes
1 answer
249 views

I'm working on an RPG game for my coursework project. Everything is going fine but I've reached a stage where I do think that my project's code is not the most efficient. Here I have a constructor of ...
thesameritan's user avatar
2 votes
2 answers
4k views

I’m writing a render, there is a class that shaders should store, something like a shader manager. These shaders are stored as ...
Денис Ковешников's user avatar
0 votes
0 answers
55 views

I have a bit of a problem with transferring my Game/Health Manager across scenes. My current Health Manager is set up so when the player gets hit, they flash, which is controlled by activating and de-...
DustyShinigami's user avatar
0 votes
2 answers
106 views

I am coding an interaction system in Unity that does things based on whether the player taps interaction, or holds interaction. Each object holds their own scripts of how a player can interact with ...
Visulth's user avatar
  • 107
1 vote
2 answers
167 views

I've been trying to make games for a while now, but even when making a very simple one, I've always run into a problem - Because different subclasses have different functionality, therefore needing ...
Sarah's user avatar
  • 59
2 votes
1 answer
164 views

So I've been making a 2D grid and pathfinder using SFML. Now I ran into a problem. I've been making a vector for the path nodes. ...
Yamarai Akizuki's user avatar
0 votes
1 answer
115 views

I've been over this for a long time, I can't seem to understand what is wrong, is the use of the this keyword right? I want to add the instance of the class that is being created to the vector '...
noobProgrammer's user avatar
0 votes
1 answer
2k views

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) ...
Marko Petričević's user avatar
1 vote
2 answers
6k views

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
38 votes
8 answers
19k views

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. ...
modernator's user avatar
  • 1,223
8 votes
1 answer
4k views

Is it possible to use Hybrid ECS with some components and the standard MonoBehaviour with all your old code? I want to know because I already have some game ...
Marc Rasmussen's user avatar
0 votes
1 answer
2k views

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 ...
Ugo Hed's user avatar
  • 281
3 votes
2 answers
3k views

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 ...
CFLS's user avatar
  • 165
1 vote
1 answer
431 views

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 ...
Steffen Jorgensen's user avatar
1 vote
1 answer
621 views

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? ...
ontheway's user avatar
1 vote
1 answer
1k views

I have two classes Circle and Square which derive from an abstract base class Shape. A <...
Edward's user avatar
  • 63
0 votes
1 answer
127 views

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), ...
user264560's user avatar
1 vote
0 answers
50 views

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 ...
vincent thorpe's user avatar
1 vote
1 answer
3k views

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: ...
xuwenbuwer's user avatar