Jump to content
  • 0
Sign in to follow this  
struct_Nitori

Salvaging Fighter Algorithm for Shorter Time and Higher Cleanliness

Suggestion

Thank you very much for good game Avorion. I am enjoying this game very much. I would like to tell you about the problem and solution related to salvaging fighters dealing with small pieces of wreckage.

 

As described in the following threads, salvaging fighters have problem in cleaning up small pieces of wreckage.

https://www.avorion.net/forum/index.php/topic,4119.msg22038.html#msg22038

https://steamcommunity.com/app/445220/discussions/6/1500126447387882444/

 

My situation is as follows.

[*]The sector contains many pieces of wreckage came from more than 20 loaders and pirates.

[*]Wreckage are spreading in a spherical region with 40 km radius probably due to spawning algorithm.

[*]A ship with hangar has salvaging fighters and is controlled by AI captain.

[*]Command salvage to AI captain.

[*]Salvaging fighters are launched.

[*]Salvaging fighters start salvaging a wreckage.

[*]Salvaging fighters move to another wreckage 30 km away before they finish nearest small pieces.

The first problem is that they ignore small pieces. I want salvaging fighters to reduce number of entities in the sector.

The second problem is low time efficiency due to excessive move. They seem to ignore nearest wreckage and go to another wreckage in very far distance. Speed of salvaging fighters are up to 450 m/s. This means it takes more than 1 minute to reach another wreckage.

 

Then, I would like to suggest the following very simple algorithm.

[*]Command salvage to AI captain.

[*]Salvaging fighters are launched.

[*]Salvaging fighters select nearest wreckage as target regardless of its size.

[*]Salvaging fighters continue salvaging targeted wreckage until it is finished.

[*]Once the targeted wreckage is finished, back to 3.

I think this makes the traveling distance shortest and let them not to ignore small pieces of wreckage.

 

I hope this improves the situation related to salvaging fighters dealing with small pieces of wreckage.

Thank you very much, again!

Share this post


Link to post
Share on other sites

11 answers to this suggestion

Recommended Posts

  • 0

I like the suggestion, but how does this solve the problem you linked to at the top of your post? If you command the Fighters to go salvage tiny pieces of wreckage, you'll end up with that same behaviour as before, where they get stuck on tiny pieces of wreckage.

 

Also, wreckage despawns over time. No need for cleanup crew on tiny pieces of wreckage; the server will take care of them eventually.

Share this post


Link to post
Share on other sites
  • 0

Thank you for your reply! That was a good question for me. Here, I would like to divide my idea into two parts:

 

1. Nearest wreckage searching

I think selecting nearest wreckage as next target is still time effective.

 

2. Whether small pieces should be salvaged or not?

This information was new to me. I have only heard about stucking around big L-shaped wreckage. In my case, I could not observe fighters stucking around tiny pieces of wreckage, because they ignore them, of course. Sometimes I felt number of wreckage is reduced when I re-enter a sector. However, some of them seem to remain between re-entry to re-entry.

 

Mainly about 2., I am thinking of following two solutions.

 

A. Handle salvage laser as a string between salvage fighter and wreckage

It allows salvage fighter to track tiny pieces of wreckage perfectly. We can assume salvage laser hit wreckage with 100% certainty. This will surely destroy tiny pieces of wreckage. In another words, this allows salvage fighter rotate salvage laser with infinite speed. This does not require addition of "salvage laser rotation speed" to fighter parameter.

 

B. Wreckage have automatic death timer and threshold

I stay in the same sector for more than 4 hours for mining. While mining fighters are mining, pirates and Xsotans enter the sector. In this situation, I feel the "wreckage cleaning by server" is not active. Then, one of the way might be adding death timer to wreckage if that is small enough. However, this requires addition of timer to each piece of wreckage. Also, this duplicates with existing "wreckage cleaning by server". I do not like this way, to be honest.

 

I could reach the above ideas, thank you.

Share this post


Link to post
Share on other sites
  • 0

Hi,

 

 

The first problem is that they ignore small pieces. I want salvaging fighters to reduce number of entities in the sector.

you do know that there was code introduced (a year ago?) so that AI-Miners don't go for wreckage without ressources on it? The solution would be to switch-off that code.

 

B. Wreckage have automatic death timer and threshold

https://avorion.gamepedia.com/Server

SmallWreckageDespawnTime

Time in seconds it takes for new (as in: not created by the generator but during gameplay, such as combat) small wreckages (15 blocks or less) to disappear.

:)

Share this post


Link to post
Share on other sites
  • 0
you do know that there was code introduced (a year ago?) so that AI-Miners don't go for wreckage without resources on it? The solution would be to switch-off that code.

This is based on my observation. I saw a dialogue "Sir, we can't find any more wreckage in (x,y)!". At this time, I could still see blinking pieces of wreckage in the sector.

Disabling possibly introduced code is one option. We can see whether salvaging fighters stuck on tiny pieces of wreckage or not. If they stuck, "rotatable laser for salvaging fighter" can be a solution. It is difficult for me to test this.

 

SmallWreckageDespawnTime

Though I stayed in one sector for more than smallWreckageDespawnTime, some of wreckage did not disappear regardless of their size. I was in a multiplayer game. Server administrator did not change smallWreckageDespawnTime as attached (.ini is changed to .xml for uploading). So... here comes one question "Are smallWreckageDespawnTime and bigWreckageDespawnTime working?". I think I can test this later.

server.xml

Share this post


Link to post
Share on other sites
  • 0

I found a code related to target wreckage selection.

  File: Avorion\data\scripts\entity\ai\salvage.lua

  Function: function AISalvage.findMinedWreckage()

  Code: if resources ~= nil and resources > 0 then

Judging from this code, my observation was correct. I will cut off this and see whether every piece of wreckage is handled or not.

Share this post


Link to post
Share on other sites
  • 0

1. Nearest wreckage searching

It does exist in "salvage.lua". However, distance calculation seems to be based on carrier's coordinate instead of fighter group's coordinate: local dist = distance2(a.translationf, ship.translationf). If it were based on fighter group's coordinate, salvaging will be more time efficient. But I do not know how to obtain fighter group's coordinate.

 

2. Whether small pieces should be salvaged or not?

Though I deleted the condition and resources > 0. salvaging fighters still ignored some wreckages and returned "Sir, we can't find any more wreckage in (x,y)!". Then, the remaining condition if resources ~= nil then  became suspicious. After I deleted this condition, remaining number of wreckage seemed to be reduced. However, some of them were not salvaged. The remaining suspicious code is as follows:

  A. local mineables = {sector:getEntitiesByComponent(ComponentType.MineableMaterial)}

  B. if a.type == EntityType.Wreckage then

I guess code B is to reject asteroid, which is also minable. I am not sure about code A. One possibility is as follows: those unsalvaged pieces of wreckage might not be listed up by getEntitiesByComponent(ComponentType.MineableMaterial).

Share this post


Link to post
Share on other sites
  • 0

Request If you know any Lua function/code to achieve either of followings, I would like to hear.

[*]Get squadron of a ship entity

[*]Get fighter entity in squadron

[*]Get coordinate of squadron

Thank you.

Share this post


Link to post
Share on other sites
  • 0

Stucking on a tiny wreckage has been observed. According to "salvage.lua", this never happens because AI captain does not choose a wreckage with 0 resource. I think in the following way.

[*]Wreckage initially consists of several blocks and was big enough.

[*]Wreckage loses its blocks during salvaging.

[*]Tiny block remains as the last block to salvage.

To avoid this, I guess there are two solutions.

[*]Check size of wreckage not only in choosing wreckage but also during salvaging.

[*]100% hit rate salvaging laser.

I like second way in my sense.

Share this post


Link to post
Share on other sites
  • 0

Wreckage containing 1 or less material units should despawn in 5-15 seconds, as those are ignored by salvaging ships but spams radar.

The 100% hit rate salvaging fighter is very practical as fighters turn on a dime almost instantly and lasers are supposed to have a 100% hit rate. Mining and Force fighters should also be the same. It would actually simplify the process server-side: no need to calculate collision or accuracy.

 

Also, some wreckage tends to multiply due to server-client discrepancy.

Maybe, after eating all the "identified" wreckage, the fighters should try to eat anything actually called "wreckage" ? With the 100% hit rate, the false wreckage would be updated and disappear, resulting in a clean sector :).

 

So... here comes one question "Are smallWreckageDespawnTime and bigWreckageDespawnTime working?".

They definitely did work during the old war against the Tamuatq'. Lost half a hundred station wreckages to time  :(.

Share this post


Link to post
Share on other sites
  • 0

In my opinion, Avorion is just about a point where the work should be done to provide cleaner and more sophisticated entity generation algorithm, that does not generate any blocks below a certain size margin and incorporates greater variety of shapes and structures on top of "rings" and "hamburgers" with use of all available wedges and corners. That would not only entirely resolve the mentioned problems with invisibly small wreckage frags, but also would make the game more presentable to increase the player base. I can understand it's a painstaking coding work even for a proficient programmer, but it has to be done at some point either way.

Share this post


Link to post
Share on other sites
  • 0

Wreckage containing 1 or less material units should despawn in 5-15 seconds, as those are ignored by salvaging ships but spams radar.

Also, some wreckage tends to multiply due to server-client discrepancy.

I also confirmed despawn of wreckage. The "container" size wreckage which stayed in one sector from jump to jump seems to be some kind of another bug. Spam on radar is a problem :(

 

The 100% hit rate salvaging fighter is very practical as fighters turn on a dime almost instantly and lasers are supposed to have a 100% hit rate. Mining and Force fighters should also be the same. It would actually simplify the process server-side: no need to calculate collision or accuracy.

Thank you for your comment! I am glad to hear good reputation about 100% hit rate salvaging (possibly mining and force) laser. I do think in the same way. It is much simpler and more effective.

 

Maybe, after eating all the "identified" wreckage, the fighters should try to eat anything actually called "wreckage" ? With the 100% hit rate, the false wreckage would be updated and disappear, resulting in a clean sector :).

I guess "identified" means they are wreckage listed up by sector:getEntitiesByComponent(ComponentType.MineableMaterial) with resource > 0 condition in "salvage.lua". Eating wreckage with zero resource  after eating ones with resources should be good because sometimes spawning of Xsotans and pirates exceeds rate of salvaging. On the other hand, stopping generation of wreckage with zero resource is one of the best way as DivineEvil said as follows.

 

In my opinion, Avorion is just about a point where the work should be done to provide cleaner and more sophisticated entity generation algorithm, that does not generate any blocks below a certain size margin and incorporates greater variety of shapes and structures on top of "rings" and "hamburgers" with use of all available wedges and corners. That would not only entirely resolve the mentioned problems with invisibly small wreckage frags, but also would make the game more presentable to increase the player base. I can understand it's a painstaking coding work even for a proficient programmer, but it has to be done at some point either way.

Thanks for your great comment. I think this improves Avorion gameplay further better.

 

Here, I summarize the above opinions.

 

[*]Nearest wreckage searching for shorter traveling time. This can be done by calculating  distance between wreckage and squadron. Additional Lua API to get Squadron Fighter Entities from Ship() is necessary.

[*]100% hit rate salvaging (mining, force) laser. Based on their 100 accuracy laser, it is consistent and effective in dealing with tiny (or too long) wreckage.

[*]Automatic despawn timer. It does exist and is working.

[*]Let wreckage without resource be salvaged after wreckage with resource are cleaned up. It is important to achieve higher cleanliness. It is not achieved just by deleting two conditions "if resources ~= nil and resources > 0 then" in "salvage.lua".

[*]Stop generation of tiny pieces. This is big change in Avorion code which is significant for better gameplay.

 

 

Share this post


Link to post
Share on other sites
Guest
Answer this suggestion...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...