Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam

[MOD] Sector Manager


Laserzwei
 Share

Recommended Posts

A small proof-of-concept mod to keep a set of sectors loaded, while a player is online.

 

Features

  • Select the sectors to be kept open yourself.
  • Every player controls its own set of sectors.
  • Easy to use interface.

 

UI:

 

 

R86MwS3.jpg

 

 

Note: As a serverowner you might want to set "aliveSectorsPerPlayer" to 1. As this mod will simply ignore that. Use the config file to set the max number of allowed sectors.

 

Install instructions

 

 

Place the contents of the "data" folder into your /steam/.../Avorion/data/ folder. This will overwrite .../entity/init.lua  and  .../player/init.lua.

If you have any other modifying one of these files you will need to merge their content.

Place the contents of the "mods" folder into your /steam/.../Avorion/mods/ folder.

 

 

From Avorion 0.23 on, this mod will be continued in the workshop (https://steamcommunity.com/sharedfiles/filedetails/?id=1694550170)

Since 0.23+ became the main gameversion, there is no download here.

Link to comment
Share on other sites

Version history

0.2.2 for beta0.21.x [2019-02-26]

  - added musiccoordinator script to init.lua (vanilla)

0.2.1 for 0.20.x [2019-01-20]

  - removed useless servercall

  - library is now loaded as module

  - code cleanups

 

 

 

0.2.0 for 0.20.x [2019-01-17]

  - added init scripts, which gives all players access to the sector Manager by default.

  - Had to move files. This requires a full uninstall of the previous versions!

 

0.1.0 for 0.20.x [2019-01-14]

  - config is now loaded from the server

  - added a small label to indicate #sectors wanted to load / sectors available to load/currently loaded

  - added color to clickable sectorLabels to indicate they are loaded (grabs the loaded status when opening the UI)[updated pic in the OP]

 

0.1.0 for 0.20.x [2019-01-13]

  - initial release

 

 

Link to comment
Share on other sites

Update

 

0.2.0 for 0.20.x [2019-01-17]

  - added init scripts, which gives all players access to the sector Manager by default and makes setting it up a cake walk.

  - Had to move files. This requires a full uninstall of the previous versions!(For the 6 downloads/downloaders)

 

*also not proof-of-concept anymore!

Link to comment
Share on other sites

  • 2 weeks later...

I apologize if this is abundantly obvious, but what is the point of wanting to keep multiple sectors "open" like this?  I'm still somewhat new to all this, so I'm not sure.  Is it to make loading into the sector quicker? Is this useful for solo play?

 

Thanks!!!

Link to comment
Share on other sites

I apologize if this is abundantly obvious, but what is the point of wanting to keep multiple sectors "open" like this?  I'm still somewhat new to all this, so I'm not sure.  Is it to make loading into the sector quicker? Is this useful for solo play?

 

Thanks!!!

By default all sectors are unloaded (and if never visited, they aren't even created). Obviously upon joining a multiplayer- or starting your singleplayer galaxy the sector you are in will be loaded. There is a limit for how many sectors stay loaded per player. In singleplayer it's 500 and for multiplayer it's 5. Those values can be adjusted in the server.ini. Furthermore all sectors with player ships or station will get a score or weight. If I remember correctly you get +3 for stations and +1 for each ship (none for fighters). The sectors with the highest score will stay loaded.

With my mod you can choose which sectors will be kept loaded regardless of its score

Link to comment
Share on other sites

Is this supposed to be equivalent to the state of a system with player presence? Or it means off sector calculations for mining and  player stations run in these sectors and that's it?

 

I was wondering if it were possible to use a similar method to fake player presence in a sector. Keep all entities loaded ect.

 

(As to why am I asking this. Off sector mining for me usually does nothing, with this it does something sometimes, but not much. I use Multiverse so it may break something regarding this. In any case it's still damn annoying, so I'm looking for a solution. Don't much care how hacky it may be..)

Link to comment
Share on other sites

I will give a more in depth view on which sectors may get loaded, into what state and at what time.

The default Avorion galaxy has 1,000,000 (1000 x 1000) Sectors. Keeping all of them loaded at once takes far more computional resources than anyone could reasonably afford. Hence only sectors of interest for the player are loaded. If there is no player (e.g. in multiplayer), then no sector is loaded. An unloaded sector sees no movement, no ships enter it and no other events.

When a player joins (here also used as a synonym for loading into singleplayer) a galaxy, then the sector where he was last in will be loaded. That sector will run at 20 Ticks per second. The ticks define the main game logic (this will be important later). Furthermore a player's creations (ships & stations) in other sectors may invoke loading them too. The conditions to load a sector are as follows:

With descending priority:

  • A player can never load more sectors than the `aliveSectorsPerPlayer`-config option in the server.ini (located in your galaxies save folder). Let's call it threshold. By default for singleplayer it's at 500, for multiplayer it's 5. The player's current sector couns towards those limits!
  • The sectors with the highest weight get and are kept loaded first. The weight is calculated as follows:
     

    •  
  • +1 for every ship you own in that sector
     
  • +3 for every station you own in that sector
     

  (I couldn't find the source to the exact sources, so if they are wrong or incomplete notify me!) unbekannt1984 did find the source

 

  If a player has more sectors with a weight > 0 than the threshold allows, only those with the highest weight will be kept loaded. There is no direct way to see the weight of a sector (and no modding interface either!), but if you have a large enough force in a sector, then you will see a dim green surrounding in the galaxymap- which is proportional in size to the number of ships and stations in that sector. There are also small white dots for every ship in a sector.

 

 

 

[*] If you give orders to a ship which will have it move to/through other sectors, then the next sector will be loaded and the ship jumps into it. And if this target sector didn't gain enough weight through the moved ship, then it will be unload shortly after (15-20s).

 

[*] Giving orders to a ship that is in an unloaded sector gives the following message:  "That sector isn't loaded to memory on the server. Please contact your server administrator for help."

 

All of this is the same with alliances, except that any player joining triggers loading the sectors to above rules. As far as I can tell the number of players has no effect on the amount of sectors that an Alliance can load at the same time.

This should conclude when, what sectors get loaded.

 

Sectors have 3 states:


  •  
  • unloaded: Nothin happens in there.
     
  • player loaded: Full action at 20 ticks/s. Here is where the fun is.
     
  • weak loaded

Weak loaded are the interesting ones. They weren't always part of the gameplay (added in 0.12). Before sectors -without players- would stick around for 5 minutes and then get unloaded. By default they update at 2 ticks/s, which is 1/10th of player sectors. When you notice that mining-/salvagingships give less resources per seconds its's also related to them getting less update-ticks.

But you can change the default behavior in your server.ini. To get the full updates/s change the following setting:

emptySectorUpdateInterval=0.0489999987

The long decimal number is due to float-point-arithmetic inaccuracy.

 

 

 

If you find anyone who asks why his ships are mining slower than when he's in the sector show them this post.

https://www.avorion.net/forum/index.php/topic,5397.msg29495.html#msg29495

Link to comment
Share on other sites

Is this supposed to be equivalent to the state of a system with player presence? Or it means off sector calculations for mining and  player stations run in these sectors and that's it?

 

I was wondering if it were possible to use a similar method to fake player presence in a sector. Keep all entities loaded ect.

 

(As to why am I asking this. Off sector mining for me usually does nothing, with this it does something sometimes, but not much. I use Multiverse so it may break something regarding this. In any case it's still damn annoying, so I'm looking for a solution. Don't much care how hacky it may be..)

 

I've written all I know about Vanilla sector loading in the previous post.

To go through your questions quick:

- It's no abstract simulation; it's the full vanilla sector behavior, but with a handbrake on (see the 2nd part of the last post for furthe details)

- I doubt multiverse has any effect on sector loading

 

Link to comment
Share on other sites

Ah awesome, thanks! :D

 

This should fix my problems.

 

 

 

Edit:

Btw knowing all this, my problem does look like a bug. I have 3 ships, and they get stuck like this often, even though the game should have two sectors loaded, (nowhere near the 500, nor the 5) I exit one and they get stuck, or maybe one follows the other doesn't. If I go back it gates immediately to the new system.

 

 

Anyways with Sector Manager, and changing the update interval , now mining at least seems to work, so thanks again.

Link to comment
Share on other sites

Hi Laser,

 

  • A player can never load more sectors than the `aliveSectorsPerPlayer`-config option in the server.ini (located in your galaxies save folder). Let's call it threshold. By default for singleplayer it's at 500, for multiplayer it's 5
  • The sectors with the highest weight get and are kept loaded first. The weight is calculated as follows:
     

    •  
  • +1 for every ship you own in that sector
     
  • +3 for every station you own in that sector
     

  (I couldn't find the source to the exact scores, so if they are wrong or incomplete notify me!)

found the source, but it seems to be 500+1 (singleplayer) or 5+1 (multiplayer), or whatever the serveradmin felt happy with:

 

Out-of-sector simulation

 

"We'll be adding some more means for better control of which sectors will actually get updated on multiplayer servers. For now, sectors with lots of stuff will have a higher priority."

  • Sectors with player and alliance content are updated while the player is not inside the sector
  • Default amount of updated sectors per player on multiplayer is 6 (the sector the player is in, plus 5)
    • This value can be configured in the server.ini settings and will be a lot higher for singleplayer

    [*]If a player has property in more than 6 sectors, this happens:

    • Each sector will have a priority score
    • The 5 sectors with the highest scores will be updated
    • The score in the sectors is 3 for each player station, plus 1 for each player ship

 

from the 0.12.7 (Alliance-Update) Patchnotes...

Link to comment
Share on other sites

Hi Laser,

 

found the source, but it seems to be 500+1 (singleplayer) or 5+1 (multiplayer), or whatever the serveradmin felt happy with:

...

from the 0.12.7 (Alliance-Update) Patchnotes...

Nice, thank you!

 

In some tests few months ago I could not confirm the x+1, it seemed to be just be 5 on multiplayer default setting, not adding one for the current sector. Did not do further tests though, but I think the few tests I did were accurate.

 

Btw: Awesome mod, will try it sooner or later. Its been really missing in vanilla game.

Link to comment
Share on other sites

The sectors eventually go to sleep, does this not work with alliance ships. or did i not configure the mod properly.

Do you have the icon top right? Yes-->Good. No-->reinstall

The first 5 (or whatever is set in the config file on the serverside) sectors will be loaded. Loaded sectors are represented green in the UI. Sectors will unload, if you leave the galaxy. All sectors loaded by this mod are considered loaded by the player. Being in an alliance gives no bonus sectors with this mod.

 

 

 

I did some more tests with vanilla sector loading mechanics:

aliveSectorsPerPlayer    x or x+1?

Whenever I set this to something else than 500 in my singleplayer world it would reset to 500. So I copied the galaxy and started a dedicated server on it. This makes the results somewhat multiplayer only.

This config gives the total amount of sectors a player can have. This includes the players current sector. So it is x + 0.

The setting also affects alliances. So you can get 2 x loaded sectors. However: A sector loaded with player and alliance ships will count towards the sector threshold for both.

 

Giving ships orders. Is it getting stuck in the current or target sector?

You can't command ships in an unloaded sector. You will get this message: "That sector isn't loaded to memory on the server. Please contact your server administrator for help."

 

Giving a ship from a loaded sector the command to fly into an unloaded sector, will load said sector and move the ship over.

If you exceed your sector threshold and the target sector with the moved ship still has a low weight it will be unloaded. And the ship gets stuck.

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...