EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
many script instances slow down SETA (spaceflies, Anarkis/Pirate Guild)
Post new topic Reply to topic Goto page Previous  1, 2, 3
View previous topic :: View next topic
Author Message
Aldebaran_Prime



MEDALMEDALMEDAL

Joined: 20 Feb 2010
Posts: 1014 on topic
Location: Düsseldorf, Altbiersektor
Thank you for registering your game
PostPosted: Sat, 23. Jun 18, 00:52    Post subject: Reply with quote Print

SirNukes wrote:
...
In short, the fundamental problem is either bad documentation or bad behavior of the "create ship" command (depending on which angle you look at it). When a spacefly is requested, the script engine redirects from Create to CreateSwarm, so a whole flock of spaceflies are created and their scripts started. The documentation doesn't mention this, and modders do not expect this behavior.


... They destroy the single spacefly they meant to create, but not the unexpected extra swarm.


....


Very good, that you find a potential reason for the mess of spaceflys!
But maybe you can give us more details of the scripts and places of problematic code in this scripts/mods?
It sounds like, that the spaceflys are created as helper beacons in these cases - so alternatively to modify the create ship behavior in general, it may be another approach to modify the problematic code in these mods...


_________________
Back to top
View user's profile Send private message
SirNukes





Joined: 31 Mar 2007
Posts: 147 on topic

Thank you for registering your game
PostPosted: Sat, 23. Jun 18, 12:13    Post subject: Reply with quote Print

Improved Races appears to have its main problem in xtl.lib.ship.choose.xml around line 49, though there are a couple other places it creates ships in the null sector that I didn't look at closely.

Grepping around also found some seemingly problematic code in the MARS setup.plugin.gz.missile.def.mk2.xml file, though that script appears to deactivate itself in AP (even though it is packaged with a version of Mars that works with AP).

I must apologize for thinking XRM was to blame for my second spacefly swarm; after applying some better care, it is actually Salvage Command Software that is the problem. Looking through the code, I can see potential spots where the bug might be cropping up, but there is no obvious 'loop over tships' code like in the above two mods. At any rate, SCS causes a hiccup shortly after loading a save that will pop out a swarm.


As for the style of the fix, my own preference is a clever catch-all solution. Finding and editing every script with this problem feels clumsy, both in carrying it out and sharing the edits. My gut feeling is that no one has ever used "create ship" to purposefully make a spacefly swarm, given the lack of of documentation of this behavior and lack of general interest in spacefly mods.

Back to top
View user's profile Send private message
Aldebaran_Prime



MEDALMEDALMEDAL

Joined: 20 Feb 2010
Posts: 1014 on topic
Location: Düsseldorf, Altbiersektor
Thank you for registering your game
PostPosted: Sat, 23. Jun 18, 23:26    Post subject: Reply with quote Print

Thank you! Yes, I found this:
Code:
...
$WareSubType = get number of subtypes of maintype 7
while $WareSubType
dec $WareSubType
$cShipWare = get ware from maintype 7 and subtype $WareSubType
gosub CheckType:
if $EvalRet == [FALSE]
continue
end

$SpawnedShip = create ship: type=$cShipWare owner=[Unbekannt] addto=null x=0 y=0 z=0
...


I can see, that also spaceflys will created in sector NULL in this case and I believe you, that not only a singel Spacefly, but a swarm will be created, but not deleted afterwards.

additionally to patch the create ship command in the Egosoft obj-files, an other approach can be, in this special case, to correct the code of this IR2.0 script not to to create a spacefly in this loop. (I'm really impressed maximal, what knowlege you have! I will try your X3 Customizer, too)

I found, that the subroutine "CheckType:", which is called before the create ship statement, checks for several shiptypes and then not creates a ship in sector NULL:
Code:
CheckType:
$EvalRet = [FALSE]
$eval = $cShipWare
if $eval == {Argonen Truelight Seeker}
endsub
else if $eval == {Terraner #deca.deaf}
endsub
else if $eval == {Terraner #deca.cefa}
endsub


I just would add a
Code:
else if $eval == {Unbekannt Raumfliegen}
endsub

there and the problem is fixed, too.

- or do I think wrong?

If I'm right, we may post this research in the thread of IR2.0, too, to prevent other players to run into this problem.


_________________
Back to top
View user's profile Send private message
SirNukes





Joined: 31 Mar 2007
Posts: 147 on topic

Thank you for registering your game
PostPosted: Sun, 24. Jun 18, 01:19    Post subject: Reply with quote Print

I agree, your fix would slot very nicely into that IR code.

There is another case of creating/destroying ships in xtl.xtlc.comm.order.checkout.xml, but it looks like that might only ever handle ships the player can order from a shipyard, so I'm thinking that won't ever make spaceflies.

Salvage Command Software took a while to track down the culprit, but it looks like it is in scs.library.xml around line 2618. (Annoyingly, grepWin wasn't finding this with "create.*ship.*addto.*null", even though notepad++ matches just fine. I ended up finding it by just reading through the code starting from setup.)

Side note: early on I looked into Zanzal's Ship Browser, since I knew that looped over ships and made them to record information. The interesting code is in plugin.zanzal.shipbrowser.menu.xml around line 422. That mod has no spacefly problem because it will pull the class of the ship subtype and compare it to the desired class (eg. M4) before creating it. Spaceflies have their own special class, and so are always skipped.

SCS, on the other hand, appears to think the ship has to be made first to be able to check its class, and so ends up making everything, spaceflies included. It does do some name checks for filtering out unwanted ships, so spaceflies could be added there. Though, now that I look at it, that name check (eg. "$tmp = find position of pattern 'Beacon' in $shp") wouldn't work on non-English versions, would it?

Back to top
View user's profile Send private message
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20512 on topic
Location: London
Thank you for registering your game
PostPosted: Sun, 24. Jun 18, 16:16    Post subject: Reply with quote Print

SirNukes wrote:

SCS, on the other hand, appears to think the ship has to be made first to be able to check its class, and so ends up making everything, spaceflies included. It does do some name checks for filtering out unwanted ships, so spaceflies could be added there. Though, now that I look at it, that name check (eg. "$tmp = find position of pattern 'Beacon' in $shp") wouldn't work on non-English versions, would it?


my guess on this is that SCS is an older script, and was probably made before the command to check a types class was added.

alot of older scripts suffer from problems like this where they have to use hacks or workarounds due to the available commands not doing the job.

The cheats scripts is full of them as it was made before alot of the commands in TC were added (was made well before the release of TC).

the create ship command does have special handling of spaceflies where a swarm is automatically created, but only the "leader" is returned. And as there is no way to get spaceflies then the script cant destruct them


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SirNukes





Joined: 31 Mar 2007
Posts: 147 on topic

Thank you for registering your game
PostPosted: Sun, 24. Jun 18, 19:36    Post subject: Reply with quote Print

Cycrow wrote:
my guess on this is that SCS is an older script, and was probably made before the command to check a types class was added.

Ah, thanks for pointing that out. My apologies for throwing some shade on these older scripts.

Back to top
View user's profile Send private message
Nightmare86



MEDALMEDALMEDAL

Joined: 24 Nov 2006
Posts: 113 on topic
Location: Auf dem Mond, Krater NRW
Thank you for registering your game
PostPosted: Sun, 24. Jun 18, 20:47    Post subject: Reply with quote Print

Hello Guys,

unfortunately, I can not contribute to the help from too little experience, but I am very happy to see and follow with the fact that here known and experienced people deal with the problem, even if Egosoft itself gives no officially answer to it. I just want to say thank you for working on a solution for that problem! Thumb up Thumb up Thumb up Smile


_________________

Plotübersicht EMC4AP | MK3-Profitansicht "Wenn jeder nach seinen Möglichkeiten mit anpackt, können wir zusammen Großes schaffen Thumb up Smile"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page Previous  1, 2, 3
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Sat, 21. Jul 18, 09:40

All times are GMT + 2 Hours

[ Disclaimer / Impressum ] | [ Privacy Policy / Datenschutz ]

Board Security

Copyright © EGOSOFT 1989-2018
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.08681 seconds, sql queries = 21