- cross-posted to:
- space_games@piefed.world
- lobsters@lemmy.bestiver.se
- cross-posted to:
- space_games@piefed.world
- lobsters@lemmy.bestiver.se
cross-posted from: https://lemmy.dbzer0.com/post/54512198
There’s a newer post as well that follows up on that first one from June. I’m not super technically versed in things like CPU scheduling but I really like that they shared these posts.
I haven’t played DSP in about a year but these guys have definitely caught lighting in a bottle with this concept. If you’ve played this game, you know how crazy that feeling of finally being able to lift off and just… have the full expanse of outer space open in front of you is.
Wube did this too with Factorio. It was always really interesting to read and made me think about things differently. These types of articles are how you raise the next generation of amazing programmers.
DSP is definitely a game that uses player feedback well. The end bit that amounts to “we’ve ran out of testing setups and need some help. Who wants to play with the multi threading settings and give us some more data to work with?”.
I purchased this in November of 21. Might be time to reinstall.
Oh dude they’ve added an insane amount of content since then including full blown AI you can go against if that’s your jam (not mine honestly)
There’s a newer post as well that follows up on that first one from June. I’m not super technically versed in things like CPU scheduling but I really like that they shared these posts.
I haven’t played DSP in about a year but these guys have definitely caught lighting in a bottle with this concept. If you’ve played this game, you know how crazy that feeling of finally being able to lift off and just… have the full expanse of outer space open in front of you is.
Not sure how crossposts work. I don’t see the body text that I originally posted (and it looks like I posted to a dead community?)
Not only was it jaw-dropping, but it also brought us valuable feedback: our game didn’t seem to support more than 64 threads. We quickly located and fixed this “happy problem.”
Finnally an excuse to get a threadripper
Then, any thread that finishes early will “steal” half of the remaining workload from the busiest thread. This loop continues until no thread’s workload exceeds a defined threshold.
Oh, I didn’t know this was possible with programming. I wonder what such code would look like.
Programmer here. I only skimmed the article but this sort of scheduling is very common in multithreaded applications.
The most common I see is Thread 1 is the application start. You click game.exe and this is it. This thread does a lot of initialization and prep work.
Thread 1 then spawns thread 2,3,4,etc and hands them each a set of tasks and a callback function. For DSP it’s probably a list of buildings to calculate resource generation for it seems.
Here’s where I’m guessing. The array of buildings is shared memory that the main task can monitor. As a thread finishes it’s assigned array, it callsback to the main thread it’s completion, the main thread then quickly scans the threads for the one with the longest list over a certain length (probably to avoid overhead of splitting if there’s only a few items left), takes half of it, and sends it to the idle thread, leaving half in the shared memory for the busy thread.
Rinse and repeat until all tasks are done.
The specifics of the code are going to be highly language dependent. Thread locking and instruction atomicity become real important. Hopefully that helps a little.
Wish they’d add multiplayer!
Also curious how much of a lift we’d see on something like the decks performance with these optimizations.
DSP and related dev group are my ride or die. Fucking AMAZING game that everyone should try and a dev team that is just bonkers good as well. They always keep their customer base well informed and their content release since the game went live has just been crazy.



