Multithreading allows multiple threads to exist within the context of a single process sharing same resources but are able to execute independently.

learn more… | top users | synonyms

53
votes
5answers
10k views

How does Dwarf Fortress keep track of so many entities without losing performance?

In Dwarf Fortress you can have hundreds of Dwarves, animals, goblins, etc in game at any one time, each with their own complex AI and pathfinding routines. My question is how does this not produce ...
50
votes
6answers
11k views

Multi-threaded games best practices. One thread for 'logic', one for rendering, or more?

I'm aware there is immense slowing whenever data synchronization is required (let alone any mutex locks). I was thinking getting it to the extreme and doing threads for any subsystem conceivable. But ...
31
votes
6answers
8k views

Multi-threaded game (engine) design resources?

What are the best resources on multi-threaded game or game engine design and development? As this is obviously where computers are headed, I intend to study this topic and I'd like to know what ...
22
votes
7answers
1k views

Multithreading 2D gravity calculations

I'm building a space exploration game and I've currently started working on gravity ( In C# with XNA). The gravity still needs tweaking, but before I can do that, I need to address some performance ...
20
votes
3answers
1k views

Multi-platform multi-threading: What are the real challenges?

While a library like SDL provides a cross-platform wrapper API for threading, I think it would be naive to assume that this leads directly to easy development of games across vastly different ...
19
votes
2answers
7k views

How many threads should an Android game use?

At minimum, an OpenGL Android game has a UI thread and a Renderer thread created by GLSurfaceView. Renderer.onDrawFrame() should be doing a minimum of work to get the higest FPS. The physics, AI, ...
19
votes
6answers
1k views

Data structures for interpolation and threading?

I've been dealing with some frame-rate jittering issues with my game lately, and it seems that the best solution would be the one suggested by Glenn Fiedler (Gaffer on Games) in the classic Fix Your ...
16
votes
4answers
4k views

How can I make message passing between threads in a multithreaded engine less cumbersome?

The C++ engine I'm working on currently is split up into several large threads- Generation (for creating my procedural content), Gameplay (for AI, scripts, simulation), Physics, and Rendering. The ...
12
votes
4answers
1k views

RTS Game AI Thread

I have a project to make a real-time strategy game from scratch. I am still at the early planning stage, but I have been programming a little to see the mechanics. I know how to program. I also have ...
11
votes
6answers
1k views

What is the best way to exploit multicores when making multithread games? [duplicate]

Many people suggest to write a program, and then start optimizing it. But I think that when it's coming to multithreading with multicore, a little think ahead is required. I've read about using ...
11
votes
5answers
1k views

Sprites as Actors

I'm not experienced in Game Development questions, but as a programmer. In the language Scala, you can have scalable multi-tasking with Actors, very stable, as I hear. You can even have hundreds of ...
11
votes
1answer
2k views

Scene Graph in Separate Thread

I develop my own game engine for fun (but not profit). I have rendering in one thread and my scene graph updates (velocity, etc.) in another. When it's time to render, the render thread adds the ...
11
votes
4answers
2k views

Synchronization between game logic thread and rendering thread

How does one separate game logic and rendering? I know there seem to already be questions on here asking exactly that but the answers are not satisfactory to me. From what I understand so far the ...
9
votes
1answer
752 views

Why does V8 not run with SDL threads?

i was able to compile and link V8 against my game and code interpretation works fine. However I want to divide my code and the game loop should exist in one thread and the scripting engine should run ...
9
votes
2answers
783 views

UDP non blocking or a seperate thread for receiving

I am creating a multiplayer game (for under 64 player). I already decided to have a seperate thread for the network loop, but I was wondering if it would be better to create an extra thread for ...
9
votes
2answers
352 views

Efficiently separating Read/Compute/Write steps for concurrent processing of entities in Entity/Component systems

Setup I have an entity-component architecture where Entities can have a set of attributes (which are pure data with no behavior) and there exist systems that run the entity logic which act on that ...
8
votes
3answers
1k 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 ...
8
votes
2answers
1k views

XNA: How does threading work?

I would like to implement threading in my XNA game but I'm not sure how things work when compiling for the XBOX 360. Could someone elaborate on this? For example, how many threads does XBOX support? ...
8
votes
3answers
735 views

How should I structure my classes to allow for multithreaded simulation?

In my game, there are plots of land with buildings (houses, resource centers). Buildings like houses have tenants, rooms, add-ons, et cetera, and there are several values that have to be simulated ...
8
votes
1answer
3k views

How to use multi-thread OpenGL application to update VBO and use it at the same time?

I have simple application. It has two threads. Each thread has it's own rendering context, but they share one VBO (this is working, I tested it). Now what I want: One thread is rendering some data ...
8
votes
2answers
1k views

Java code for client-server game on Android

I have developed a game on Android. Now I want to play it on wifi or 3G. I have game packets which I want to send form client (mobile) to server then to another client (mobile). I don't know how to ...
7
votes
1answer
511 views

How wise is this multithreading architecture?

I'm rewriting a game engine I wrote in an attempt to parallelize as much as possible. I'm considering making properties which may be accessed from multiple threads all use accessors which use boost ...
7
votes
2answers
2k views

Multi threaded game - updating, rendering, and how to split them

From the StackOverflow post (it was recommended I move this): So, I'm working on a game engine, and I've made pretty good progress. However, my engine is single-threaded, and the advantages of ...
6
votes
3answers
570 views

When does parallel-tasks engine becomes a good solution?

I'm often tempted to break the game I'm working on to try a parallel-tasks based architecture, but that don't seem a big requirement for my project so I avoid this for the moment. I'm planning to just ...
6
votes
2answers
464 views

How do you handle scripting in multithreaded environment

In my experience, two approaches are preferred when people want to handle scripting in multithreaded environment. Synchronize every accesses to scripting module with one coarse-grained lock. No ...
6
votes
2answers
2k views

Mixing threads and coroutines in Unity3D Mobile

I had a coroutine in Unity3D that downloaded a zip from a server, extracted it to the persistent data path, and loaded its contents into memory. The flow looked something like this: IEnumerator ...
6
votes
2answers
372 views

Scalability of multi-threading in game server

What is a reasonable number of threads for a simple 2D mmo in Java? Is it reasonable to have two threads per connection, one for the input stream and one for the output stream? The reason I ask is ...
5
votes
2answers
161 views

How to use OpenGL functions from multiples thread?

I'm writing a small game using OpenGL. I'm implementing basic networking in this game and I'm facing a problem. I have a thread in my client socket class that check for available data, when there ...
5
votes
4answers
608 views

Creating a voxel world with 3D arrays using threads

I am making a voxel game (a bit like Minecraft) in C++(11), and I've come across an issue with creating a world efficiently. In my program, I have a World class, which holds a 3D array of Region ...
5
votes
3answers
275 views

What operations should be multithreaded?

I wonder what game operations should be multithreaded, and which should always run on the main thread. The most expensive operations I could come up with are: loading a level loading resources (for ...
5
votes
1answer
204 views

Should I amortize scripting cost via bytecode analysis or multithreading?

I'm working on a game sort of thing where users can write arbitrary code for individual agents, and I'm trying to decide the best way to divide up computation time. The simplest option would be to ...
5
votes
3answers
891 views

Is it necessary to wait for rendering thread to terminate in surfaceDestroyed(…)

I just wrote a simple Android app that uses SurfaceHolder.Callback interface to communicate the state of the SurfaceView. In the Callback.surfaceDestroyed() method i just informed the rendering thread ...
5
votes
3answers
523 views

DirectX9 thread lock problem with “present” and background loading new textures

Given: Selfmade 3D engine based on DirectX9 written in C++ Task: While render loop runs load additional textures in a background thread Current Implementation: - Create device with ...
5
votes
1answer
316 views

Does using [STAThread] with XNA have any negative implications?

I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per this answer. This involves setting ...
5
votes
1answer
304 views

Loading content (meshes, textures, sounds) in the background

In my game, I am aiming for a continuous world, that is, a world where you can go anywhere without breaking the immersion through load times and "virtual seams". My world is broken up into regions, ...
4
votes
4answers
1k views

A* algorithm very slow

I have an programming a RTS game (I use XNA with C#). The pathfinding is working fine, except that when it has a lot of node to search in, there is a lag period of one or two seconds, it happens ...
4
votes
4answers
1k views

Creating the concept of Time

So I've reached the point in my exploration of gaming where I'd like to impliment the concept of time into my little demo I've been building. What are some common methodologies for creating the ...
4
votes
1answer
675 views

How do I use threads together with DirectX11?

I have only found the documents on MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476884(v=vs.85).aspx Although it doesn't say anything about creating them, it mentions that device is ...
4
votes
1answer
411 views

Splitting logic into threads in Java tower defence game

I'm making a tower defence game in Java! It's my first game development. I want to know how many threads Do I need to create in a game, to split logic.. I've made this one: Main App thread (adds ...
4
votes
2answers
1k views

How to create a thread in XNA for pathfinding?

I am trying to create a separate thread for my enemy's A* pathfinder which will give me a list of points to get to the player. I have placed the thread in the update method of my enemy. However this ...
4
votes
2answers
721 views

Using Python what is the best way to perform heavy tasks in the background?

I'm generating large amounts of procedural map data on the fly, however my game engine doesn't rely on them to render the scene and I'd like to build it on in the background and pop it into the world ...
4
votes
3answers
811 views

Multi Threading In Update Loop

Okay so I am working on a game engine and this was my previous game loop: Game::Run() { While(!m_GameDone) Client.Update(); LocalServer.Update(); } but what I want to do is: ...
4
votes
1answer
648 views

Best way to separate display and game logic (threads)

What is the best way to separate render and game logic threads? I'd like to make logic-heavy game (ai, machine learning, and network) in which world updates 50-60 times per second. I want to ...
4
votes
4answers
2k views

One True Event Loop

Simple programs that collect data from only one system need only one (blocking) event loop. For example, Windows applications have the message loop, POSIX network programs usually have a ...
3
votes
3answers
312 views

do games use multiple threads to play music?

Do games use multiple threads to play music and other operations besides things like server connections and sockets? And is that why when the game freezes (for any reason) the music can sometimes ...
3
votes
4answers
1k views

How to properly multi thread an RPG

I am working on an RPG type game in Java and I would like to know a few things relating to threading, What is the best way to implement a "wait for this then do this" without hanging the whole ...
3
votes
3answers
454 views

Get rid of the usual MUD cycles

I am working on a MUD engine and I want to do it a little differently then all the MUD games I played. I find a "cycle" system very boring. One of the idea I had is to make every clients socket ...
3
votes
2answers
199 views

Update and render in separate threads

I'm creating a simple 2D game engine and I want to update and render the sprites in different threads, to learn how it is done. I need to synchronise the update thread and the render one. ...
3
votes
1answer
132 views

Pro's/Con's of separating game logic and render threads

Originally, I have thought that it is good practice to separate my game logic (updating) from my rendering thread. In this threading model, the rendering thread has no limitation on frame rate and ...
3
votes
4answers
1k views

Why does using multithreading during my load screen increase my load times? [closed]

OK, I added a loading screen to my game, and in order for the game able to update and show a loading screen and load stuff in the background I came to the concludsion that I needed to host the loading ...