Questions tagged [multithreading]
Multithreading allows multiple threads to exist within the context of a single process sharing same resources but are able to execute independently.
279 questions
1
vote
0
answers
126
views
Correctly handling input in case of frame drop
My game loop looks roughly like this:
...
0
votes
0
answers
98
views
Understanding C# Tasks
I use a lot of path finding in my Monogame project which is taking a toll on the framerate, because in the worst case finding a path can take 200ms. So I looked into using Tasks to spread path finding ...
0
votes
0
answers
85
views
Splitting world data between multiple threads in C++
I'm currently working on world management system for my multi-threaded game engine in C++. The problem I'm facing right now is synchronizing world data between main and render thread. The current ...
1
vote
2
answers
336
views
Making a game loop to run multiple threads
I'm having a really hard time understanding Threads and their contents.
What I'd like to have is a main game object (which I have) and a loop, where I can measure the time it takes for two threads to ...
0
votes
0
answers
161
views
Multithreading Chunkbuilding - Thread.Start() acts as it is on the main thread
I'm building a game from scratch using OpenTK, in C#. It is in its base form a mesh-based voxel engine. I have a decent startup on the chunk building algorithm, multiple blocks, block data, etc, but ...
1
vote
2
answers
392
views
Bullet Physics Multi-threading Rigid Body transform jittering issues across threads
I've been working on a game using Bullet Physics for C++ as well as SDL for the windowing (with OpenGL)
I've recently threaded the game, so that a separate while loop runs the Physics Simulation, ...
1
vote
0
answers
97
views
Physics interpolation given an asynchronous physics thread
I've followed https://gafferongames.com/post/fix_your_timestep/ to do interpolated physics. I have a separate thread entirely from my graphics thread. I use vulkan which allows me to do asynchronous ...
0
votes
2
answers
252
views
How to setup a loading screen using SDL_Threads?
I am trying to set up a basic toy example of how a loading screen would work in SDL. Here is my code below.
...
0
votes
1
answer
740
views
Should networking and rendering be separated in multiple threads?
I've been trying to code a multiplayer client/server prototype game using SFML's networking.
My server and client use TcpSelectors to wait for a certain amount of time for incoming packets without ...
0
votes
1
answer
296
views
Render and Process loop synchronisation with threads
I am developing an interactive visualizer for a project using Pangolin and OpenGL. The idea is as follows.
There are two threads:
1. Render Thread
2. Process Thread
- acquire lock and swap ...
1
vote
1
answer
566
views
How would you write a multithreaded gameloop in C++20 (+) or C++/WinRT?
What are the pros/cons of using either C++20 std:async or C++/WinRT's asynchronous thread and messaging support?
What would the code look like when implementing multithreaded game-loops that ...
0
votes
0
answers
611
views
Message pump and D3D11 DXGI in separate threads
I have read:
https://learn.microsoft.com/en-us/windows/win32/direct3darticles/dxgi-best-practices#multithreading-and-dxgi
https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/d3d10-graphics-...
1
vote
1
answer
288
views
Multithreading in extra large MMO worlds
How is a gameworld of super large size handled? I was always wondering how games handle large MMO worlds. Until now I thought that separation of areas was the key for games like World of Warcraft. In ...
0
votes
1
answer
90
views
Any way to copy data into a component in another thread?
Pretty sure the answer to this is a resounding no but just in case...
Running an expensive algorithm in a separate thread. However, it returns data that must be copied into the arrays of a Shapes....
0
votes
1
answer
2k
views
How to use Unity job system to do background work spanning multiple frames?
I have a slow level generation algorithm that freezes the main thread when it runs.
I found this post which is exactly the same problem, but predates the Jobs system.
All the jobs examples I found are ...
0
votes
1
answer
579
views
Python GLFW and PyOpenGL: How to update a VBO from a thread while rendering at the same time
I'm really new to this community. I'm sorry for any mistakes in advance.I'm making a game like minecraft with GLFW and OpenGL. The problem is, I just can't render a VBO while I update it from another ...
1
vote
1
answer
2k
views
Using Unity Jobs to encode file to PNG and then save it on Main Thread
I have a following code , and i can not retrive encoded Output from Job.
If I Use JOB :
The result is not a valid png file. What I get is a 67,2 MB file which can not be opened with any image editor ...
0
votes
0
answers
150
views
What's a good architecture for a simulation?
I have a concept that involves a world being simulated. Lots of entities and processes acting upon them, not to mention interactions, etc...
Every SimulationTick, ...
0
votes
0
answers
250
views
What is the most performant way for a game engine to poll gamecontrollers?
I am working on a game engine, and currently I hesitate on this decision.
I developed a library that allows Dualsense and Dualshock4 devices to be used in the engine. XBox Support is made possible via ...
0
votes
1
answer
747
views
How do game loading screens work?
I have successfully developed a 2D game.
I display sequential introduction images then load the start screen after that of course I load the game level in a single thread, it is a basic functional ...
1
vote
1
answer
432
views
Wait for a function to return value without impacting framerate
I'm looking to do some possibly heavy calculation in my game. An agent in my game needs to evaluate up to 1000 objects while performing heavy calculations to select his next job.
I want to either ...
0
votes
0
answers
191
views
ECS multithreading without value types?
Im working with an Java based ECS framework called "Artemis ODB".
Its great so far but it lacks multithreading or jobs.
So i wanted to add them by myself. I actually wanted to give each job ...
1
vote
0
answers
140
views
Advice on Multi-Threading Vertex Buffers in Vulkan (or any api)
I have managed to multithread everything in my voxel engine besides two vkCmdCopyBuffer() calls that constantly update a single massive vertex and index buffer using an array of thousands of regions, ...
0
votes
1
answer
376
views
while(1) in separate threads. safe and efficient
In my TCP multithreaded server written in C, I have multiple threads with infinite loops checking for new inputs from thread safe queue and then doing their jobs. pseudocode:
...
1
vote
1
answer
711
views
Multithreading vs Asynchronous game loop for multiplayer online game?
I'm trying to create a turn based multiplayer online game where players can be grouped in a room/lobby and play (similar to Ludo but number of players can be more than 4). There can be multiple such ...
0
votes
2
answers
2k
views
How to process events as well as do OpenGL rendering using multithreading?
I am working on a very complicated graphics rendering, using OpenGL, and it is very time consuming, in the sense that it creates a delay in the event handling, of my application to an extend that, the ...
-1
votes
1
answer
206
views
Parallel transformations tree update
I create my own pet-project graphics engine for the learning and research purposes.
Now I'm trying to create a more efficient scene transformations update technique. My current approach is the linear ...
3
votes
1
answer
5k
views
Question on parallelizing ECS Systems
Learning & Implementing an ECS system for my game, I'm wondering how I am supposed to parallelize the systems on multiple threads. Different systems can't run at the same time (unless they operate ...
0
votes
1
answer
288
views
Should a server run all maps in one loop, or a thread/game loop per map?
I'm working on a real time multiplayer browser-based game.
The game is top down on variable size tile based maps. There is no central map where all players come together, the entire game plays out in ...
1
vote
1
answer
268
views
Multithreaded callback
I'm making a multiplayer game where players fight in vehicles, and I am doubting my server architecture. As it will be physics, network and AI intensive I would like to split these 3 topics into their ...
0
votes
2
answers
603
views
Running multiple game servers on single host
I want to use a vps/dedicated server for game hosting. I expect hosting a lot of servers on that. For the connection, should I assign a unique port for every server or change IPs for every server. And ...
0
votes
1
answer
528
views
How can I handle hundreds of calculation heavy nodes at the same time?
I'm currently trying to implement a basic boids simulation with godot in c#.
Currently I managed to implement evasive behavior which works fine for a boid count of roughly 300. Everything beyond that ...
0
votes
2
answers
592
views
is unity DOTS mature enough to build a whole project on it? [closed]
maybe you assume this question opinion based but its not. please read the whole question.
the question has 2 aspects.
are all features implemented? just better say, can i do everything or any ...
0
votes
1
answer
1k
views
Is Dedicating A Thread To Inputs A Good Idea In Game Design?
Say I design my game targeting a specific PC to run it on 120 frames per second. And say I need to get Input data from the controller at a frequency of 800 times per second, and feed that input data ...
1
vote
2
answers
1k
views
How would I optimize that piece of code using Unity?
I'm doing filtering on a depth image and I would like to convert that piece of code into job system of unity, because it's so slow. The image update is called each frame
...
2
votes
1
answer
1k
views
How do multiplayer servers handle receiving, handling, and sending packets?
I want to make a fighter jet simulator game.
The server (authoritative) and client communicate over udp.
The server sends out updates about the gamestate at a fixed rate. Think of plane positions, ...
11
votes
2
answers
16k
views
Should I use Async & Await, instead of Coroutines, in Unity?
Should I use Async & Await in Unity? Or should I keep using Coroutines? If I should use Async & Await, how can I do so in a manner comparable to Coroutines?
0
votes
1
answer
100
views
Unity: How to connect to server with status in dialog
I am trying to build in unity a basic logon screen. Now I'm building on something if the connection will have delay or so... There will be a dialog, where the progress of connection to server will be ...
1
vote
0
answers
116
views
Binding Lua Function to Perform tasks using std::async
I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would ...
2
votes
1
answer
1k
views
In Unreal why is it safe to access a UTexture2D's properties from the render thread despite the documentation stating this is not allowed?
I've been trying to implement something that will update textures on the render thread from a background thread. And from what I've read of the unreal engine documentation you should never access a ...
2
votes
1
answer
3k
views
Multithreaded design for a game server
I would like to start developing my own game. Basically, the game has a "world" that players can travel around and modify. Think of it as a much more realistic version of Minecraft or an open world ...
0
votes
1
answer
128
views
Box2d: crash on createBody in beginContact callback
I am getting this error on creating body in contactListener
...
0
votes
1
answer
388
views
Worker threads are not being utilized in Time rewind system, is this job system really multi-threaded?
I am trying to make a simple time rewind mechanic. It's working but it becomes slower as number of game objects increases. I decided to give Job System a shot. My idea is to interpolate between ...
0
votes
0
answers
290
views
Help deciding data structure for spatial partitioning, using only value-types in c#
I simply want to implement some sort of grid where I can sort units in an RTS into cells, and then for each unit check to avoid other units and attack other units, in 2d.
My map grid is currently 10 ...
0
votes
1
answer
193
views
Managing large amounts of data and processes for an economy management game
I'm making a management game in the vein of Anno or Stellaris, but I'm unsure how to manage all my data efficiently.
Short example: the player controls multiple islands. Each island has factories on ...
0
votes
0
answers
91
views
How should I cycle my game to be more scalable?
I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there.
The cycles processes players and rooms, rooms are individual ...
0
votes
2
answers
1k
views
Should I create thread for both UDP and TCP?
So I have TCP connection for stuff like leveing, player info, etc..And I have UDP datagram for stuff like player position, rotation, etc..Should I create new thread for both TCP and UDP on both client ...
0
votes
1
answer
2k
views
How to make progress bar in EditorWindow with Threading in Unity?
I need to make a progress bar in EditorWindow. To do this, I perform the function of calculations in threads: Thread thread = new Thread (_worker.Work); thread.Start (); The class itself emitting ...
1
vote
1
answer
2k
views
Multithreading: Each system on a different thread or a thread pool?
I'm building a fairly involved game using OpenGL and C++. I've been thinking about how to implement multithreading, and the two options are:
1) Each system (Graphics, Audio, Physics, et cetera) gets ...
2
votes
1
answer
1k
views
JWJGL Multi-threading to separate update and render
Introduction:
I am currently designing a game in Java using the LWJGL 3.0, with Gradle. I have quite an advanced knowledge on multi-threading, and I am aware how GLFW does/doesn't implement multi-...