Not a member yet? Why not Sign up today
Create an account  

  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Progress update

#1
Sorry for the couple of weeks of absence, here is what I've been up to:

1) Multi-threading the majority of the game's code. Technically this means moving code from the main thread to one of approximately 5 different other threads. Code that is not in the main thread does not slow down the game's frame rate or contribute to the game's rate of play slowing down. 5 threads is enough to complete the work faster than the main thread conducts its remaining tasks so there is not much point using more than 5. Technically the framework will support as many threads as you like. If you have 4 processor cores it will use 3 threads instead of 5, as having more threads than processors is not a tremendously good idea. The game already uses about 6 other threads for detection/pathfinding/map pathfinding/ CPU ocean/ terrain generation and sub vehicle projection.

2) Removing unnecessary memory allocations. Things allocated to memory that are later disposed of are left to the C# garbage collector to pick up. In FTD during a battle or complex build there are so many of these objects floating around that the garbage collector takes about half a second to clear them all up- and they are created so quickly that the garbage collector needs to clean them up every couple of seconds. This creates a large pause in play. This problem is exacerbated when multiple threads are being used as things are running faster and as such chucking out the garbage (that they would be creating anyway) at a faster rate. I've been busy removing the vast majority of the garbage allocations and have got it down to, I estimate, less than 15% of what it was before. Basically things are reused or pooled, and fancy code using LINQ has been replaced with bog standard for loops that don't generate any enumerators or lambda functions (which create garbage).

3) Fixing up terrain generation now generates the terrain a hell of a lot faster (50 times or so). Party this is due to writing the code more appropriately, and partly this is because the thread pool that was supposed to be splitting the generation of the tiles over many threads was actually only creating one thread due to a bug.

The headline is that the benchmarker scene which used to run at about 16 FPS on my rig now runs at about 38 FPS- which is more than twice as fast. It's smoother (due to the garbage allocation reductions) and the "game speed" is nearly 90% or so.
For people with very low end computers and not many cores they might not see the same improvement however. The gains are found by using more of the CPU's processors, so if you don't have that many processors the gains will be reduced.

However, there is still another few days of bug fixing to be done. Any thread other than the main thread that accidentally executes "unity code" (moving an object, checking if an object exists, adjusting a material,mesh, particle system, checking the time, checking network status, using network calls etc,etc,etc) will throw an error in the Unity Editor and, as I discovered to my horror today, instantly crash the deployed game to desktop. So I need to spend some time checking every block in every way to find all the cases where that happens. As you may have heard, unity is not just "not thread safe" but seems positively allergic to threads. I've had to do a lot of leg work to get around these issues, hence why it has taken a few weeks.

Once this is done, and I hope to be done shortly, I will focus on fixing bugs, and then get back to the tutorial / UI / quality of life issues.
Reviewed FtD on steam yet? It's the #1 thing you can do to help FtD (and future games by Brilliant Skies!), so please take the time!
Bug tracker - view, "upvote", comment on and add all bugs here.
Request tracker - request new features here
support - private portal to service desk
Reply



Messages In This Thread
Progress update - by Nick Smart - 2019-06-07, 08:53 PM
RE: Progress update - by Friends19 - 2019-06-07, 10:25 PM
RE: Progress update - by vyrus - 2019-06-08, 12:58 AM
RE: Progress update - by CrimeanChimera - 2019-06-10, 09:42 AM
RE: Progress update - by harnas1977 - 2019-06-10, 01:21 PM
RE: Progress update - by Carolus Magnus - 2019-06-10, 04:08 PM
RE: Progress update - by Nick Smart - 2019-06-10, 11:20 PM
RE: Progress update - by Carolus Magnus - 2019-06-11, 02:19 PM
RE: Progress update - by Nick Smart - 2019-06-10, 11:13 PM
RE: Progress update - by khkpck - 2019-06-11, 05:47 AM
RE: Progress update - by khaz - 2019-06-11, 09:34 AM
RE: Progress update - by Carolus Magnus - 2019-06-11, 06:57 PM
RE: Progress update - by Nick Smart - 2019-06-12, 11:59 PM
RE: Progress update - by Carolus Magnus - 2019-06-13, 07:41 AM
RE: Progress update - by Nick Smart - 2019-06-14, 02:19 PM
RE: Progress update - by Carolus Magnus - 2019-06-14, 09:16 PM
RE: Progress update - by Skyer - 2019-06-14, 11:15 PM
RE: Progress update - by Lincrono - 2019-06-14, 11:59 PM
RE: Progress update - by Carolus Magnus - 2019-06-15, 05:00 AM
RE: Progress update - by Nick Smart - 2019-06-16, 01:13 PM
RE: Progress update - by Carolus Magnus - 2019-06-16, 04:01 PM
RE: Progress update - by Joeajon - 2019-06-26, 02:37 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)