Hot answers tagged architecture
100
There are a multitude of ways to represent and implement entity component systems, but here is an explanation of one way. Keep in mind there is no concrete definition of entity/component/system architectures, so this is just one implementation.
I'm going to introduce an analogy for entity/component/system architectures that might help. Let's think of an ...
43
No it shouldn't. The only thing you'd be using from the inheritance is the x and y components. The methods used in a Vector2 class wouldn't be useful in a Vector3 class, they would likely take different arguments and perform operations on a different number of member variables.
33
Unlike other art forms, vector art requires extremely high precision, making it unsuitable for many art styles. Basic shapes and such are easy using Vector art but it's just a pain to add small details which would be really easy to paint. So its kinda restricted to very simple "symbolic" styles. For everything else painting just works better.
What vector ...
24
Vector graphics are usually more efficient than raster graphics for storage (ie. the filesize is smaller) but considerably less efficient for performance (ie. how much time it takes the computer to draw the image).
In order to display an image the computer must rasterize that image (ie. calculate the pixels in the image). Since raster graphics are by ...
19
Save the seed which you used to generate the world, and the modifications either as atomic "commands" or the results of those.
Then when loading the saved game, you do the following:
Procedurally generate the part of the world you're currently visiting.
Apply the saved commands, or overwrite the generated elements with the saved ones.
Update: And of ...
18
Put it wherever you can to make it work. Anything else is design paralysis and just going to slow down your progress.
When you start seeing patterns emerge, refactor your code.
Lots of people will give you advice about the One True Way to do something, but without a breadth of experience to draw from, you'll just be parroting ideas without a true ...
16
C++ does everything C does. You can trivially mix C and C++ in cases where the advantages of C outweigh those of C++. This is a very intentional design decision of C++.
C++ does things that C does not. This includes easy polymorphism, but also easy compile time code generation via templates. This is really handy for things like containers, which are ...
16
These names vary by region, company and developer. Most of them are made up and are often just synonyms for "thing".
Create names that describe the purpose of the code. A frame rate clock is called a frame rate clock. There's no dictionary for these things. You can't have a dictionary if the objects you're describing don't have a firm definition. The ...
15
I would begin by not thinking about an asset manager. Thinking about your architecture in loosely-defined terms (like "manager") tends to let you mentally sweep many details under the rug, and consequently it becomes more difficult to settle on a solution.
Focus on your specific needs, which appears to be to do with creating a resource loading mechanism ...
14
I certainly do - both structural and behavioral - my rule of thumb is that I make diagrams when the cost of making the diagram is less than trying to remember what the hell I was thinking a month later - or when I need to clearly explain myself to some other developer
Class diagrams when the inheritance hierarchy becomes sufficiently complex
Object ...
13
Maybe you're thinking too much in entity systems.
Entities are meant to scope objects in game, like characters, enemies, scripts, bullets, triggers, etc.
Maybe if you make your UI separated, it will be way better and easier. You don't have to make EVERYTHING inside the entities scope.
12
In fact, there are a number of 2d games that do use what amounts to vector art; Capcom's Ghost Trick:Phantom Detective, for instance, essentially generates its in-engine characters as vector graphics. (To be more precise, I believe they're given as flat-filled polygonal regions, which in this case amounts to the same thing). More broadly, polygonal models ...
12
I like to think that everything around us can be represented, one way or another, through a diagram. Even if it is just a linear diagram representing the transition between the states of a particular object throughout time (like a living being, going through a number of states from birth to death). I use diagrams to lay down my thoughts and ideas for the ...
11
Essentially what Aron_dc said, though I would go even farther. Generally you should try to keep your class-structure as shallow as possible and separate code(algorithms) from data(attributes).
You only need one weapon class for melee/instant-hit-weapons. This class can either instantly check what it hit, or is given an object to apply damage to. This ...
11
Simple answer is you don't want to recycle messages. One recycles objects that are either created (and removed) by thousands every frame, like particles, or are very heavy (tens of properties, long initialization process).
If you have a snow particle with some bitmap, velocities, physical attributes associated that just went down below your view, you may ...
11
MMORPGs, some MOBAs like League of Legends or even StarCraft 2 usually
force you to pick a server. Usually they are US, EU and SEA, in
MMORPGs many per location. I can see that that was necessary a few
years ago, but now with the advent of AWS and similar offerings that
allow you to seamlessly scale your "server-power", why are there still
...
11
Whatever you read that said Init and CleanUp is better, should have also told you why. Articles that don't justify their claims are not worth reading.
Having separate initialisation and shutdown functions can make it easier to set up and destroy systems because you can choose what order to call them in, whereas constructors get called exactly when the ...
10
How can I use multiple meshes per entity without breaking one component of a single type per entity?
Your Position component could have a "parent/children" logic, where any Entity with a Position may have a parent and their position is relative to their parent. Instead of having several meshs on the same entity, you can make more than one entity, each with its own mesh and link them together. You can even make the children entities listen to their parent ...
10
From your question, it sounds as though you have no problem designin/acquiring sound effects, and just need to understand implementation approaches.
How would you organize and use sound effects?
There's one major principle you need to understand when it comes to game audio which is obvious in hindsight, but not everyone gets on their first approach:
...
9
Not everything has a dynamic set of properties. In fact, much of software engineering is about trying to pin down a precise and static specification of something.
Static hierarchies are easier to reason about because they're broadly fixed in the code. Components can lead to an explosion of possible permutations - great if you need that flexibility, but ...
9
That is usually done using messages. You can find lots of details in other questions on this site, like here or there.
To answer your specific example, a way to go is to define a small Message class that your objects can process, e.g:
struct Message
{
Message(const Objt& sender, const std::string& msg)
: m_sender(&sender)
, ...
8
Take a look at this article about the networking architecture of Age of Empires II.
They managed to create a multiplayer game that ran great on a Pentium 90 with 16 MB RAM and a 28.8 kB/s modem connection. They did this by having each player run their own simulation, but synchronize their commands.
They have some clever tricks in there, I highly recommend ...
8
Disadvantages of the first one (subclassing):
you clutter your code with many sublclasses, that you obviously don't need
you have to keep track of your depth of inheritance (?) if you change something in your weapon classification hierarchy
I don't think there are many advantages to this approach
Disadvantages of the second one (Strategy pattern):
You ...
8
Why at a certain point in time the industry switched massively to C++ ? What are the reasons for the choice that ID made ?
Id Software is not "the industry". They are one company. While they may be influential, they aren't everyone.
I've worked on a couple of game engines that date back to 1999, and they used C++.
The principle reasons for the ...
8
There's a curious thing you can do with C++ (You didn't specify a language, and this answer is mostly because I think it's nice to see alternatives, though I don't really believe this is useful in most cases.)
Using templates you can do something like this:
template <class T, class S, int U>
class VectorN
{
protected:
int _vec[U];
...
8
It's unlikely there would be any problems with conflating the definitions and treating points as vectors — but be a little careful, because some APIs have a 'Point' class that you might need to use (for representing, e.g., vertices of polygons) and if you define your own class you'll want to be able to port them back and forth.
What I would do, ...
8
Diagrams are a great way to communicate, document and aid your design, and design is the most significant part of software development. UML has a lot of features but you are not meant to use them all at the same time, only the ones that are useful.
When navigating in a new city, do you actually stop and look at a map, rather than just continue and follow ...
7
I'm not a big fan of these on-site link posting answers, but in this case I feel there are several questions that address this.
What are some programming design patterns that are useful in game development?
Why are MVC & TDD not employed more in game architecture?
Unit Testing a C#/XNA Game Project
You may also want to browse some other questions in ...
7
In general, it will be better for you to take an approach that doesn't senseless create complex inheritance hierarchies. It does not sound, from the limited information you've provided, that barren versus gaseous versus normal (et cetera) planets different so significantly that they warrant their own unique types. It sounds like these are all properties of a ...
7
Saving a procedurally generated world is the same as saving any tile map data.
You would likely want to save the world in binary format, assuming the world is built out of different types of tiles, you will have to:
Decide on the total number of different tile types.(depending on that you will need more or less bits to represent each tile)
Define the ...
Only top voted, non community-wiki answers of a minimum length are eligible

