Skip to main content
13 votes

What's the appropiate way to achieve composition in Godot?

I have gone from a monolith player controller, to an state machine, to a behavior tree, to something closer to what you describe. My current character controller looks something like this in the scene ...
Theraot's user avatar
  • 27.2k
8 votes
Accepted

Who 'owns' the components in an ECS?

In an actual ECS, entities are just IDs, they don't own the components. Components are usually registered into a container that represents the scene/world the game is currently in. The reason is ...
starikcetin's user avatar
  • 5,295
7 votes
Accepted

Decouple game entity from its owner when logic depends on it

The crux of the issue appears to be that you are tying the identity of an object to the implementation. In it's simplest form a players ID could just be an integer (player 0,1,2,3...). Hence instead ...
DavidT's user avatar
  • 251
7 votes
Accepted

In an object-oriented game engine, should there be seperate classes for objects with and without parents?

what should the parent of the root Instance in the hierarchy be? Nothing. Does Instances without parent make sense? If you, for example, might want a factory that ...
Theraot's user avatar
  • 27.2k
6 votes
Accepted

What is the recommended way of storing large sets of organized, immutable data in Unity?

My preferred workflow here is to author the move data in a spreadsheet, then write an importer script in Unity that reads the spreadsheet and creates or updates a ...
DMGregory's user avatar
  • 135k
5 votes
Accepted

Programming Singletons vs Static classes

In Game Programming Patterns, Robert Nystrom lays out that there's a few common reasons we like to reach for singletons: Ease of global access Only takes resources if used (if no one uses the ...
DMGregory's user avatar
  • 135k
5 votes

How are character controllers built upon complex gameplay systems?

It sounds to me like you are trying to accomplish the impossible. There are limitations to how flexible and reusable you can make a system. Remember that a system with infinite flexibility will also ...
Kevin's user avatar
  • 6,234
4 votes

What is the recommended way of storing large sets of organized, immutable data in Unity?

You might be able to solve this by turning Move into a scriptable object as well. Those are much more stable in case of changes than POCOs in a serialized array of ...
Philipp's user avatar
  • 120k
4 votes

What’s the benefit of breaking code down into other classes?

A lot of design decisions come from the needs of your project, and your experience: e.g. "I've been burned before when I used approach X to accomplish Y, I had to re-write a lot of code to get Y ...
Vaillancourt's user avatar
  • 16.3k
2 votes
Accepted

How to use handles for asset management?

My favorite fast food restaurant recently refactored their ordering process. You used to go to the counter, order your food, and then stand there and wait while you wait for the food, and everyone ...
Philipp's user avatar
  • 120k
2 votes
Accepted

Sanity Check on my Idea for an Event System for game

First of all, there is no "right" or "wrong" in software development. Only "works for you" or "doesn't work for you". So any advise about your software ...
Philipp's user avatar
  • 120k
2 votes

Is there any reason not to use classes in C++?

The other answers here are great, but I wanted to add my two cents. Classes in C++ offer quite a few conveniences, other answers here mentioned ...
Tom Tsagkatos's user avatar
2 votes

What’s the benefit of breaking code down into other classes?

Software Architecture is all about creating and using abstractions to describe what we want the hardware to do. For instance, you probably don't even think about the abstraction provided by a simple ...
IMSoP's user avatar
  • 121
2 votes

Is there any reason not to use classes in C++?

Good question. First what role do classes serve? No seriously, why do we use classes? Some might say thtat it is to bundle related bits of data together... Such as a rectangle has a location, a width, ...
Questor's user avatar
  • 171
2 votes

Decouple game entity from its owner when logic depends on it

This is a job for Interfaces An interface is basically a class which has no implementation. It is a contract which a class can implement. (The link is for C# - but this pattern exists in most object-...
Tim C's user avatar
  • 509
1 vote

Singletons as presented in Game Engine Architecture by Jason Gregory

No, technically this is not a Singleton according to the Gang of Four definition. There is no static method for obtaining the singleton instance, no hidden instantiation of that instance on first ...
Philipp's user avatar
  • 120k
1 vote

Broken graphics in a compiled Android application

It was a Unity bug with getting WebCamTexture, I changed the resolution (height and width) to 640x480, and everything worked.
Stiven's user avatar
  • 11
1 vote

Is there any reason not to use classes in C++?

C++ is a huge language, and there can be reasons not to use particular feature, and lots of argument about which features should be used. For instance, if you use polymorphism, you are paying a small ...
MadMan's user avatar
  • 753
1 vote

How to go about executing lua scripts in a ECS engine?

If your game engine is based on the ECS paradigm, then it could make sense if that paradigm is represented in the scripting system as well. Which would mean that Lua is used to define and implement ...
Philipp's user avatar
  • 120k
1 vote
Accepted

How to structure this concept in ECS?

What you might be looking for is a DynamicBufferComponent. It's the go-to solution when an entity doesn't have one value but n values with variable values of ...
Philipp's user avatar
  • 120k
1 vote

In an object-oriented game engine, should there be seperate classes for objects with and without parents?

All this is ultimately up to you. OOP is a tool, not a rule. But if you're looking for suggestions and examples, here's what I did for mine: In my engine library, there's an abstract ...
Devsman's user avatar
  • 111
1 vote

Changing the type of an object in Unity

It's very difficult to answer questions about how to architect your game when you provide so few details about the game mechanics. You mentioned that your game is similar to Fallout Shelter, so I'll ...
Kevin's user avatar
  • 6,234
1 vote

What's the appropiate way to achieve composition in Godot?

Basically, the PlayerController doesn't actually exists, and its more of just a concept within the system (in Godot, the player would be just the name of the node, which holds the Movement, Jump and ...
Bunny Blake's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible