68 votes
Accepted

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

I've built a 2D roguelike from pretty much scratch, and after lots of experimentation, I used an entirely different approach. Essentially an entity component architecture. Each game object is an ...
Matthew Drury's user avatar
47 votes

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

This is why we often like interfaces over inheritance: Many real-world problems cannot be modeled in an object hierarchy. interface IMove { // returns an intermediate location chosen with // ...
Martin K's user avatar
  • 2,877
24 votes
Accepted

Is there an algorithm for matchmaking?

I'm hesitant to call this an algorithm but there are two basic approaches to this kind of thing: polling and events. What you are describing is polling: on some sort of schedule, you check and see if ...
JimmyJames's user avatar
  • 26.1k
14 votes
Accepted

Is it a good idea to experiment with design patterns?

People have experimented with different mechanics of implementing a design pattern in the past with differing results. For example, the definition of a singleton is that there is only one instance of ...
Berin Loritsch's user avatar
13 votes
Accepted

TCP or UDP for a multiplayer game?

Depends on if you're talking about peer-to-peer, client/server with the users running the server, or client/server with a data center running the server. Only in the latter-most case is the internet ...
Kevin Fee's user avatar
  • 2,837
12 votes

Is there an algorithm for matchmaking?

A problem like this isn’t solved by thinking hard about it. What will happen that humans will run into something controlled by an algorithm, and humans can react in a way that has unintended outcomes. ...
gnasher729's user avatar
  • 43.6k
11 votes

Is it a good idea to experiment with design patterns?

No. Design patterns are not building blocks. If you are trying to 'experiment' with them, you are most likely trying to apply them in situations that don't make any sense. Instead, you should ...
whatsisname's user avatar
  • 27.7k
11 votes

Is software testing different when we are dealing with game development?

Modern games are actually a ton of creative art content developed using an in-house or proprietary game engine. The engine itself is unit testable for most part (rendering, geometry, physics, AI ...
S.D.'s user avatar
  • 1,060
9 votes

How to convert a possibly ever-increasing number to a finite scale?

Simple: you start with f(x)=1/x, which goes down to zero when x goes to infinity. Now you want this approximate a constant c from below, utilize it this way: f(x)= c - 1/x From your example I guess ...
Doc Brown's user avatar
  • 203k
9 votes

How to ensure a user isn't using a hacked client

NEVER TRUST THE CLIENT! No seriously NEVER TRUST THE CLIENT! Third time so you remember NEVER TRUST THE CLIENT! Customer service corollary: The customer is lying! You need to do all important ...
esoterik's user avatar
  • 3,899
9 votes

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

I would follow your first option, but then use the strategy pattern for the different move styles. This will allow you to swap move styles and alter moves styles easier moving forward. So you’d have ...
Adam B's user avatar
  • 1,575
8 votes

When to lock an object in a game

Whenever two or more threads need to change the same object and potentially at the same time, you need to ensure that the object remains in a consistent state making it synchronized. Apparently, it'...
Christophe's user avatar
  • 75.9k
8 votes

Why don't audio engines already process audio more realistically?

There's no technical reason why any of this couldn't be done. Processing of this depth is already done on the images the game displays (although not in quite the same way). The problem is not so ...
Robert Harvey's user avatar
8 votes

How can a html 5 game made licensed?

The usual solution is to put part of your game logic on a server somewhere and have your game communicate with it using AJAX or similar. In the server code you can check for license keys. In short, ...
Dan Pichelman's user avatar
8 votes
Accepted

Optimal Immutable Data Structure for Highly Dynamic Particle System

Immutable data structures are best suited for systems where the majority of data managed by an application stays unchanged (or can be modeled in a way so it stays unchanged) the changes to the data ...
Doc Brown's user avatar
  • 203k
8 votes

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

The answer to your main question: in general, when is it appropriate to introduce a new layer of abstraction at the cost of complicating the program architecture? is relatively simple and ...
Vector Zita's user avatar
  • 2,392
7 votes
Accepted

General architecture of "game makers" (without coding)?

The earliest of this kind of system I encountered was an engine called "HURG". They've become at lot more advanced since then, but basically they all work the same way: they have an embedded pre-...
Periata Breatta's user avatar
7 votes

What would be a good way to abstract OpenGL-Concepts in a game engine?

You shouldn't abstract opengl, instead you should abstract your rendering engine. Key components there are loading a mesh, setting parameters for the render rendering, queuing the mesh for render. ...
ratchet freak's user avatar
7 votes
Accepted

Is it good practice to put comment headers into each file?

A bloated ascii-arty comment header in each file is not a good idea. Decorating public constructs (public interfaces, classes, methods) with summaries and parameter information is a lot more helpful. /...
Rik D's user avatar
  • 4,719
6 votes

How to ensure a user isn't using a hacked client

The "NEVER TRUST THE CLIENT!" answer is absolutely right in every technical way, and there really isn't any way to get around that. It is physically impossible to get what you're asking for. But, ...
wjl's user avatar
  • 257
6 votes
Accepted

Storing and filtering spatial data within RAM

I see you found a library that seems to meet your needs but there are multiple options here. The general structure here is called a spatial index. One the simplest and easiest to understand is ...
JimmyJames's user avatar
  • 26.1k
6 votes
Accepted

In mobile games that work across android and iOS is game logic written twice?

Three words: cross-platform compatibility. If you write your game in HTML and Javascript, it will run on any platform where there is a web browser on the device (which is most devices nowadays). If ...
Robert Harvey's user avatar
6 votes

Why are angles usually represented by floats in programming?

Why are angles usually represented by floats in programming? Because floats are the best we have for this, out of the box. My idea is that, if an unsigned 32-bit integer is used for representing ...
candied_orange's user avatar
6 votes

Writing a growing simulation that scales

If you simulate individual actors and resources, your code will probably have O(n log n) runtime complexity, i.e. to scale for arbitrary growth you'll need to utilize an ever growing amount of CPU ...
Hans-Martin Mosner's user avatar
5 votes
Accepted

How to avoid repeated instantiation and garbage collection for a trivial class?

Instantiating and collecting small, short-lived, temporary objects, is perfectly fine. It is what modern garbage collectors are good at. Modern (generational) garbage collectors are built on a couple ...
Jörg W Mittag's user avatar
5 votes

I loved developing a 2D game(C++ SDL), but i am not good at maths/physics

You're looking for a physics engine. You can learn just enough math to use it. You don't have to make your own. They do neat things like collisions, gravity, and Brownian motion. They can be a lot of ...
candied_orange's user avatar

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