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.
127 questions
0
votes
0
answers
71
views
Best way to structure code for a character dependent on its environment and vice versa
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 ...
1
vote
0
answers
80
views
Restructure OOP Architecture for two classes that are currently circular dependent
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. ...
0
votes
0
answers
89
views
Command Pattern or/and Event Handling porgramming paradigm?
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 ...
0
votes
3
answers
249
views
Is there any reason not to use classes in C++?
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 ...
1
vote
0
answers
151
views
When to use the same class for both client and server versions of an object, vs. when they should differ
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 ...
3
votes
2
answers
2k
views
In an object-oriented game engine, should there be seperate classes for objects with and without parents?
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 ...
0
votes
0
answers
92
views
How to handle collision detection with different 2D shapes while maintaining performance? Is polymorphism appropriate?
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 ...
0
votes
2
answers
207
views
Name for groups of cards in a card game [closed]
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 ...
0
votes
2
answers
114
views
Modeling a naturally circular relationship between three classes
I have three classes Location, Item, Character.
Every ...
0
votes
0
answers
120
views
Initializing prefabs with different scripts
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 ...
1
vote
1
answer
406
views
How to include cross cutting concerns like sound/graphics effects in an ECS?
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 ...
0
votes
1
answer
777
views
0
votes
1
answer
114
views
SFML: Object's shape not rendered on the window [closed]
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 ...
3
votes
1
answer
2k
views
Extra constructor call when using inheritance in Godot
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 ...
0
votes
1
answer
201
views
Pygame bullet firerate not working sometimes
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 ...