Invoking the godfather of our project, the Cavedog’s Total Annihilation, one of its most defining features and what made the game really stand out in the RTS world of the 90’s was:
The utterly unparalleled scale of gameplay for its time
Even in the original unmodded version it allowed you to run 200 units and even issue commands to all of them at once. At the time this was unthinkable and no other game engine could match this feat. Later community mods and tricks made it possible to have stable games with up to 1500 units.
As you might know we are set to provide a similar but even greater experience in BAR, which is why we are always thinking about ways in which we can optimize the performance to allow for bigger and bigger battles, because everyone loves big battles :) On that front we might just have hit a bullseye;
Unlocking an order of magnitude higher performance
Read the article to learn more.
The unquestionable heroes of this post are Ivand and Tarnished Knight. They have spearheaded the BAR engine development, delivering two groundbreaking improvements this week. Firstly the new unit and feature drawing method utilizing GL4 capabilities and secondly a novel multithreaded pathing system.
Collectively these 2 new improvements raise the performance by the unbelievable factor of 3-10!
Considering we are talking about the 15-year old Spring engine, it’s hard to believe we have an opportunity to still witness such big improvements and yet, this is the reality. Check the video for the showcase:
Learn more about the tech behind the improvements below
The first of the milestones can be fully credited to the amazing work of Tarnished Knight. He took upon himself the daunting task of figuring out how to utilize multiple processor threads in calculating unit paths.
Until this day it was thought to be nearly impossible to execute in Spring Engine without causing a desync as it was originally written totally with a single-threaded approach in mind. Hence it required a major refactoring of the code, constituting a project few have ever attempted.
The advantages of the new multithreaded pathing system can be summarized as:
(warning: technical language! this section is meant for interested, tech-savvy readers)
When Ivand joined our team he was mainly interested in improving the graphical side of the game. He is the person behind the introduction of the physics-based rendering, map shader improvements, and countless other tweaks that have a giant influence on the awesome visuals we can enjoy in BAR.
After a while, he realized that in order to really bring BAR to the next level in terms of graphics, he has to get his hands dirty with engine code. And he did, despite all the difficulties of understanding its codebase.
While working with the engine it became apparent that there is still a potential for major improvement in terms of performance achievable by introducing:
Modern OpenGL4 rendering
It opens the gates to a plethora of possible improvements, from unit rendering to UI performance. One of the things it makes possible is the new drawing method described below. From the initial benchmarks we did, this rendering method is up to 10x more performant.
The unit rendering in spring has always been rather slow. The main reason for that was the outdated yet universally-supported method.
With certain simplifications, the main rendering loop looked like this. For each unit/feature that fits the screen:
As can be seen the drawing part here is only a single command; the rest is preparation. The drawing batch size is also very small as the rendering is done piece by piece, unit by unit. This is very inefficient and it forces the GPU, a highly parallel device, to stall while waiting for more data to be fed in a serial manner.
Fortunately, the industry realized this quite long ago and new OpenGL capabilities, which we refer to as GL4, allow for much better batching up to the point when all units sharing the same textures can be drawn with a single call! Compare it with thousands of tiny calls before.
Time to get hands dirty with the engine code? But hold on… what about those with old GPUs or incomplete OpenGL drivers that cannot run GL4? We’d like to support them too. So, the software engineering task has suddenly become much more complex: tech details aside – there’s a need to support 4 different rendering methods! Internally the first three methods are classified as legacy renderers and are drawn pretty much the way they were drawn previously. The last GL4 renderer is considered modern and it has very(!) different architecture.
First of all the intermixed tasks of preparation and rendering as per legacy look above are distilled into distinct stages: data preparation and rendering.
The GPU finally has a lot of work to do and its parallel cores don’t stall. The way artistic assets of BAR are done is that all units of a particular faction (Armada or Cortex) share the textures. So only two draw calls like the above are needed to draw the whole bunch of units on the battlefield (one for Armada, another for Cortex), no matter how many units or teams are in there!
The results are rather outstanding, the minimum speedup we usually see is around 2x the FPS increase in light/normal gameplay, up to 3-8x in heavy end-game gameplay. In artificial tests with many units we even see up to 10x FPS speedup.
The work is ongoing to enable the same technology for units/features assigned with custom materials so a lot of fun stuff is ahead.
Along with Ivand and Tarnished Knight let's not forget to express our great gratitude for Beherith, who assisted the engine development process on every stage and prepared all the necessary game-side changes to allow for utilization of the new engine features as well as thoroughly battle-tested the improvements and provided benchmarks. Many UI widgets are now using the new rendering pipeline Ivand provided with, and we can thank Beherith for this.
Also, big kudos to all the testers and other affiliated people from all around Spring ecosystem who helped, discussed, and shared their knowledge throughout realization of this project.
BAR has reached several big milestones in the last week. Since the announcement of the open Alpha release, in July 2020, our community has grown tenfold reaching the whooping 5,000 Discord members. We also have a devoted and active player base of 500 unique players daily in the multiplayer lobby.
We feel honored to be followed by such an amazing audience
The positive feedback we receive is outstanding, and we would like to thank all of these people around the project, playtesting, giving feedback and making us really enjoy our work! Without you all of this wouldn't be possible.
Another great thing that stems from BAR getting this recent traction is the amount of new developers and contributors interested in pushing the project forward. We are happy to announce, and honor the newest collaborators.
Say hi to:
Badosu | all-round assist developer, looking to improve the UI and aid game and engine development, creator of the new contextual grid build menu
kek | a proficient developer and linux specialist, most notably setting up and maintaining a flatpack installer for Linux users
Tristan | 3D artist, helping to improve existing models and planning to produce cinematic rendered videos for BAR Trailers/cutscenes
Teddy | Veteran player and a proficient developer, helping with new useful widgets development, consulting gameplay/balance, on a mission to produce the first standalone map editor for BAR
When we were starting BAR development with the original 2-3 devs, no one would have even imagined the scale to which all of this has escalated.
With no engine or lobby developers we were struggling to deliver anything looking like a polished game. And just look at where we are now!
Nobody would have thought about the great things ahead of us. Looking back at how this project has grown is heartwarming. It is hard to believe how many amazing people are willing to sacrifice their free time to improve all aspects of BAR, from game and engine optimizations, through content creation up to infrastructure development and even compatibility.
It really feels like we are doing something exceptional and unseen in the world of indie game development. Big kudos to everyone involved in making BAR great!
Did you find this post interesting? If you are interested in joining us, as a player, contributor or would just like to follow the development, be sure to join our Discord server!
Play BAR alpha now! See downloads.
Invoking the godfather of our project, the Cavedog’s Total Annihilation, one of its most defining features and what made the game really stand out in the RTS world of the 90’s was:
The utterly unparalleled scale of gameplay for its time
Even in the original unmodded version it allowed you to run 200 units and even issue commands to all of them at once. At the time this was unthinkable and no other game engine could match this feat. Later community mods and tricks made it possible to have stable games with up to 1500 units.
As you might know we are set to provide a similar but even greater experience in BAR, which is why we are always thinking about ways in which we can optimize the performance to allow for bigger and bigger battles, because everyone loves big battles :) On that front we might just have hit a bullseye;
Unlocking an order of magnitude higher performance
Read the article to learn more.
The unquestionable heroes of this post are Ivand and Tarnished Knight. They have spearheaded the BAR engine development, delivering two groundbreaking improvements this week. Firstly the new unit and feature drawing method utilizing GL4 capabilities and secondly a novel multithreaded pathing system.
Collectively these 2 new improvements raise the performance by the unbelievable factor of 3-10!
Considering we are talking about the 15-year old Spring engine, it’s hard to believe we have an opportunity to still witness such big improvements and yet, this is the reality. Check the video for the showcase:
Learn more about the tech behind the improvements below
The first of the milestones can be fully credited to the amazing work of Tarnished Knight. He took upon himself the daunting task of figuring out how to utilize multiple processor threads in calculating unit paths.
Until this day it was thought to be nearly impossible to execute in Spring Engine without causing a desync as it was originally written totally with a single-threaded approach in mind. Hence it required a major refactoring of the code, constituting a project few have ever attempted.
The advantages of the new multithreaded pathing system can be summarized as:
(warning: technical language! this section is meant for interested, tech-savvy readers)
When Ivand joined our team he was mainly interested in improving the graphical side of the game. He is the person behind the introduction of the physics-based rendering, map shader improvements, and countless other tweaks that have a giant influence on the awesome visuals we can enjoy in BAR.
After a while, he realized that in order to really bring BAR to the next level in terms of graphics, he has to get his hands dirty with engine code. And he did, despite all the difficulties of understanding its codebase.
While working with the engine it became apparent that there is still a potential for major improvement in terms of performance achievable by introducing:
Modern OpenGL4 rendering
It opens the gates to a plethora of possible improvements, from unit rendering to UI performance. One of the things it makes possible is the new drawing method described below. From the initial benchmarks we did, this rendering method is up to 10x more performant.
The unit rendering in spring has always been rather slow. The main reason for that was the outdated yet universally-supported method.
With certain simplifications, the main rendering loop looked like this. For each unit/feature that fits the screen:
As can be seen the drawing part here is only a single command; the rest is preparation. The drawing batch size is also very small as the rendering is done piece by piece, unit by unit. This is very inefficient and it forces the GPU, a highly parallel device, to stall while waiting for more data to be fed in a serial manner.
Fortunately, the industry realized this quite long ago and new OpenGL capabilities, which we refer to as GL4, allow for much better batching up to the point when all units sharing the same textures can be drawn with a single call! Compare it with thousands of tiny calls before.
Time to get hands dirty with the engine code? But hold on… what about those with old GPUs or incomplete OpenGL drivers that cannot run GL4? We’d like to support them too. So, the software engineering task has suddenly become much more complex: tech details aside – there’s a need to support 4 different rendering methods! Internally the first three methods are classified as legacy renderers and are drawn pretty much the way they were drawn previously. The last GL4 renderer is considered modern and it has very(!) different architecture.
First of all the intermixed tasks of preparation and rendering as per legacy look above are distilled into distinct stages: data preparation and rendering.
The GPU finally has a lot of work to do and its parallel cores don’t stall. The way artistic assets of BAR are done is that all units of a particular faction (Armada or Cortex) share the textures. So only two draw calls like the above are needed to draw the whole bunch of units on the battlefield (one for Armada, another for Cortex), no matter how many units or teams are in there!
The results are rather outstanding, the minimum speedup we usually see is around 2x the FPS increase in light/normal gameplay, up to 3-8x in heavy end-game gameplay. In artificial tests with many units we even see up to 10x FPS speedup.
The work is ongoing to enable the same technology for units/features assigned with custom materials so a lot of fun stuff is ahead.
Along with Ivand and Tarnished Knight let's not forget to express our great gratitude for Beherith, who assisted the engine development process on every stage and prepared all the necessary game-side changes to allow for utilization of the new engine features as well as thoroughly battle-tested the improvements and provided benchmarks. Many UI widgets are now using the new rendering pipeline Ivand provided with, and we can thank Beherith for this.
Also, big kudos to all the testers and other affiliated people from all around Spring ecosystem who helped, discussed, and shared their knowledge throughout realization of this project.
BAR has reached several big milestones in the last week. Since the announcement of the open Alpha release, in July 2020, our community has grown tenfold reaching the whooping 5,000 Discord members. We also have a devoted and active player base of 500 unique players daily in the multiplayer lobby.
We feel honored to be followed by such an amazing audience
The positive feedback we receive is outstanding, and we would like to thank all of these people around the project, playtesting, giving feedback and making us really enjoy our work! Without you all of this wouldn't be possible.
Another great thing that stems from BAR getting this recent traction is the amount of new developers and contributors interested in pushing the project forward. We are happy to announce, and honor the newest collaborators.
Say hi to:
Badosu | all-round assist developer, looking to improve the UI and aid game and engine development, creator of the new contextual grid build menu
kek | a proficient developer and linux specialist, most notably setting up and maintaining a flatpack installer for Linux users
Tristan | 3D artist, helping to improve existing models and planning to produce cinematic rendered videos for BAR Trailers/cutscenes
Teddy | Veteran player and a proficient developer, helping with new useful widgets development, consulting gameplay/balance, on a mission to produce the first standalone map editor for BAR
When we were starting BAR development with the original 2-3 devs, no one would have even imagined the scale to which all of this has escalated.
With no engine or lobby developers we were struggling to deliver anything looking like a polished game. And just look at where we are now!
Nobody would have thought about the great things ahead of us. Looking back at how this project has grown is heartwarming. It is hard to believe how many amazing people are willing to sacrifice their free time to improve all aspects of BAR, from game and engine optimizations, through content creation up to infrastructure development and even compatibility.
It really feels like we are doing something exceptional and unseen in the world of indie game development. Big kudos to everyone involved in making BAR great!
Did you find this post interesting? If you are interested in joining us, as a player, contributor or would just like to follow the development, be sure to join our Discord server!
Play BAR alpha now! See downloads.