Dev Progress II: Out of sector updates server performance
Over the last weeks we finished up on the alliances mechanics, meaning: Alliances are basically finished (feature-wise)! They need more testing, but the features are all in. However, there's a lot of other features that we want to ship alongside alliances with the next update, the most important ones being Steam Workshop support for ship and station models and out-of-sector-updates for player ships and stations. We want to ship them all at once because we know that if we ship them one by one they will break their own database structures (ie. corrupting your saves) or we'd have to add a converter each single time (which is actually not an option if we have to do it for lots of small updates) since we're doing a lot of work in that area right now. I also improved how player ships are saved and, most importantly, restored when there are database corruptions. Right now ships are always stored in the sector files, since technically speaking, they belong to a sector. But this lead to annoying ship losses in a few cases when the server crashes before a sector can be written to disk. With the new system, which will be shipped with the update, player ships and stations will be saved in the player's file. In addition to that, the server will now save multiple instances of the player's file, meaning even if a player file gets corrupted due to lack of HDD space, BSOD, a power outage or other reasons, there are 5 other fallback saves which you can access so at max only the progress of the last 5 minutes is lost. This also means that you can now transfer entire players, including their ships (!) to another server by copying that player's file. It also means that sector and player files no longer need to be written out every time a player changes sectors, which should improve performance of multiplayer servers dramatically. This also allowed me to fix an issue where the entire database would get written out in some cases to ensure a consistent state. This has been identified as the major cause for those huge lags that tended to occur on large servers (like the public test server) whenever a player logged in or whenever a new faction was created (ie. when a player changed sectors into a region of a new faction).
Steam Workshop implementation should be quite straightforward. If its ease of implementation is similar to the other Steam API features that I've used in the past it should be realized quite quickly. Performance optimization for holding lots of sectors in memory at once, however, has proven quite the problem (but a solvable one, phew) over the last few days. When we're talking about keeping lots of sectors alive at once, The most important things are update performance and memory consumption of the server. Now, sectors without players are actually really lightweight when it comes to update performance, since the game is using a simplified update variant for these, however they can still easily use 100 - 150 MB of RAM per sector while in memory. And players tend to visit the populated sectors more often since they're a lot more interesting than empty space. So we have to improve on the memory consumption most importantly. So we profiled what was actually causing the high memory consumption. At first we thought "obvious, it's all the geometry of the objects". After measuring memory consumption before and after stripping down all the plans of all the objects in several highly populated sectors we realized that those only took up 2 - 5 MB of RAM, out of 130MB. So that clearly wasn't the cause for the high RAM consumption. Which was to be honest both scary and a relief. A relief because if it were the block structures, we'd have to strip them every time a player leaves a sector and re-add them every time a player reenters the sector, which would lead to a myriad of special cases where components and scripts would always have to check if a plan was actually loaded or not (have fun, modders, haha). But it was also scary since it had to be something that we hadn't thought of before, and that's never good. After further investigation it turned out to be the lua scripts. In highly populated sectors we saw that there were on average around 220 scripts active (basically nearly every single station or ship interaction is its own script). But it wasn't the scripts themselves, it was the fact that we were using a single lua VM for each unique script. This might sound ludicrous, but at the time it seemed like a good idea since these VMs are actually rather lightweight, and each script could be cleaned up easily when it's being detached or deleted. Well, they were lightweight until we started adding the Avorion Scripting API, which blows each VM's memory consumption from 5 - 20KB (depending on which built-in lua libs we offered) to at least 130KB. 130KB times 220 is 28.6 MB, so we had at least 28.6 MB per sector. And we're not yet counting any initialization or actual scripts, this is just the absolute minimum basis per script. Initialized scripts could take 500KB to 2.5MB. After profiling some more we saw that the scripts used up to 80 MB per sector - quite the amount. The big issue here is that when using a separate VM for each script, there will have to be a lot of redundant data available to each VM, since the VMs themselves don't know that there are other VMs.
So what I've come up with now is simple: Use a single lua VM for each entity, and no longer for each script. We were forced to make a few script API changes in order to do this, but the good news is: We managed to do it in a way that will NOT kill current mods! I'd still strongly advise modders to adjust their scripts to make use of the improved memory consumption, though. The changes are as follows:
If you made it here, congratulations and thanks for reading! Hopefully I managed to give you an insight on what we're doing right now.
I won't give another date right now because this stuff is really (and I mean REALLY) hard to predict, but I want you all to know that we're working hard on new features and improving the game and we've been making some great progress over the last weeks. As I said in the last announcement: Software engineering is a complex thing and there can always be unforeseen issues (these issues I just talked to you about are basically the proof) so telling an exact date is hard if we want to ship with as little issues as possible. There's a reason why lots of companies just say "when it's done". But to give you at least some feedback: About 50% of the work of the update is done, and hopefully the rest will be more straightforward so let that be an indicator for you. Oh, and there will be more new screenshots of nice new features in the next update, promise :) Have fun and see you all soon!
[ 2017-05-08 17:51:14 CET ] [ Original post ]
DISCLAIMER: I will speak about what happened, progress and performance optimization over the last few days and since it's mostly been coding, it will get kind of technical. I could post some images but there really is nothing new on them that I could show you, so I don't see the point of doing it. This will most likely also be more like a blog post or something. We'll see.
Alliances & Progress
Over the last weeks we finished up on the alliances mechanics, meaning: Alliances are basically finished (feature-wise)! They need more testing, but the features are all in. However, there's a lot of other features that we want to ship alongside alliances with the next update, the most important ones being Steam Workshop support for ship and station models and out-of-sector-updates for player ships and stations. We want to ship them all at once because we know that if we ship them one by one they will break their own database structures (ie. corrupting your saves) or we'd have to add a converter each single time (which is actually not an option if we have to do it for lots of small updates) since we're doing a lot of work in that area right now. I also improved how player ships are saved and, most importantly, restored when there are database corruptions. Right now ships are always stored in the sector files, since technically speaking, they belong to a sector. But this lead to annoying ship losses in a few cases when the server crashes before a sector can be written to disk. With the new system, which will be shipped with the update, player ships and stations will be saved in the player's file. In addition to that, the server will now save multiple instances of the player's file, meaning even if a player file gets corrupted due to lack of HDD space, BSOD, a power outage or other reasons, there are 5 other fallback saves which you can access so at max only the progress of the last 5 minutes is lost. This also means that you can now transfer entire players, including their ships (!) to another server by copying that player's file. It also means that sector and player files no longer need to be written out every time a player changes sectors, which should improve performance of multiplayer servers dramatically. This also allowed me to fix an issue where the entire database would get written out in some cases to ensure a consistent state. This has been identified as the major cause for those huge lags that tended to occur on large servers (like the public test server) whenever a player logged in or whenever a new faction was created (ie. when a player changed sectors into a region of a new faction).
Steam Workshop and Out-Of-Sector Performance Improvements
Steam Workshop implementation should be quite straightforward. If its ease of implementation is similar to the other Steam API features that I've used in the past it should be realized quite quickly. Performance optimization for holding lots of sectors in memory at once, however, has proven quite the problem (but a solvable one, phew) over the last few days. When we're talking about keeping lots of sectors alive at once, The most important things are update performance and memory consumption of the server. Now, sectors without players are actually really lightweight when it comes to update performance, since the game is using a simplified update variant for these, however they can still easily use 100 - 150 MB of RAM per sector while in memory. And players tend to visit the populated sectors more often since they're a lot more interesting than empty space. So we have to improve on the memory consumption most importantly. So we profiled what was actually causing the high memory consumption. At first we thought "obvious, it's all the geometry of the objects". After measuring memory consumption before and after stripping down all the plans of all the objects in several highly populated sectors we realized that those only took up 2 - 5 MB of RAM, out of 130MB. So that clearly wasn't the cause for the high RAM consumption. Which was to be honest both scary and a relief. A relief because if it were the block structures, we'd have to strip them every time a player leaves a sector and re-add them every time a player reenters the sector, which would lead to a myriad of special cases where components and scripts would always have to check if a plan was actually loaded or not (have fun, modders, haha). But it was also scary since it had to be something that we hadn't thought of before, and that's never good. After further investigation it turned out to be the lua scripts. In highly populated sectors we saw that there were on average around 220 scripts active (basically nearly every single station or ship interaction is its own script). But it wasn't the scripts themselves, it was the fact that we were using a single lua VM for each unique script. This might sound ludicrous, but at the time it seemed like a good idea since these VMs are actually rather lightweight, and each script could be cleaned up easily when it's being detached or deleted. Well, they were lightweight until we started adding the Avorion Scripting API, which blows each VM's memory consumption from 5 - 20KB (depending on which built-in lua libs we offered) to at least 130KB. 130KB times 220 is 28.6 MB, so we had at least 28.6 MB per sector. And we're not yet counting any initialization or actual scripts, this is just the absolute minimum basis per script. Initialized scripts could take 500KB to 2.5MB. After profiling some more we saw that the scripts used up to 80 MB per sector - quite the amount. The big issue here is that when using a separate VM for each script, there will have to be a lot of redundant data available to each VM, since the VMs themselves don't know that there are other VMs.
The improved Scripting API
So what I've come up with now is simple: Use a single lua VM for each entity, and no longer for each script. We were forced to make a few script API changes in order to do this, but the good news is: We managed to do it in a way that will NOT kill current mods! I'd still strongly advise modders to adjust their scripts to make use of the improved memory consumption, though. The changes are as follows:
- Since every script defines functions that will be called from the main game, and these functions have to have the same names, I've added modules or namespaces (I'll decide on which term we'll use later). Each script can define a namespace/module in which its functions will live that it'll expose to the main program. By separating them into different modules or namespaces they will no longer have the same name in the VM and they won't get overridden when another script is loaded into the VM.
- When loading a script, Avorion will check if it's using a namespace, and if yes and if there are no duplicates it will be injected into the existing lua VM of the object.
- If no namespace is defined or the namespace exists already (basically whenever there's a potential for methods being overridden by the newly loaded script) the script will be run in a new VM. This is basically exactly the same as the old model that we've been using so far.
Alright that's it for now!
If you made it here, congratulations and thanks for reading! Hopefully I managed to give you an insight on what we're doing right now.
OMG I DON'T CARE UPDATE WHEN!?
I won't give another date right now because this stuff is really (and I mean REALLY) hard to predict, but I want you all to know that we're working hard on new features and improving the game and we've been making some great progress over the last weeks. As I said in the last announcement: Software engineering is a complex thing and there can always be unforeseen issues (these issues I just talked to you about are basically the proof) so telling an exact date is hard if we want to ship with as little issues as possible. There's a reason why lots of companies just say "when it's done". But to give you at least some feedback: About 50% of the work of the update is done, and hopefully the rest will be more straightforward so let that be an indicator for you. Oh, and there will be more new screenshots of nice new features in the next update, promise :) Have fun and see you all soon!
Avorion
Boxelware
Boxelware
2020-03-09
Indie Simulation Singleplayer Multiplayer Coop
Game News Posts 295
🎹🖱️Keyboard + Mouse
Very Positive
(11751 reviews)
https://www.avorion.net/
https://store.steampowered.com/app/445220 
The Game includes VR Support
Avorion Linux Content [28.59 M]
Avorion - Black Market
Avorion - Into The Rift
Avorion - Behemoth Event Series
Avorion is currently in Early Access, and is under active development. If you want to know more about that, please read the Early Access disclaimer at the top of the page.
Several hundred years ago, a cataclysmic catastrophe nearly ripped your galaxy apart - an unsurmountable ring of torn hyperspace fabric appeared in the center of the galaxy, which normal hyperspace engines can’t overcome.
Since this event nobody has managed to get near the central regions of the galaxy. All you know is that this event also spawned multiple unsurmountable hyperspace rifts throughout the entire galaxy, and that a strange race of aliens, the Xsotan, has appeared in the center. It looks like these aliens have found a way to surpass the torn hyperspace fabric, but so far nobody has managed to establish contact with them.
There are also rumours about a strange new metal called ‘Avorion’, which has appeared in the center of the galaxy, around the same time as the Xsotan arrived. Apparently the aliens use this material to build their ships.
Start out as a nobody at the edge of the galaxy and work your way to the center of a galaxy that gets more dangerous, but also more rewarding the closer you get to its core. Avorion takes sandbox aspects from games like X or Freelancer, throws in co-op multiplayer and lets you build your own ships. It features ships made of freely scalable blocks that can be procedurally generated and that break into pieces where they're hit in space fights.
Explore the galaxy at your own pace to find valuable goods in old ship wreckages, undiscovered asteroid fields rich of resources, unchartered asteroids which you can claim for yourself, or clues as to what happened during the event a few hundred years back.
Build specialized transport ships with lots of cargo space or heavily armored battleships with strong shields. Collect loot from defeated foes which you can use to upgrade your ship: New turrets, resources, trading goods or system upgrades. Install system upgrades that allow more weapons, ease asteroid mining or trading systems which detect trading routes over multiple sectors.
And why build only one ship? Hire captains to fly your ships for you, manage your crews, weapons, hangars and fighters and build your own fleet of space ships!
In Avorion you choose your personal playstyle. Haul cargo, find profitable trading routes and found factories. Or maybe you're sick of being the good guy? Build your own battleship, equip it with powerful weaponry and blow away your enemies. Be the aggressor that starts wars with entire factions, raid freighters, smuggle illegal goods and scavenge old wreckages. Find your way to the center of a galaxy that gets more hostile, but also more rewarding the closer you get to its core.
Several hundred years ago, a cataclysmic catastrophe nearly ripped your galaxy apart - an unsurmountable ring of torn hyperspace fabric appeared in the center of the galaxy, which normal hyperspace engines can’t overcome.
Since this event nobody has managed to get near the central regions of the galaxy. All you know is that this event also spawned multiple unsurmountable hyperspace rifts throughout the entire galaxy, and that a strange race of aliens, the Xsotan, has appeared in the center. It looks like these aliens have found a way to surpass the torn hyperspace fabric, but so far nobody has managed to establish contact with them.
There are also rumours about a strange new metal called ‘Avorion’, which has appeared in the center of the galaxy, around the same time as the Xsotan arrived. Apparently the aliens use this material to build their ships.
Start out as a nobody at the edge of the galaxy and work your way to the center of a galaxy that gets more dangerous, but also more rewarding the closer you get to its core. Avorion takes sandbox aspects from games like X or Freelancer, throws in co-op multiplayer and lets you build your own ships. It features ships made of freely scalable blocks that can be procedurally generated and that break into pieces where they're hit in space fights.
Combat
Equip your ship with chainguns, lasers and other weaponry to take on your enemies and enjoy the sight of completely destructible ships breaking at the exact points where you hit them. Defend your allies from pirates, hunt down enemies for coin or even participate in wars between entire factions. Build hangars and command squads of fighters in your battles or destroy enemy freighters to steal their cargo.Explore
Fly through beautiful nebulas and dense asteroid fields in search of hidden treasures and meet the many factions that populate and control their portion of the galaxy. Each faction has its own characteristics, such as peaceful, intelligent or aggressive, and has its own ship styles, meaning their ships and stations have a distinct look.Explore the galaxy at your own pace to find valuable goods in old ship wreckages, undiscovered asteroid fields rich of resources, unchartered asteroids which you can claim for yourself, or clues as to what happened during the event a few hundred years back.
Build Your Fleet
There are no limits to ship size or complexity besides your resources. You're not bound to the standard voxel style and while building an awesome ship in Avorion you won't get lost in lots and lots of micro-management. You can focus on building a great looking ship, without having too much trouble to make it work. But make sure you still keep an eye on your ship’s maneuverability or energy requirements. Adjust your ships perfectly to their operational purpose by building light and agile or heavily armored ships.Build specialized transport ships with lots of cargo space or heavily armored battleships with strong shields. Collect loot from defeated foes which you can use to upgrade your ship: New turrets, resources, trading goods or system upgrades. Install system upgrades that allow more weapons, ease asteroid mining or trading systems which detect trading routes over multiple sectors.
And why build only one ship? Hire captains to fly your ships for you, manage your crews, weapons, hangars and fighters and build your own fleet of space ships!
Trade
Extend your ship with a cargo bay, find profitable deals and haul over a hundred trading goods through the galaxy to make a profit and buy your way up the food chain: Build up a trading corporation and extend your influence in the galaxy by founding asteroid mines and factories that attract NPC traders who will buy and sell their goods at your establishments.Co-op Multiplayer
You don't have to fight the galaxy alone! Avorion features co-op multiplayer, so team up with your friends to build stations together and destroy pirates and enemy factions! Work together to extend your influence in the galaxy and build your own empire. Or, you know, blow them apart in large PvP battles. It's a sandbox, you can do whatever you want.In Avorion you choose your personal playstyle. Haul cargo, find profitable trading routes and found factories. Or maybe you're sick of being the good guy? Build your own battleship, equip it with powerful weaponry and blow away your enemies. Be the aggressor that starts wars with entire factions, raid freighters, smuggle illegal goods and scavenge old wreckages. Find your way to the center of a galaxy that gets more hostile, but also more rewarding the closer you get to its core.
MINIMAL SETUP
- OS: Ubuntu 12.04 or higher
- Processor: Intel i5 @ 3.0 GHz or AMD equivalentMemory: 4 GB RAM
- Memory: 4 GB RAM
- Graphics: Nvidia Geforce 550 or equivalent (full OpenGL 3.0 support required)Network: Broadband Internet connection
- Storage: 1 GB available spaceAdditional Notes: Middle mouse button. mouse wheel required. No Internet connection required for Singleplayer.
- OS: Ubuntu 12.04 or higher
- Processor: Intel i7 @ 3.3 GHz or AMD equivalentMemory: 6 GB RAM
- Memory: 6 GB RAM
- Graphics: NVidia Geforce 1050 / Radeon RX 460Network: Broadband Internet connection
- Storage: 3 GB available spaceAdditional Notes: Middle mouse button. mouse wheel required. No Internet connection required for Singleplayer.
GAMEBILLET
[ 5951 ]
GAMERSGATE
[ 3221 ]
FANATICAL BUNDLES
HUMBLE BUNDLES
by buying games/dlcs from affiliate links you are supporting tuxDB