Engine-design related questions. How code is structured.
53
votes
1answer
6k 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 ...
37
votes
10answers
6k 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 ...
64
votes
3answers
14k views
Tips for writing the main game loop?
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 ...
87
votes
8answers
13k 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 ...
55
votes
11answers
4k 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 ...
20
votes
2answers
1k 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 ...
78
votes
11answers
9k views
Good resources for learning about game architecture?
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 ...
75
votes
9answers
6k 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:
...
38
votes
7answers
2k 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."
19
votes
6answers
3k 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 ... ...
14
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 ...
15
votes
6answers
7k 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 ...
8
votes
2answers
3k views
Interaction between engine parts
I want to ask a question about how the information exchange between game engine parts should be implemented.
The engine is separated in four parts: logic, data, UI, graphics.
In the beginning I made ...
1
vote
3answers
1k views
Game state sharing data
A game is a set of Game States.
Each Game State contains game objects, may be list, may be scene graph or any other data structure.
We can use Game States as Game Locations, too.
How do you share ...
5
votes
6answers
2k views
Making classes available to others
I'm currently working on a 2D game engine in XNA, and I am very interested in architecture, and how best to let my game objects communicate.
I know a lot of people use a Singleton design but I ...
9
votes
4answers
870 views
Calculating the output of two armies fighting
I am programming a strategic game using Flash. The game works very similar to the famous game "Travian".
My problem is as follows: I am trying to make the calculation of the troops lost as a result ...
35
votes
8answers
5k views
Event Driven Communication in Game Engine - Yes or No?
As I am reading book Game Coding Complete (http://www.amazon.com/Game-Coding-Complete-Third-McShaffry/dp/1584506806/ref=sr_1_1?ie=UTF8&qid=1295978774&sr=8-1), the author recommend Event Driven ...
13
votes
6answers
3k views
Game Components, Game Managers and Object Properties
I'm trying to get my head around component based entity design.
My first step was to create various components that could be added to an object. For every component type i had a manager, which would ...
21
votes
5answers
1k 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 ...
18
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 ...
10
votes
5answers
2k views
Keyboard input system handling
Note: I have to poll, rather than do callbacks because of API limitations (SFML). I also apologize for the lack of a 'decent' title.
I think I have two questions here; how to register the input I'm ...
11
votes
2answers
2k views
Inheritance vs Composition
I make my money in C# Generally in that language I like to decouple everything to the high heavens using interfaces. This has served me well in enterprise code but in writing games in C# I find myself ...
6
votes
3answers
3k views
Synchronizing clients with a server and with each other
What is the best way for keeping all clients synchronized with a server and with each other?
Currently, we have two approaches in mind:
When a client sends something to the server, the server ...
12
votes
3answers
1k 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 ...
7
votes
3answers
732 views
Best way to manage in-game events?
I'm working on a game where some in-game events need to happen once in a while. A nice example would be a tutorial.
You start the game, and at several points in the game an event occurs:
You ...
3
votes
3answers
357 views
What are the techniques used to save space with very large levels?
Some days ago I was thinking "how would I store the real world into a continuous game level ?".
I guess it must have been some challenge for RockStar engineers (for GTA 4 or Red Dead Redemption) or ...
29
votes
7answers
4k 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 ...
20
votes
4answers
1k views
Architecture a for a central renderer rather than self-rendering
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 ...
12
votes
3answers
1k 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 ...
26
votes
10answers
3k 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", ...
14
votes
4answers
2k 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 ...
16
votes
4answers
2k 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 ...
14
votes
4answers
3k views
Resource Managers - Are they any good?
Hey.
I've seen many a time in source code, things like this [well, this is more of a pseudo C++ idea of mine]
type defshared_ptr ResourcePtr;// for ease
ResourcePtr sound1 = ...
12
votes
4answers
2k views
Alternatives to Singletons / globals
I've heard countless times about the pitfalls of Singletons / globals, and I understand why they're so often frowned upon.
What I don't understand is what the elegant, non-messy alternative is. It ...
13
votes
1answer
727 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 ...
9
votes
3answers
1k views
Component-based design: handling objects interaction
I'm not sure how exactly objects do things to other objects in a component based design.
Say I have an Obj class. I do:
Obj obj;
obj.add(new Position());
obj.add(new Physics());
How could I then ...
9
votes
1answer
3k views
How to apply Data Oriented Design with Object Oriented Programming?
I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking ...
7
votes
3answers
893 views
Android threads trouble wrapping my head around design
I am having trouble wrapping my head around game design. On the android platform, I have an activity and set its content view with a custom surface view. The custom surface view acts as my panel and I ...
11
votes
4answers
888 views
Why do MMORPGs still use multiple servers?
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 ...
11
votes
4answers
2k views
How can I design an effective game object interaction scheme with a component-based architecture?
This is a design question... I'm sure this could be generalized more, but I'm having a hard time with it. I am wondering about design for game object interactions - here is my example (2D ...
5
votes
4answers
648 views
Retrieving components from game objects (entities)
Using C# and XNA 4, I've made the decision to go for an entity-component based design for my game after reading such posts as this and this, but I'm now struggling to find how to retrieve components ...
4
votes
4answers
2k views
Why has the industry switched from C to C++?
First of all i would like to have a real answer, i'm always trying to get more from various sources and articles, and when I read things like C++ is slow because it has virtual functions and because ...
10
votes
11answers
944 views
How to model multiple “uses” (e.g. weapon) for usable-inventory/object/items (e.g. katana) within a relational database
So I'm working on expanding the uses of items over at www.ninjawars.net, and I'm not exactly sure how to represent them flexibly in the relational database that we use.
I may be barking up the wrong ...
8
votes
3answers
4k views
Best solution for multiplayer realtime Android game
I plan to make multiplayer realtime game for Android (2-8 players), and I consider, which solution for multiplayer organization is the best:
Make server on PC, and client on mobile, all communition ...
6
votes
1answer
386 views
Global keyboard states
I have following idea about processing keyboard input. We capture input in "main" Game class like this:
protected override void Update(GameTime gameTime)
{
this.CurrentKeyboardState = ...
7
votes
3answers
1k views
Role of an entity state in a component based system?
Component-based entity systems are all the rage these days; everyone seems to agree they are the way to go, but no one really has a definitive implementation of such a system. I was wondering, what ...
18
votes
4answers
5k views
How to design a game engine in an object-oriented language?
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 ...
29
votes
7answers
1k 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 ...
19
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 ...
18
votes
4answers
2k 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 ...