Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  


Starsector 0.95.1a is out! (12/10/21); Blog post: The Pilgrim's Path (07/19/22)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Kiloman

Pages: [1] 2 3
Modding / Re: Custom Ship Turret Layout issues
« on: February 03, 2014, 11:30:40 PM »
This kind of sounds like a Windows AppCompat issue, it will shim files into all kinds of weird places if programs try to write data into the Program Files folder. Have you tried changing the mods folder location in the vmparams file and installing things there? I keep mine in a Drop box folder along with my saves to sync them across multiple machines and it works great.

Suggestions / Re: Enable caching of classes compiled by Janino
« on: October 28, 2013, 08:55:40 PM »
I have a desktop with SSD, and a laptop with a traditional spinning disk. I'll give them both a try and see where it's pausing. Could probably try launching the game off the media disk on the desktop too. Wonder if there's a good way to force files out of cache on Windows...

Suggestions / Enable caching of classes compiled by Janino
« on: October 27, 2013, 11:25:12 PM »
Some folks have noticed that the startup time (particularly with mods enabled) can be pretty lengthy. Have you considered providing a cache for compiled scripts for use with Janino's CachingJavaSourceClassLoader? Perhaps with a file size/modification time or other heuristic to selectively re-compile classes on demand?

I know, mod authors that have weighty code should probably just use a real IDE and compile their code into JARs instead of relying on Janino, but still - I'm curious what sort of difference it would make on startup time in general.

Mods / Re: [0.6.1a] Exerelin - Dynamic Sector and Faction War - v0.61
« on: October 18, 2013, 07:40:43 PM »
Just a quick note - it's actually using java's built-in compression (InflaterInputStream/DeflaterOutputStream). My using .zip for the extension is unfortunate, I should probably change that; used that when I was (briefly) under the mistaken impression that it was an actual zip. There's also some game-specific logic to optimize stuff, but that takes place before the xml file is fed into the compression stream. I actually wouldn't mind if it was using the zip format (would prefer it, really) but there doesn't seem to be a simple way to go about doing this.

Well if you upgraded the embedded JRE to Java 7 there is always's ZipInputStream/ZipOutputStream:

Edit: singlespace beat me to it. Also, it is available with Java 6.

General Discussion / Re: Passive/Distracted AI
« on: October 17, 2013, 10:32:53 PM »
I've seen this a good bit too - mostly of the 'flightiness' or getting distracted, but they do also seem to get in my way more than they used to.

The unnecessary backing off seems to happen the most with continuous beam (laser) weapons; the AI seems to hang right at the edge of firing range, and will sometimes even stand just out of range firing the beams but not hitting anything, or the autofire ai will fire weapons that can't actually hit. It's almost like they are counting on the extra bit of carryover range that you get from non-instantaneous weapons, or maybe they are just firing close enough to hit where the shield would be if it was up.

I could provide videos as well if that would help.

I mean I can't directly alter the variables in the class like className.variable = anothervariable; without using statics.

If I could, I would just get and save the persistent data on each load/save, and wouldn't bother doing it inside the scripts themselves.

No, you can't do className.variableName unless they are static, because if they're not static they're instance variables, as in, you create a new instance of the class and then modify their value on that object, usually with setter/getter methods.

Not sure if this is intentional or not, but it looks kind of like a copy-paste issue:

Code: java
		CrewCompositionAPI defenderCrew = member.getCrewComposition();
float defenderStr = defenderCrew.getGreen() * greenMult +
defenderCrew.getRegular() * regularMult +
defenderCrew.getVeteran() * veteranMult +
defenderCrew.getElite() * eliteMult +
defenderCrew.getMarines() * eliteMult;
defenderStr *= defenderMarineMult;

The defender marine count is multiplied by the elite multiplier, not the marine multiplier... so strength 2 instead of 7. Seems like it would pretty heavily favor the attacker.

Also - looks like the old alg for deployment cost is used to calculate the CR hit for boarding actions? Not sure if that's a bug either.

Modding / Fleet assignment behavior question for Alex
« on: October 13, 2013, 12:01:52 AM »
I've been poking at the fleet assignments, and wanted to confirm my understanding of their behavior. I set up a test using code like this:

Code: java
public class AssignmentCompletedScript implements Script {
    private CampaignFleetAPI fleet;
    private String comment;
    private Long creationTime;

    public AssignmentCompletedScript(CampaignFleetAPI fleet, String comment){
        this.fleet = fleet;
        this.comment = comment;
        this.creationTime = Global.getSector().getClock().getTimestamp();
    public void run() {
        CampaignFleetAI.FleetAssignmentData currentAssignment = ((CampaignFleet)fleet).getAI().getCurrentAssignment();
        Float daysSinceCreation = Global.getSector().getClock().getElapsedDaysSince(creationTime);
        System.out.println("Assignment '"+comment+
                "' completed after "+daysSinceCreation.toString()+
                " days; current assignment"+
                " "+currentAssignment.assignment.toString()+
                " ";

Somewhere else I do this:
Code: java
CampaignFleetAPI fleet = sector.createFleet("pirates", "raiders1");
location.spawnFleet(anchor, 1000, 1000, fleet);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION, anchor.getOrbit().getFocus(), 3, new AssignmentCompletedScript(fleet, "go to planet"));
fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, anchor, 6, new AssignmentCompletedScript(fleet, "defend station"));
fleet.addAssignment(FleetAssignment.RESUPPLY, anchor, 9, new AssignmentCompletedScript(fleet, "resupply"));
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, anchor, 12, new AssignmentCompletedScript(fleet, "despawn"));

Here's what I get in the log:
Assignment 'go to planet' completed after 0.77313656 days; current assignment DEFEND_LOCATION Tri-Tachyon Orbital Station
Assignment 'defend station' completed after 6.7509837 days; current assignment RESUPPLY Tri-Tachyon Orbital Station
Assignment 'resupply' completed after 7.0035534 days; current assignment GO_TO_LOCATION_AND_DESPAWN Tri-Tachyon Orbital Station
Assignment 'despawn' completed after 7.0035534 days; current assignment GO_TO_LOCATION_AND_DESPAWN Tri-Tachyon Orbital Station

I've been trying to figure out how the actual timing of the events corresponds to the durations I requested, and I think I understand it:
1. GO_TO_LOCATION completes when the fleet reaches the planet
2. DEFEND_LOCATION starts when GO_TO_LOCATION finishes
3. DEFEND_LOCATION finishes after running for just under 6 days, and RESUPPLY is activated.
4. RESUPPLY completes when the fleet reaches the station, and GO_TO_LOCATION_AND_DESPAWN is activated
5. GO_TO_LOCATION_AND_DESPAWN completes immediately, since the fleet is still at the station (hasn't moved since resupplying)

Based on that, it looks to me like the assignment system is a simple queue, and items are removed either when they've run for their requested duration, or the goal is achieved. It's unclear to me what happens, though, when a goal expires without being achieved - say the location can't be reached in time, or the target can't be attacked because it's too fast or ceased to exist before we could reach it. Other than checking if the fleet is where we expected it to be, or if the target is dead, etc, does the onCompleted callback have any way to tell if the assignment was successful or not?

On a somewhat unrelated note, what happens if we don't call setPreferredResupplyLocation on the fleet? In that case, are we responsible for telling it to resupply on its own (with a RESUPPLY assignment)? I've been trying to figure out how to work around the "resupplying fleets transfer cargo to the station and create new cargo out of thin air" issue, since it's somewhat unbalancing if you're trying to actually control resources.

It'd be nice if we had some sort of API for AI interaction with SectorEntityTokens that was similar to the battle autoresolver API and could handle the various goals (attack, resupply, despawn, transfer cargo x, etc) but absent that, the onCompleted callback gets us part of the way there, since we can just tell the fleet to move somewhere and then do what we really want in the callback. The mouseover tooltip loses some of its usefulness since everything will just say "going to x" but that's why we need a SectorEntityToken mouseover API too ;)

Mods / Re: [0.6.1a] Exerelin - Dynamic Sector and Faction War - v0.61
« on: October 11, 2013, 09:58:20 AM »
Thread safe would be great. At the moment, some of the messages are generated from other threads. Another option would be to use the CommandQueue to schedule messages to be run on the main thread only.

It should be pretty easy to provide a singleton logger class that passes messages through to the CampaignUI for display, but also stores them in a rolling (say 20 line or so) buffer that you could query and print from stations or somewhere else. Most of the core Java classes are thread-safe so that shouldn't be a problem.

It's too bad we can't stick something on the unused Officers or Outposts tab... or can we?

Inability to switch on an Enum is a limitation of Janino. It's mentioned in a few different places. The usual suggestion is to either use compiled code in a JAR file, or just use an IF statement. There are examples elsewhere, but in a nutshell it looks like this:

import com.fs.starfarer.api.combat.ShipAPI.*

if (entity instanceof ShipAPI){
HullSize size = ((ShipAPI)entity).getHullSpec().getHullSize();
if (size == HullSize.DESTROYER){
// do something for a destroyer
} else if (size == HullSize.FRIGATE){
// do something for a frigate

Note the getHullSpec before getHullSize, this is another thing you were missing... you can't just cast the hullSpec to a hullSize and expect it to work. You also don't need to use ValueOf, you can just specify the enum directly.

Hm.  Try ((ShipAPI)entity).getHullSize() - that should either work, or throw a class cast exception, or a null pointer exception.  I think.

the getHullSize method is actually from the ShipHullSpecAPI, so you want:

When in question, check the JavaDocs:

Two questions:

1: Is it possible to create and load a new description on the fly? Obviously I can create a new instance of the class, but doing so and then trying to set an object's customDescriptionId to use it doesn't work. It appears there's an internal cache somewhere that I need to register it with, but I don't see an interface to do that.

2: Given that we can read a SectorEntityToken's customDescriptionId, is there a way we can use that ID to get the Description object? Minus an API for dynamic description add/remove, it'd be nice to be able to change the text fields of a Description on the fly, even if we had to create a 'dummy' description for it in the CSV and switch it out at runtime.

Mods / Re: [0.6.1a] Exerelin - Dynamic Sector and Faction War - v0.61
« on: October 09, 2013, 12:41:24 AM »
Thanks :) I really appreciate the additions and fixes! (and the code clean up ;))

No problem, it's fun to have something to tinker with! I might take a look at some of the stuff on your to-do list too - is there anything in particular that you would like some help on? Maybe something that you're not working on at the moment, so we don't duplicate work...

Mods / Re: [0.6.1a] Exerelin - Dynamic Sector and Faction War - v0.61
« on: October 09, 2013, 12:06:37 AM »
I just sent a pull request; I tweaked some of the rebel fleet spawn code and I've been having quite a bit of fun with it in my play-testing.

I also found a bug... looks like a NPE when a faction is completely killed out of the game:

2725257 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.NullPointerException
at Source)
at com.fs.starfarer.campaign.fleet.CampaignFleet.advance(Unknown Source)
at com.fs.starfarer.campaign.BaseLocation.advance(Unknown Source)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
at com.fs.starfarer.campaign.A.super(Unknown Source)
at com.fs.starfarer.OoOO.????00(Unknown Source)
at com.fs.super.oOOO.?0000(Unknown Source)
at com.fs.starfarer.combat.String.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$ Source)

Probably send you a pull request for that too.

Mods / Re: [0.6.1a] Exerelin - Dynamic Sector and Faction War - v0.61
« on: October 07, 2013, 02:57:32 PM »
When fleets are 'hovering' over objects they are doing stuff; mining fleets will slowly fill/empty their available cargo, boarding fleets will send marines onto the station etc. I thought it was a bit unrealistic to have a fleet just touch an asteroid and then high tail it back to the station immediately :) The 'proceeding to station' text is just because there is no 'Mining'/'Unloading'/'Boarding' etc. options available, and there are some automatic actions associated with 'Resupplying', 'Delivering Resources' that I don't want to have happen.

The interesting thing about having them hover over it is that they can be chased off by invaders while in action - for example with the new rebels, my mining fleets will frequently be prevented from transferring supplies because they can't stay over the station long enough to unload.

While this does add some interesting dynamics, I wonder if you could just despawn the fleet while it is mining or unloading, and then respawn it later on a timer when it's 'done' with its activity?

Pages: [1] 2 3