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

  • 0 Vote(s) - 0 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

#2
This is amazing news! Glad to see a progress update to let us know how its coming along. Look forward to 'play testing' it Wink

I love big battles and I cannot lie
Owner of your F.riendly N.eighborhood fleet.
Builds stupid things, wins funny prizes.
Reply

#3
Nice! Really excited about these performance optimizations, especially the garbage collection. Unity has a pretty bad rep as far as GC goes in other games, like KSP, so it's good to see a pooled-resource approach. That frame rate increase is pretty awesome!
Reply

#4
In regards to terrain generation, is there a chance that better terrain generation may improve terrain clipping distance as well?
Reply

#5
Really glad to see the performance improvements on the horizon. I like this direction and believe this is more needed than another feature XYZ
primum non nocere
___________________________________
my tournaments:
★★★ Sea Encounters - Battleships! ★★★
★★★ Sea Encounters - Light Cruisers ★★★
Reply

#6
Nick, A question if I may - I love keeping legacy versions of the game arround to revisit at my convenience. This used to be possible because Ftd could be ran offline and DRM-free. Recent updates have made steam obligatory, which is a bit of a pain to me to be honest. Unless it incurs a lot of effort or is absolutely required for certain functionality, could you make steam non-obligatory again for offline play with older versions?

That said, this is very welcome, performance updates!

Quick edit: Compared to version 2.3.15 I notice that spin blocks and turrets set to specific angles no longer spawn ready deployed to those angles, but spawn in a neutral position and than shift to the settings they are set at. That makes a lot of aesthetic design for cabling, walkways a real pain it didn't use to be. Could that be shifted back to the older method?
Imperium Age of Sail Campaign Custom Campaign Dev Idea -> Check it out here!

[Image: 88AAC0598B7E00385C41259D384B95EE9CCBB447]
Reply

#7
So finally got round the problem of the crash to desktop. Turns out it was a unity problem- when the "scene is changed" unity does a bit of a clear up. Due to the large amount of object caching in the new builds this causes a bug in unity that caused it to crash to desktop. I avoided this by removing the scene changes (which didn't do very much because every "scene" has the same sea/land/sky) completely. This has the added benefit of making mode changes (main menu --> designer, designer --> campaign, etc) faster. Happy Smile
I imagine this CTD affects the old build quite a bit when changing scene after a large battle.

I also shocked myself with how good the game is running now:

With the "Performance mode" (lowest graphics) I get the following results in the benchmark scene
52 Hz 0.95 game speed in the new build with threading enabled (lowest graphics)
40.1 Hz 0.91 game speed in the new build without threading enabled (lowest graphics)
31.8 Hz 0.75 game speed in the old build (lowest graphics)

With the maximum graphics in the same scene I get:
44.4 Hz 0.88 game speed in the new build with threading enabled (max graphics)
31 Hz 0.77 game speed in the new build without threading enabled (max graphics)
23.4 Hz 0.58 game speed in old build max graphics (max graphics)

The summary of this is that you can now play maximum graphics quite considerable faster than you used to be able to play minimum graphics (44Hz vs 32 Hz).
Alternatively if you want to stay on minimum graphics it's 52 Hz vs 32 Hz.
Also, just the removal of garbage and the re-writing of some code has spread up the game by about 10 Hz as you can see that the "new build without threading" scores are considerably better than old build scores.

Looking forward to getting the release out- just testing the multiplayer.

Also, sorry the forum went down for a couple of days over the weekend - infrastructure 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

#8
(2019-06-10, 04:08 PM)Carolus Magnus Wrote: Nick, A question if I may - I love keeping legacy versions of the game arround to revisit at my convenience. This used to be possible because Ftd could be ran offline and DRM-free. Recent updates have made steam obligatory, which is a bit of a pain to me to be honest. Unless it incurs a lot of effort or is absolutely required for certain functionality, could you make steam non-obligatory again for offline play with older versions?

That said, this is very welcome, performance updates!

Quick edit: Compared to version 2.3.15 I notice that spin blocks and turrets set to specific angles no longer spawn ready deployed to those angles, but spawn in a neutral position and than shift to the settings they are set at. That makes a lot of aesthetic design for cabling, walkways a real pain it didn't use to be. Could that be shifted back to the older method?

I have a spin block in "rotate to angle" mode, and have set the "Resting angle" to 70° using the slider in the Angle Control tab. pulling and playing the vehicle spawns the spin block at the 70° resting angle.

I see that turrets now have to rotate gradually to there resting angle- did it used to be different? If so can you post a bug report regarding it please, and I will get to it when I can.
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

#9
now the realy interisting question how long for a rollout for the performace update?
like's strange music Tongue
Reply

#10
Sounding good Smile
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)