Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 404 405 [406] 407 408 ... 710

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1720680 times)

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6075 on: February 11, 2020, 03:14:38 PM »

Is there some AI override for the DRONE_LAUNCHER shipsystem? It's completely closed source and the DroneLauncherShipSystemAPI has no functionality for moving drones around (or other states like my post in the API suggestions thread). The image shows what I'm talking about, the drones are snapped every frame with the code below. The actual snapTo vector is just a point on circumference with a desired angle. As far as I can tell, the shipsystem script is trying to pull the drones back to their target location as defined in JSON. Free roam being on or off does not effect this.


Spoiler
    private void snapTo(
            ShipAPI target,
            float magnitude, //==1f
            ShipAPI drone,
            Vector2f targetPosition
    ) {
        if (null == target) {
            return;
        }

        magnitude = MathUtils.clamp(magnitude, 0F, 1F);

        Vector2f locationDelta = Vector2f.sub(targetPosition, drone.getLocation(), new Vector2f());
        Vector2f velocityDelta = Vector2f.sub(target.getVelocity(), drone.getVelocity(), new Vector2f());
        float facingDelta = target.getFacing() - drone.getFacing();
        float angularVelocityDelta = target.getAngularVelocity() - drone.getAngularVelocity();

        drone.getLocation().x += locationDelta.x * magnitude;
        drone.getLocation().y += locationDelta.y * magnitude;
        drone.getVelocity().x += velocityDelta.x * magnitude;
        drone.getVelocity().y += velocityDelta.y * magnitude;
        drone.setFacing(drone.getFacing() + facingDelta * magnitude);
        drone.setAngularVelocity(drone.getAngularVelocity() + angularVelocityDelta * magnitude);
    }
[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6076 on: February 11, 2020, 03:20:42 PM »

IIRC it's the drone AI doing this, not the ship system AI, so you could get whatever behavior you wanted by providing a custom one for your drones via ModPlugin.pickDroneAI().
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6077 on: February 11, 2020, 03:25:54 PM »

IIRC it's the drone AI doing this, not the ship system AI, so you could get whatever behavior you wanted by providing a custom one for your drones via ModPlugin.pickDroneAI().
Oh fantastic, cheers  ;D
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6078 on: February 11, 2020, 03:42:51 PM »

Sorry to double post, but are there any considerations I need for the custom drone AI? Possible pitfalls, requirements etc. (Maybe even a peek at the source :DDD)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6079 on: February 11, 2020, 03:48:23 PM »

No peek at the source, I'm afraid! But: the main thing to watch out for is, if you want the drones to obey the "return to mothership" order, you'll need to call something like the ship.beginLanding() (the method name might be wrong) or similar.

And of course figuring out what to shoot at and so on, and making use of the various object buckets to do so efficiently (see: CombatEngineAPI.getMissileGrid() etc). It's definitely an undertaking, though out of the possibilities - ships, fighters, and drones - the drone AI is *by far* the easiest.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6080 on: February 13, 2020, 08:19:58 AM »

I'm back with a completely different, hopefully not stupid question.

I need to check if a star system is affected by a raid/pirate activity/inspection with the current fleet status.

There doesn't seem to be a flag or listener that tracks this, as far as I can see.
Is there a way to get that info?


Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6081 on: February 13, 2020, 08:35:14 AM »

Pirate activity: you can check the relevant market(s) for the condition.

Raid/inspection, hmm - I'd probably try to get intel of that class from Global.getSector().getIntelManager() and see if it's possible to tell from that.
Logged

kirlrik

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6082 on: February 13, 2020, 10:22:37 AM »

While troubleshooting, I found this thread about missing portraits caused by too many portrait packs.

Anyone have further insight on the portrait limit? I spent an inordinate amount of time putting together a unique, nicely themed set for every modded faction I use. Hovering around 2000 portraits and getting a lot of missing ones, including whole factions. I'm confident this is not a filepath issue or anything, sadly. Tried upping RAM from 4g to 8g, but it made no difference. I can disable a few hundred at a time and suss out the limit, but I wanted to ask here first on the off chance there's some miracle solution.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6083 on: February 13, 2020, 10:50:56 AM »

Hmm, I'm not aware of any such limit.

Are the "missing" portraits consistent? Are you able to reproduce this in vanilla + *just* a mod with the portraits and nothing else?

The game logs every texture that it loads (or, rather, after it loads one), so if you're able to identify which portraits aren't loading - which, if whole factions are affected, sounds doable - then you could check the log to see if it shows up there or not. The line would look like this:

15115 [Thread-3] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/portraits/portrait_hegemony15.png (using cast)

My initial guess would be that the portrait's png file is saved with the wrong settings (i.e. 8 bit or some such) and the game has trouble loading it, or something along these lines... though in that specific case, I think it'd actually error out on trying to load it.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6084 on: February 13, 2020, 11:12:23 AM »

IntelManager worked flawlessly, thank you!
Logged

kirlrik

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6085 on: February 13, 2020, 03:10:58 PM »

Thanks for the detailed response on the missing portrait issue. One of the completely blank factions (FDS) was not loading in the .log, whereas one with about 20% missing (pirate) was. I put the new portraits in the core graphics/portraits folder instead of the mod I created, and edited the original .faction files instead of using extra ones as you do for altering existing factions with other mods. Seems like that fixed it. I also tried portraits in core and keeping the extra .faction files, but that didn't work. I guess it comes down to the extra .faction file not being added to the original one properly for whatever reason. It'll be a pain to update, and not being able to share it is a shame (even though it's just a mashup of other portrait mods), but oh well.

I understand why a faction mod like FDS might have some typo or alternate structure/code/whatever that my non-modder brain can't recognize, but the pirate case is beyond me. Every portrait was loading in the .log, so the extra .faction was working, yet something was breaking them... but only a few... truly mysterious. I'm 99% sure there was no blunder with the names or .faction files since I stuck to templates, bulk renaming, and text replacing. The only explanation I can think of is that the core portraits take priority when it comes to this hypothetical limit, and all I've done is make others not load instead. I'll update when I get around to switching everything over.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6086 on: February 13, 2020, 03:33:51 PM »

Hmm, strange - if you can work up a minimal mod that reproduces this issue for a specific portrait, and tell me which portrait it doesn't work for, I'd be happy to take a look.
Logged

Wispborne

  • Captain
  • ****
  • Posts: 410
  • Discord: wispborne
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6087 on: February 13, 2020, 09:10:30 PM »

Would you entertain the notion of adding a render hook for the campaign map?

I personally don't know much about how difficult this would be to add, or how to utilize it, but my understanding is that it would allow MagicLib and GraphicsLib to adapt some of their effects for use on the campaign layer, which could be pretty awesome. The hyperjump mod comes to mind as one that could benefit, and (selfishly) having a warpy gate jump animation for my own mod.

Here's DarkRevenant's response on the subject when I asked whether it would be possible to use GraphicsLib on the campaign layer.
http://fractalsoftworks.com/forum/index.php?topic=10982.msg281656#msg281656
Logged
Mod: Persean Chronicles | Mod Manager: SMOL | Tool: VRAM Estimator | Tool: Forum+Discord Mod Database | If I'm inactive for 3 months, anyone can use any of my work for anything (except selling it or its derivatives).

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6088 on: February 14, 2020, 03:47:27 PM »

Honestly, it's not very likely. I'm not saying I won't ever do it, but it doesn't seem like the sort of thing I want to go messing with just now. Also: something similar may already be possible via a custom campaign entity, set to CampaignEngineLayers.TERRAIN_10 or .ABOVE. You'd effectively be able to render right under the UI since IIRC nothing uses TERRAIN_10.
Logged

Wispborne

  • Captain
  • ****
  • Posts: 410
  • Discord: wispborne
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6089 on: February 14, 2020, 03:54:30 PM »

Honestly, it's not very likely. I'm not saying I won't ever do it, but it doesn't seem like the sort of thing I want to go messing with just now. Also: something similar may already be possible via a custom campaign entity, set to CampaignEngineLayers.TERRAIN_10 or .ABOVE. You'd effectively be able to render right under the UI since IIRC nothing uses TERRAIN_10.

Thanks for the answer, I'll pass it along, since while I understand the idea of layers, most of the implications are beyond me :)
Logged
Mod: Persean Chronicles | Mod Manager: SMOL | Tool: VRAM Estimator | Tool: Forum+Discord Mod Database | If I'm inactive for 3 months, anyone can use any of my work for anything (except selling it or its derivatives).
Pages: 1 ... 404 405 [406] 407 408 ... 710