Engine-design related questions. How code is structured.

learn more… | top users | synonyms (2)

114
votes
8answers
21k views

Why are MVC & TDD not employed more in game architecture?

I will preface this by saying I haven't looked a huge amount of game source, nor built much in the way of games. But coming from trying to employ 'enterprise' coding practices in web apps, looking at ...
96
votes
1answer
15k views

Role of systems in entity systems architecture

I've been reading a lot about entity components and systems and have thought that the idea of an entity just being an ID is quite interesting. However I don't know how this completely works with the ...
89
votes
9answers
10k views

Entity communication: Message queue vs Publish/Subscribe vs Signal/Slots

How do game engine entities communicate? Two use cases: How would entity_A send a take-damage message to entity_B? How would entity_A query entity_B's HP? Here's what I've encountered so far: ...
88
votes
11answers
15k views

Good resources for learning about game architecture? [closed]

Are there any good resources for learning about game architectures? I am looking for high level overviews of different architectures. I tend to find information about the various pieces of a game such ...
81
votes
3answers
26k views

Tips for writing the main game loop? [closed]

Can anyone recommend some good tips, articles, sites, etc. for writing the main game loop? What are some things that you should do in the game loop, and what are some things that you shouldn't do in ...
59
votes
11answers
7k views

How to design a replay system

So how would I design a replay system? You may know it from certain games like Warcraft 3 or Starcraft where you can watch the game again after it has been played already. You end up with a ...
52
votes
7answers
17k views

Why don't more games use vector art?

It would seem to me that vector art is more efficient in terms of resources/scalability; however, in most cases I have seen artists using bitmap/rasterized art. Is this a limitation put on the artists ...
43
votes
8answers
10k views

Event-driven Communication in a Game Engine: Yes or No?

I am reading Game Coding Complete and the author recommends Event Driven communication among game objects and modules. Basically, all living game actors should communicate with the key modules ...
41
votes
7answers
4k views

How can I set up a flexible framework for handling achievements?

Specifically, what is the best way to implement an achievement system flexible enough to handle going beyond simple statistics-driven achievements such as "kill x enemies." I'm looking for something ...
41
votes
10answers
10k views

Game State 'Stack'?

I was thinking about how to implement game states into my game. The main things I want for it are: Semi-transparent top states-being able to see through a pause menu to the game behind Something ...
35
votes
5answers
3k views

How to avoid the GameManager god object?

I just read an answer to a question about structuring game code. It made me wonder about the ubiquitous GameManager class, and how it often becomes an issue in a production environment. Let me ...
32
votes
7answers
13k views

Where can I find good (well organized) examples of game code?

Where can I find good (well organized) examples of game code? I'm hoping that I can pick up some organizational tips. Most examples in books are too short and leave out lots of detail for the sake of ...
31
votes
9answers
2k views

Starting from Scratch - Is it a Mistake if I re-invent the wheel?

Usually whenever I want to start a game, I will think to have a good basic architecture for rendering and better game loop from scratch. I usually don't want to use existing engines. The reason behind ...
30
votes
7answers
2k views

Elegant way to simulate large amounts of entities within a game world

Assume you have a game in which there are many (many many) entities serving some functions, not all of which are constantly needed or need to be considered in every frame. The concrete problem I am ...
28
votes
3answers
3k views

Several classes need to access the same data, where should the data be declared?

I have a basic 2D tower defense game in C++. Each map is a separate class which inherits from GameState. The map delegates the logic and drawing code to each object in the game and sets data such as ...
28
votes
10answers
4k views

Alternative to Game State System?

As far as I can tell, most games have some sort of "game state system" which switches between the different game states; these might be things like "Intro", "MainMenu", "CharacterSelect", "Loading", ...
25
votes
4answers
2k views

If two objects interact, what holds the interaction code?

Think of a bullet and an enemy, or the player and the floor. If these objects interact, what holds the interaction code?
25
votes
3answers
1k views

What can cause ALT-TAB to be 'annoying'/slow/glitchy?

This is more of an open ended question, but I hope to get some good insight on how to avoid the issue. When playing Games on Windows, I might want to ALT-TAB out of it. Some games have no problems, ...
25
votes
5answers
2k views

Doing powerups in a component-based system

I'm just starting really getting my head around component based design. I don't know what the "right" way to do this is. Here's the scenario. The player can equip a shield. The the shield is drawn ...
23
votes
3answers
1k views

How to handle multiple story threads in a RPG game?

I designed an RPG game that has multiple story threads, meaning that, depending on the user's choice some things may or may not happen, you can achieve the same thing in several ways, the ending can ...
22
votes
4answers
2k views

Appropriate level of granularity for component-based architecture

I'm working on a game with a component-based architecture. An Entity owns a set of Component instances, each of which has a set of Slot instances with which to store, send, and receive values. Factory ...
22
votes
4answers
1k views

Architecture a for a central renderer rather than self-rendering [duplicate]

For the architectural side of rendering, there's two main ways: having each object render itself, and having a single renderer which renders everything. I'm currently aiming for the second idea, for ...
21
votes
4answers
9k views

How to design a game engine in an object-oriented language? [closed]

Whenever I try and write a game in any object-oriented language, the first problem I always face (after thinking about what kind of game to write) is how to design the engine. Even if I'm using ...
21
votes
6answers
5k views

What designs are there for a component based entity system that are user friendly but still flexible?

I've been interested in the component based entity system for a while, and read countless articles on it (The Insomiac games, the pretty standard Evolve Your Hierarchy, the T-Machine, Chronoclast ... ...
20
votes
4answers
2k views

How to design a game's software such that it is easy to unit test?

Is it practical to use a testing framework like JUnit in a game development situation? What sort of design considerations can you follow in order to make your game more testable? What parts of a game ...
20
votes
6answers
3k views

Is Test Driven Development viable in game development?

As being Scrum certified, I tend to prone for Agile methodologies while developping a system, and even use some canvas from the Scrum framework to manage my day-to-day work. Besides, I am wondering ...
20
votes
4answers
848 views

How to implement a never-rebooting test world?

Am looking for ideas on how to do the following: I want to write a simple "world" in Java. One which I could start and then add new objects later at a later date to simulate/observe different ...
19
votes
4answers
3k views

“The Game Object” - and component-based design

I've been working on some hobby projects the last 3-4 years. Just simple 2d and 3d games. But lately I have started a bigger project. Soo in the last couple of months I've been trying to design a game ...
19
votes
2answers
2k views

Component-Based System online resources

I've been considering moving to a more component-based approach in my games. Does anyone else have any decent reference material or sample implementations that would help make this transition a little ...
19
votes
2answers
1k views

If “ResourceManager” classes are considered bad, what are the alternatives?

I'm hearing conflicting opinions such as: "Dedicated Manager classes are almost never the right engineering tool" "Dedicated Manager classes are (currently) the best way to survive a large project ...
18
votes
4answers
3k views

How to design an AssetManager?

What is the best approach to designing an AssestManager that will hold references to graphics, sounds, etc. of a game? Should these assets be stored in a key/value Map pair? I.e. I ask for ...
18
votes
3answers
752 views

Do I, and how, separate the concerns of input and game objects?

In probably every game a developer has to somehow deal with input, may it be simple keyboard and mouse events, touch events or something as accelerometer input. This input directly of indirectly ...
18
votes
4answers
2k views

Game architecture / design question - building an efficient engine while avoiding global instances (C++ game)

I had a question about game architecture: What is the best way to have different components communicate with each other? I do really apologize if this question has already been asked a million times, ...
18
votes
4answers
3k views

How to implement behavior in a component-based game architecture?

I am starting to implement player and enemy AI in a game, but I am confused about how to best implement this in a component-based game architecture. Say I have a following player character that can ...
17
votes
5answers
3k views

noSQL - Is it a valid option for web based game? [closed]

Out of an opportunity and boredom, a friend and I decided to make a web based game. This is the first 'game' I will be making, since usually I program web apps in django. I've opted to use the same ...
17
votes
5answers
809 views

Getting It Done vs Solid Software Design?

With barely enough time at our hands to complete the games we craft, how can you strike a good balance between solid software architecture and making good progress to get it all done? My personal ...
17
votes
2answers
3k views

How are physics or graphics components typically built in a component-oriented system?

I have spent the last 48 hours reading up on Object Component systems, and feel I am ready enough to start implementing it. I got the base Object and Component classes created, but now that I need to ...
17
votes
4answers
5k views

Resource Managers - Are they any good?

I've seen many a time in source code, things like this [well, this is more of a pseudo C++ idea of mine] typedef shared_ptr<Resource> ResourcePtr;// for ease ResourcePtr sound1 = ...
17
votes
4answers
2k views

What is involved for a simple UDP game?

I once tried to write a simple game with UDP in a week as a throwaway test. It went horribly. I threw it away early. The main problem i had was restoring the game state of all players/enemies/objects ...
17
votes
3answers
976 views

How to create a Ghost Replay feature in a game?

When you set a personal best lap time in a console racing game, you have the option to compete against your ghost. How can this feature be created for a single player casual type game?
16
votes
6answers
1k views

Should Vector3 inherit from Vector2?

I'm creating a couple of classes Vector2 (X & Y) and Vector3 (X, Y & Z), but I don't know whether to make Vector3 inherit from Vector2, or whether to re-implement the member variables m_x and ...
16
votes
6answers
3k views

Do you actually use diagrams to model games? [closed]

I mean mostly UML but any method that works is viable. So - do you actually model your games with UML/other diagrams or different methods? I had a subject at my university about modelling with UML and ...
16
votes
6answers
9k views

How do I build a 2D physics engine? [closed]

The most advanced games I've made are a 8-ball pool game made with the physics engine Box2dFlashAS3 and a platform game with levels. When I did platform games, I've always wished to know how to make ...
16
votes
5answers
873 views

Dictionary of common names for code objects [closed]

I'm looking for a common dictionary of terms (much like design patterns have a common language for how things interact) that are specific to games. For instance, if I'm making a game of pong with a ...
16
votes
5answers
616 views

How can I design lots of different attack types that can be combined?

I'm making a top down 2D game and I want to have a lot of different attack types. I'd like to make the attacks very flexible and combine-able the way The Binding of Isaac works. Here's a list of all ...
16
votes
1answer
1k views

How should I structure an extensible asset loading system?

For a hobby game engine in Java, I want to code a simple but flexible asset/resource manager. Assets are sounds, images, animation, models, textures, et cetera. After a few hours of browsing and some ...
16
votes
4answers
1k views

Game engine: a decent way, architecture-wise, to implement scripting support?

I am developing a simple game engine (in C#, if it matters), and I can't think of a decent enough way to implement scripting in terms of architecture. It's a simple turn-based strategy with custom, ...
15
votes
4answers
1k views

How does one save a procedural world?

I have recently read about how to create procedural worlds... but how do I save one? In games like Terraria or Minecraft users can freely modify the landscape, but that world can't be recreated from ...
15
votes
3answers
2k views

Dynamic Memory Allocation and Memory Management

In an average game, there are hundreds or maybe thousands of objects in the scene. Is it completely correct to allocate memory for all objects, including gun shots (bullets), dynamically via default ...
15
votes
3answers
3k views

Game engine and data driven design

I've heard about data driven design and have been researching about it for a while. So, I've read several articles to get the concepts. One of the article is Data Driven Design written by Kyle ...