Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
49 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 ...
BadUsername's user avatar
1 vote
0 answers
74 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. ...
CyberMonkey0925's user avatar
0 votes
0 answers
73 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 ...
Benzait Sofiane's user avatar
0 votes
3 answers
208 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 ...
Konjointed's user avatar
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 ...
Bunabyte's user avatar
  • 331
0 votes
2 answers
101 views

Modeling a naturally circular relationship between three classes

I have three classes Location, Item, Character. Every ...
Michael Moreno's user avatar
1 vote
1 answer
375 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 ...
codymanix's user avatar
  • 394
0 votes
1 answer
146 views

How to deal with data that needs to be accessed by all objects?

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
88 views

OOP architecture problem between Camera, Player, Weapon

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
154 views

How can an Entity trigger changes to the world in C++?

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
86 views

Best way to implement a class or interface for a set of UI buttons that only differ in their Draw() function?

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
107 views

How do I design my classes so that my Player.cs code can use class-specific abilities from another script? [duplicate]

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
38 votes
8 answers
19k 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. ...
modernator's user avatar
  • 1,223
0 votes
1 answer
121 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), ...
user264560's user avatar
4 votes
1 answer
540 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 (...
rachica's user avatar
  • 43

15 30 50 per page