[MOD] Sensible Miners. Better asteroid selection.

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

[MOD] Sensible Miners. Better asteroid selection.

Post by cicero111 »

Sensible Miners mod
=============
Last updated: 07.11.14

Installation:
Subscribe on steam workshop

What it does:
It changes the asetroid selection logic to the L/XL mining ships to a more "logistically sensible" fashion. No more leaving the small pieces behind.

How does it work:
First some context. The vanilla script always selects the largest asteroid within 3KM as next main target. If none are found, pick a random asteroid within 75KM, If none are found there -> move in a random direction...

Anywho, this mod does this:
Short range scan (1KM), find smallest asteroid. (Mainly to avoid wandering too far off)
Medium range scan (3KM), find smallest asteroid.
Long range scan (75KM), find closest asteroid.
Long long range scan (150KM), find closest asteroid.
Over that -> give up and move in a random direction...

Tested with M ships as well but did not make much difference - vanilla has them searching for smallest asteroid + if fleets of small miners are in the same zone all that rangechecking can make some lagspikes.

Tested (my patience) with a Fedheim and with a Scaldis - the latter worked as planned, the first one... Someone should really mod a couple of extra mining turrets on that thing, if not already done :)
Edit: eBaracuda had made a fix :) Nexus link

Savegame safe?
Probably, the mod do not touch or move any blocking parts in the script.
Would not recommend removing the mod on a save with an active miner in the same zone as the skunk though.

Mod compatibility:
The mod patches the in-sector part of mining.ship.collect.xml, and more specifically the node that handles asteroid selection for L/XL ships. Other mods touching that file could cause trouble (i.e. most mining type mods probably).

Todo:
Thinking about removing the move random completely - it's just annoying to discover the thing is clueless after been following it for a while.
Having the captain do some complaining would be better.

swatti - thanx for giving me a push. Something like this you were looking for?

Feedback and ideas would be most appreciated :)

Released under WTFPL, so please feel free to hack, extend or bundle the thing if you want. For convenience here are an unpackaged version:
https://dl.dropboxusercontent.com/u/652 ... r_v2.5.zip
https://dl.dropboxusercontent.com/u/652 ... r_v3.0.zip
Last edited by cicero111 on Fri, 14. Nov 14, 01:15, edited 9 times in total.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Whups, a small error in the OP title, can a mod change to better asteroid selection? Is only what it does really :)
JESS 246
Posts: 574
Joined: Mon, 3. Jul 06, 03:24
x3

Post by JESS 246 »

Hi cicero111

You said something about more turrets on a Fedhelm well someone did try this mod Project Fedhelm on the Nexus site link below.

http://www.nexusmods.com/xrebirth/mods/420/?

i'll give your mod a try.
User avatar
Sandalpocalypse
Posts: 4447
Joined: Tue, 2. Dec 03, 22:28
x4

Post by Sandalpocalypse »

do M miners use it at all?
Irrational factors are clearly at work.
bm01
Posts: 421
Joined: Wed, 22. Jul 09, 22:31
x4

Post by bm01 »

cicero111 wrote:Whups, a small error in the OP title, can a mod change to better asteroid selection? Is only what it does really :)
You should be able to edit the title, I often do it :p
wwdragon
Posts: 3759
Joined: Mon, 1. Oct 07, 02:18
x4

Post by wwdragon »

Nice mod. :)
Editing posts since long before I remember.
Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp »

Good stuff.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

@JESS 246
Thanks for the tip :) I'll test it out - haven't done much "manual mining" before, but seeing that Fedhelm move like a confused whale rolling around that asteroid made me laugh (and curse after a while I must admit :) )

@Sandalpocalypse
Nope, not yet, but is quick to add - I'll do that in the next version :) A lot of code duplication in the vanilla code, so only a quick copy/paste almost.

@bm01
lol... I'm blind it seems. Title fixed, thanks :)

@wwdragon/Sparky
Thanks :)


Just give me a hint if something should be adjusted or added and I'll look in to it.
StormMagi
Posts: 1335
Joined: Sat, 17. Mar 07, 03:53
x4

Post by StormMagi »

Can you UL it to Steam and/or Nexus?
MOD XR Show Skills

Flying spaceships since 1993.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Yup, will put it up on steam WS atleast. Have the code cleanup done + support for for M ships done. Just need to find some time to retest that everything still works - hope to have it verified and up on steam this evening unless some IRL stuff gets in the way.
swatti
Posts: 1278
Joined: Sun, 7. Dec 03, 12:03
x4

Re: [MOD] Sensible Miners. Better asteroid selection.

Post by swatti »

cicero111 wrote: ....

swatti - thanx for giving me a push. Something like this you were looking for?

....
Spot on! Huge thx!

While "Project Fedhelm" is a vast improvement, the poor tub needs needs one turret in FRONT, one on each side, top and bottom.

Also if there is some way to make sure the turrets shoot at separate targets, that could work wonders.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Thanks :)

Mod uploaded to steam WS. Changes from alpha are just some code cleanup and disabled output to debug log.

Have updated OP when it comes to M ships aswell, dropped including those to avoid risking lagspikes and such. First time I have tested mining with those, and vanilla is working OK there I think.
User avatar
werewolves?
Posts: 1166
Joined: Tue, 31. Jan 12, 00:58
x4

Post by werewolves? »

Will this affect Yorrick's trader mod (that includes miners) or will they live happily together?
User avatar
YorrickVander
Posts: 2767
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

They will live happily together but will not currently affect YAT miners as they run on a custom script using only ooz ai. However with cicero111's permission I'd like to add this code to YAT (taking responsibility of course for updating YAT when cicero releases new versions).
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
denison10
Posts: 27
Joined: Sun, 12. Oct 14, 01:57

Post by denison10 »

problems does !





["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Evaluated component 0x5627a does not exist any more\
* Expression: $target",
["timestamp"]=1415237757.000000,},
[16.000000]={
["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Property lookup failed: $target.position\
* $target == component.{0x5627aL} (invalid)\
* Expression: $target.position",
["timestamp"]=1415237757.000000,},
[17.000000]={
["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Evaluated component 0x69cec does not exist any more\
* Expression: $target",
["timestamp"]=1415237935.000000,},
[18.000000]={
["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Property lookup failed: $target.position\
* $target == component.{0x69cecL} (invalid)\
* Expression: $target.position",
["timestamp"]=1415237935.000000,},
[19.000000]={
["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Evaluated component 0x810f79 does not exist any more\
* Expression: $target",
["timestamp"]=1415238350.000000,},
[20.000000]={
["gamestart"]=1.000000,
["message"]="Error: Error in AI script mining.ship.collect on entity 0xa857: Property lookup failed: $target.position\
* $target == component.{0x810f79L} (invalid)\
* Expression: $target.position",
["timestamp"]=1415238350.000000,},
:evil:
Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp »

denison10 wrote:problems does !
:evil:
Is something going wrong in-game? I've no idea if this is the case here or not but it is sometimes the case that error messages are harmless.

YorrickVander wrote:However with cicero111's permission I'd like to add this code to YAT (taking responsibility of course for updating YAT when cicero releases new versions).
I think the bottom of the OP covers this nicely :)
Wana
Posts: 274
Joined: Sun, 27. Jun 10, 15:46
x3ap

Post by Wana »

hello, it's very nice to see sequana using dual lazers on tiny roids while in sector.

but i had to deativate this mod because it doesn't seem to work when i put them under a station manager. they do not use lazer, only mining drone (if there are gatherable tiny roids for drone.

could you take a look into it?

great mod btw.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

@YorrickVander
Love the YAT mod - I've been reading up on the AI/MD code in there. Having some code snippets of mine included would be an honor :)

@denison10
Thank you for the bug report :) The line where i use the $target.position expression is copy/paste vanilla code, but it might get confused with my long long range ting perhaps. Do you have a tip how to reproduce this error? (zone + ca position the ship should be in would be very helpful).

@Wana
Had not noticed station controlled miners behaved in that way. Took a quick peek in mining.ship.station.xml, and I see it does fire off the mining.ship.collect script from there. I'll look into why it don't work properly when the order is initiated by a manager - thanks for the bug report :)
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

@denison10
Found the bug methinks :) Updated on steam, only change:
<do_if value="$target"> changed to <do_if value="$target.exists">

@Wana
Found this is was partly reproducible and is a vanilla bug I believe.
If you are in the same sector as the station miner when it goes from offloading to mining (or if you travel with the miner) it will not start the mining.ship.collect script and just move random - did not see it eject drones in my tests though, but happened both with and without the mod.

There are no in-sector handling in the mining.ship.station code to start the process it seems - leave the zone and come back and those lazors should be shooting.

Could you do a quick test at your end to see if it does the same?

Edit: And yeah - almost forgot. Added a 3.0 compatible version in the bottom of the OP, just a xpath change. Will do the multiversion steam thing too, but will wait till i've got that move random change in my todo implemented.

Return to “X Rebirth - Scripts and Modding”