We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [architecture]

How code is structured. For questions on the internal design of a game engine.

Filter by
Sorted by
Tagged with
20
votes
3answers
15k views

Memory allocation patterns used in game development

I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done ...
20
votes
5answers
2k views

Game actions that take multiple frames to complete

I've never really done much game programming before, pretty straightforward question. Imagine I'm building a Tetris game, with the main loop looking something like this. ...
20
votes
2answers
16k views

Implementing a camera / viewport to a 2D game

What is the most practical way to implement camera/viewport to a 2D-game? I've read, that I should store the object world position instead of position relative to the screen? Current situation: I ...
20
votes
2answers
3k views

Component-Based System online resources [closed]

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 ...
20
votes
3answers
1k 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 ...
19
votes
2answers
5k 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 ...
19
votes
1answer
5k 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 ...
19
votes
2answers
5k views

Where should collision detection logic be placed?

I am developing a small 2D game engine. The characters have a paint method which currently does the following: Calculate the new position of the character as per its speed, etc. Update the collision ...
19
votes
2answers
2k 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 ...
19
votes
3answers
2k 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?
18
votes
6answers
2k 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 ...
18
votes
12answers
16k views

How do I ensure a piece of code runs only once?

I have some code that I only want to run once, even though the circumstances that trigger that code could happen multiple times. For example, when the user clicks the mouse, I want to click the thing:...
18
votes
3answers
27k views

MVC (Model-View-Controller) Game Engine Architecture - Yes or No? [closed]

I am reading one great book, Game Coding Complete, and that book strongly recommends using MVC (Model-View-Controller) approach, with three key layers: Game Application Layer Game Logic Game View To ...
18
votes
2answers
4k views

RTS game unit structure

I want a way to make a lot of different units without having to program stuff like moveTo and Attack actions more than once The way I see it, there are 2 ways I can do this. A single generic Unit ...
18
votes
2answers
22k views

How to edit key-value pairs (like a Dictionary) in Unity's inspector?

I have a spell system I am creating, the principle is as follows: Each spell is an autonomous prefab. It contains a script with some properties (base damage, duration...) that can be modified in the ...
18
votes
4answers
6k 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 ...
18
votes
7answers
2k views

Do I need a Point and a Vector object? Or just using a Vector object to represent a Point is ok?

Structuring the components of an engine that I am developing along with a friend (learning purposes), I came to this doubt. Initially we had a Point constructor, like the following: ...
18
votes
3answers
4k views

How to code UI / HUD in Entity System?

I think I already got the idea of the Entity System inspired by Adam Martin (t-machine). I want to start using this for my next project. I already know the basic of Entity, Components, and Systems. ...
18
votes
5answers
7k views

How should game objects be aware of each other?

I find it hard to find a way to organize game objects so that they are polymorphic but at the same time not polymorphic. Here's an example: assuming that we want all our objects to ...
17
votes
6answers
17k 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 ...
17
votes
5answers
916 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
4answers
4k 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 ...
17
votes
4answers
3k 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 ...
17
votes
1answer
2k views

How can I implement persistent state for objects defined in a level?

I am developing a 2D Metroidvania which consists of a series of interconnected levels that can be revisited. Each level is represented by a Tiled TMX file in which I have specified where various ...
17
votes
4answers
3k views

What can I do to avoid one-off flags and checks throughout my code?

Consider a card game, such as Hearthstone. There are hundreds of cards that do a wide variety of things, some of which are unique even to a single card! For instance, there is a card (called Nozdormu)...
17
votes
4answers
936 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 ...
17
votes
1answer
11k views

How to apply Data Oriented Design with Object Oriented Programming? [closed]

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 me....
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
4answers
2k 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, ...
16
votes
5answers
998 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
2answers
10k 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 ...
16
votes
3answers
7k views

Finite state machine in C++

So, I've read a lot about using FSMs to do game state management, things like what an FSM is, and using a stack or set of states for building one. I've gone through all that. But I'm stuck at writing ...
16
votes
4answers
982 views

Can I use feature creep to my advantage? [closed]

Can I use feature creep to my advantage? Every time I prototype a game, features are inadvertently added. This happens either through coincidence, or it happens to be easy to add based on existing ...
16
votes
3answers
11k views

How to implement trading card game's “special effects cards”?

I am trying to write a kind of a trading card game here, in some way, it is similar to Magic The Gathering, or the Yu-Gi-Oh! card game. For those of you who are not familiar with it, basically, in ...
16
votes
3answers
961 views

Sound effects system design

I'm creating a RPG/RTS game in Unity. There are a lot of characters and potentially a lot of different environments. I'm fairly confident with the coding part (so this question isn't really tied to ...
16
votes
2answers
4k views

Advice on game architecture/design patterns

I've been working on a 2d RPG for awhile now, and I've come to realize I've made some bad design decisions. Theres a few things in particular that are causing me problems, so I was wondering what sort ...
16
votes
4answers
5k 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 ...
15
votes
6answers
8k views

How do videogames store information offscreen?

I'm trying to make a videogame from scratch, but I'm really new to this and keep running into basic issues. Most importantly, how do videogames store offscreen information? What I mean is, how does ...
15
votes
4answers
4k views

Should a socket server and game server be separate processes?

Assume a simple standard client/server game. For the server, is it worthwhile to have a separate process that listens for connections and messages from clients and sends the data via local sockets or ...
15
votes
6answers
6k 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 ...
15
votes
3answers
3k views

Separating Game Engine from game code in similar games, with versioning

I have a finished game, that I want to decline in other versions. These would be similar games, with more or less the same kind of design, but not always, basically things might change, sometimes ...
15
votes
1answer
4k views

How to benefit from cpu cache in a entity component system game engine?

I often read in the ECS game engine documentations that is a good architecture for using cpu cache wisely. But I can't figure how we can benefit from cpu cache. If components are saved in an array (...
15
votes
9answers
20k views

What's a good Open Source game to learn from? [closed]

I want to download the source code of an Open Source game, so I can get familiar with game architecture. Does any one know of a game with source code that's legible, and easily understandable? Edit: ...
14
votes
2answers
6k views

What is an actor in game development?

I am reading a book about game development (Game Coding Complete, Fourth Edition) and there is an "Actors" topic which just explains how to use them briefly instead of explaining what it is. Here's ...
14
votes
6answers
4k views

OOP architecture for Hero with many attributes

I'm about to start a simple browser text RPG, with characters that can (passively) fight other people. This involves a list of about 10 skills like strength, dexterity and so on, with additional ...
14
votes
2answers
4k views

Is this the right architecture for our MMORPG mobile game?

These days I am trying to design architecture of a new MMORPG mobile game for my company. This game is similar to Mafia Wars, iMobsters, or RISK. Basic idea is to prepare an army to battle your ...
14
votes
1answer
2k views

Why is is so hard to develop a game console emulator?

I have always found emulators rather fascinating. I would seriously like to create an emulator for an older ganeration console or handheld. It would help me gain a greater appreciation of the hardware ...
14
votes
3answers
3k views

The reasons behind Unity3D engine design (game object/transform component)

I'm trying to understand the reasoning behind Unity3D engine design and this is something I can't get my head around yet: why is transform data stored in a separate component, instead of being a part ...
14
votes
4answers
4k 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 puzzle-...
14
votes
2answers
5k views

Tips for implementing MMO quest mechanics?

What tools, patterns, or best practices would you recommend to implement the quest mechanics given below listed requirements? I am talking about software architecture (how generic should you be) and ...