Fractal Softworks Forum

Please login or register.

Login with username, password and session length

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.

Topics - Zaphide

Pages: [1] 2
1
Hi!

Just been mucking around with skins a bit to see what can and cannot be done with them.

I was trying to see if I could add/remove fighter bays (among other things) via a skin but couldn't work it out trying obvious things and I couldn't find any doco anywhere about what actually is possible with a skin file. So, I peeked inside starfarer_obf.jar and looked up how the skins are loaded (ShipHullSpecLoader I believe, via 2 methods (as far as I can work out), one which loads the initial hull via hull spec, and then another which applies the skin on a clone of the base hullSpec).

But the interesting thing is that there is actually a check for "fighterBays" but I don't think it is working as intended:
(I believe var1 is the skinSpec, var4 is the cloned hullSpec)
Quote
if (var1.has("fighterBays")) {
    var4.setFleetPoints(var1.getInt("fighterBays"));
}

So, unless I have this wrong, "fighterBays" is actually a valid property of the skin JSON but if it is set it will actually set the fleet points to this value?

2
Modding / How to use CombatTaskManagerAPI.giveAssignment?
« on: January 22, 2016, 08:40:51 PM »
Does anyone have any info or examples on using fleet assignments in combat? At the moment I have this:
Code
// Get fleet manager for target ship
CombatFleetManagerAPI combatFleetManagerAPI = Global.getCombatEngine().getFleetManager(ship.getOwner());

// Create a light escort order on target ship
CombatFleetManagerAPI.AssignmentInfo assignmentInfo = combatFleetManagerAPI.getTaskManager(true).createAssignment(CombatAssignmentType.LIGHT_ESCORT, (AssignmentTargetAPI)this.getDeployedFleetMemberAPI(ship), false);

// Assign other ship to the light escort order
combatFleetManagerAPI.getTaskManager(true).giveAssignment(this.getDeployedFleetMemberAPI(otherShip), this.assignmentInfo, false);

But it doesn't seem to work (the LIGHT_ESCORT assignment doesn't appear to be created nor is it followed by otherShip).

Also tried testing with this:
Code
// Create waypoint for assignment
AssignmentTargetAPI assignmentTargetAPI = combatFleetManagerAPI.createWaypoint(ship.getLocation(), false);

// Create assignment
CombatFleetManagerAPI.AssignmentInfo assignmentInfo = combatFleetManagerAPI.getTaskManager(true).createAssignment(CombatAssignmentType.DEFEND, assignmentTargetAPI, false);
           
// Assign other ship to assignment
combatFleetManagerAPI.getTaskManager(true).giveAssignment(this.getDeployedFleetMemberAPI(otherShip), assignmentInfo, false);

In this case, the waypoint is created (I can see it in the tactical map) but it does not get the DEFEND assignment and then the otherShip does not get the defend order.

Am I missing a step somewhere? :)

3
I'm using an OnHitEffectPlugin on a missile, some code for the onHit method as follows:
Code
Global.getLogger(this.getClass()).info("hit");

if (target instanceof MissileAPI) {
            Global.getLogger(this.getClass()).info("hit missile");
}

So, the onHit method runs fine when a ship is hit by my missile, but when another missile is hit by my missile the OnHitEffectPlugin.onHit method isn't even run (tested hitting Pilum missiles), as in it doesn't even print "hit" to the log, let alone "hit missile". Is there a way to get the onHit code to run when another missile is hit?

Also, when my missile hits a Pilum missile it destroys it (perhaps this is why the onHit method isn't run?) even though I have set the damage of the missile to 0. Is there a way to get around this behaviour as well?

My assumption was that the OnHitEffectPlugin.onHit would run prior to the damage calculation, is this the case?

(questions questions questions :) )

4
Disclaimer: I am probably doing it wrong :)

I have the following to directly spawn a wing in combat (within advance() of a EveryFrameWeaponEffectPlugin):
Code
ShipAPI spawnedWing = engine.getFleetManager(FleetSide.PLAYER).spawnShipOrWing(WING_ID_TO_SPAWN, weapon.getShip.getLocation(), weapon.getShip().getFacing());

I then can happily do <stuff> to a specific wing member:
Code
spawnedWing.getWing().getWingMembers().get(1).getLocation().set(weapon.getShip.getLocation().getX() + 50, weapon.getShip.getLocation().getY() + 50);

But when I try this:
Code
engine.removeEntity(spawnedWing.getWing().getWingMembers().get(1));

this happens:
Code
80064 [Thread-5] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.renderers.damage.String.??00(Unknown Source)
at com.fs.starfarer.combat.entities.Ship.cleanup(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.new(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.executeRemoves(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Have I not set something up properly? Given the stack trace, it looks like it is trying to display some damage but doesn't know what to display? Note in the same script I am directly removing projectiles in the same fashion, which works fine.

Any help would be greatly appreciated :)

5
This is probably just user error :P (and low priority)

I'm not sure if something changed around setRespawnLocation, but I used to (0.6.1) do this in my SectorGen code:
Code
sector.setRespawnLocation(system);
sector.getRespawnCoordinates().set(-2500, -3500);
sector.setCurrentLocation(system);

And then in an EveryFrameScript I move the players fleet to the edge of the respawn system in the first frame of the game (as the players fleet doesn't seem to exist at SectorGeneration):
Code
sector.setCurrentLocation(sector.getRespawnLocation());
SectorEntityToken token = ExerelinUtils.getRandomOffMapPoint(Global.getSector().getPlayerFleet().getContainingLocation());
sector.getPlayerFleet().setLocation(token.getLocation().getX(), token.getLocation().getY());

However, although I have verified that I'm correctly passing the a correct and valid star system to setRespawnLocation, the player's fleet now (0.6.2) starts in hyperspace. Then, when they translate into system via a wormhole, the viewing screen or map doesn't show the player fleet (this can be rectified by moving the invisible fleet to a wormhole and traveling). The frame rate also plummets.

I have tried all sorts of things, but no matter what I try the player's fleet always seems to spawn at 0,0 in hyperspace. I'm just wondering what has changed here between 0.6.1 and 0.6.2? :)

6
Bug Reports & Support / Memory usage on background image load
« on: October 22, 2013, 01:19:22 PM »
Hi,

I've been adding custom background images to new systems and have noticed the following:
Code
29965216 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/backgrounds/background1.jpg into existing tex id 318
 29965782 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 706.67 MB of texture data so far
 29965787 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/backgrounds/background1.jpg (using cast)
30016785 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/exerelin/backgrounds/purple_background1.jpg into existing tex id 318
 30017686 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 718.67 MB of texture data so far
 30017692 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/exerelin/backgrounds/purple_background1.jpg (using cast)
 30048212 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/exerelin/backgrounds/blue_background1.jpg into existing tex id 318
 30048756 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 730.67 MB of texture data so far
 30048762 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/exerelin/backgrounds/blue_background1.jpg (using cast)
 30095163 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/backgrounds/background4.jpg into existing tex id 318
 30095697 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 742.67 MB of texture data so far
 30095701 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/backgrounds/background4.jpg (using cast)
30138179 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/exerelin/backgrounds/blue_background1.jpg into existing tex id 318
 30138748 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 754.67 MB of texture data so far
 30138753 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/exerelin/backgrounds/blue_background1.jpg (using cast)
 30172769 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/backgrounds/background4.jpg into existing tex id 318
 30173298 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 766.67 MB of texture data so far
 30173303 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/backgrounds/background4.jpg (using cast)
30211036 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/exerelin/backgrounds/blue_background1.jpg into existing tex id 318
 30211570 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 778.67 MB of texture data so far
 30211576 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/exerelin/backgrounds/blue_background1.jpg (using cast)
30247839 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/exerelin/backgrounds/purple_background1.jpg into existing tex id 318
 30248678 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 790.67 MB of texture data so far
 30248682 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/exerelin/backgrounds/purple_background1.jpg (using cast)
 30276655 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loading image graphics/backgrounds/background1.jpg into existing tex id 318
 30277298 [Thread-9] DEBUG com.fs.graphics.TextureLoader  - Loaded 802.67 MB of texture data so far
 30277302 [Thread-9] INFO  com.fs.graphics.TextureLoader  - Cleaned buffer for texture graphics/backgrounds/background1.jpg (using cast)

As you can see it appears to be allocating additional chunks of 12MB for background images switching, and doesn't seem to free the previous lot.

None of the images I am using are remotely close to 12MB, and there are a couple of vanilla backgrounds loaded in that lot too which also cop the 12MB allocation.

Looking at the memory usage for StarSector, it was increasing every time the above background image changes occurred.

7
Modding / Save Game Compression + OutOfMemory causing save corruption?
« on: October 22, 2013, 02:13:29 AM »
Something I have noticed since turning save compression on by default in Exerelin is that I'm getting a lot of saves (sent in from other people) that when attempted to load say 'Premature end of file', and cannot be restored at all. Save files submitted from others before that I could load if I increased the memory limits on StarSector, and which could then be loaded successfully.

Pure conjecture from this point on :)

So, it seems to me that turning on save compression, combined with OutOfMemory errors (a problem with big mods/running many mods) or equivalent can result in a corrupt save. By leaving save compression off, the OutOfMemory problem seems to manifest on game load which, although annoying, can be rectified by increasing the memory constraints.

While having a smaller and faster loading file is good (and perhaps slightly less likely to hit an OutOfMemory error), I don't think it is worth the seemingly very real chance of causing corrupt saves.

Therefore, unless someone convinces me otherwise, I'm going to turn off save game compression by default in the next version of Exerelin and just see what happens. Load/save time is not really a concern and disk space is not a concern either. I would rather remove/limit the chance of unrecoverable saves.

8
The advance() method on a EveryFrameScript can run before the OnGameLoad method in ModPlugin, which I don't think should happen.

I could be doing something wrong, and the situation I'm in is only because I'm part way through cleaning up some stuff in Exerelin, but I figure that advance()'s shouldn't be triggering before OnGameLoad is run.

Interestingly, the game loads as paused so an EveryFrameScript shouldn't even run once?

ModPlugin:
Code
package data.scripts;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.Global;
import data.scripts.world.exerelin.ExerelinData;
import data.scripts.world.exerelin.SectorManager;

public class ExerelinModPlugin extends BaseModPlugin
{
    @Override
    public void beforeGameSave()
    {
        System.out.println("beforeGameSave");
        SectorManager.getCurrentSectorManager().getCommandQueue().executeAllCommands();
    }

    @Override
    public void onGameLoad()
    {
        System.out.println("onGameLoad");
        ExerelinData.resetInstance();
        ExerelinData.getInstance().setSectorManager((SectorManager)Global.getSector().getPersistentData().get("SectorManager"));
    }

    @Override
    public void onNewGame() {
        System.out.println("onNewGame");
        ExerelinData.resetInstance();
    }
}

EveryFrameScript:
Code
public class TimeManager implements EveryFrameScript
{
        .....


        .....

        @Override
         public boolean isDone()
         {
              return false;
         }

         @Override
         public boolean runWhilePaused()
         {
             return false;
         }

@Override
public void advance(float amount)
{
        if(ExerelinData.getInstance().getSectorManager() == null)
            return; //OnGameLoad doesn't seem to run before EveryFrameScript.advance()

        // Do any every frame checks that need to be performed
ExerelinData.getInstance().getSectorManager().doEveryFrameChecks();
        ....

9
Bug Reports & Support / Fleet resupply seems to add fuel/supplies to station
« on: September 28, 2013, 02:57:50 PM »
Not sure if this is a bug, but if a fleet needs to resupply (i.e. they need to replenish supplies) they will head back to their PreferredResupplyToken and replenish supplies/fuel. So far, so good.

It appears though that they add fuel/supplies to that stations cargo. I am watching a fleet (that is 10 fighter wings, 1 freighter) go back again and again (due to those hungry fighters eating all the food!) to a station to resupply, and it keeps adding fuel/supplies to that stations cargo.

Maybe this is contributing to the overflowing fuel/supplies issues at some stations

EDIT: Also, once a station becomes overloaded it appears that fleets that try and resupply there do not actually resupply at all. I'm now watching a fleet that consists of a single freighter try to resupply (at a station that is overloaded with supplies/fuel) and they do not seem to actually gain any supplies (their CR rating is still 0).

10
Couldn't find this anywhere else yet so in case it hasn't been reported...

If your ship (i only had one) dies in combat or wins and the enemy is in retreat, pressing enter immediately after that condition is triggered will crash with the following:
Code
1289033 [Thread-8] ERROR com.fs.starfarer.combat.String  - java.lang.NullPointerException
 java.lang.NullPointerException
at com.fs.starfarer.combat.OOoO.?00000(Unknown Source)
at com.fs.starfarer.combat.OOoO.float.if$super(Unknown Source)
at com.fs.A.super.?00000(Unknown Source)
at com.fs.starfarer.combat.String.o00000(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:680)

Yes, I tested this in Vanilla StarSector as well :)

11
Something else I have noticed:
When playing with 8+ systems, AI fleets in systems other than the players system can cease to follow their assignments. Some systems are fine, others nothing happens.

I haven't really done any testing around it but have been able to reproduce reliably.

Note (in case it is specific to my setup):
I'm using MacOSX (SL), 4Gb, C2D 1.6 - MacBookAir so it's a gutless machine. I have StarSector's memory settings at 1024-2048. The game sits at approx 1.8Gb of memory used.

Mod in question:
https://bitbucket.org/Zaphide/exerelin/downloads/Exerelin_0.6.zip

Save with the issue:
https://bitbucket.org/Zaphide/exerelin/downloads/save_FINALTESTLARGE_1662927246241639082.zip
(just go through into that system, the fleet hasn't moved since that game started)

To replicate:
Just start a game with 24 systems, wait a while, then go visit a system that should have had changes (i.e. a AI faciton started there). Their original fleet will still be in it's starting spot.

12
Not sure if I'm doing this wrong but this is what is happening:
 - Create a fleet in one system
 - Setting it's assignment to ATTACK_LOCATION on a station in another system
 - Fleet correctly exits home system and travels to other system (which is great BTW, was expecting to write all this pathfinding code!)
 - However once in other system it travels off in a completely different direction (seems random, although if multiple fleets are sent they all follow the exact same line)
 - However, fleets sent with GO_TO_LOCATION correctly move towards the appropriate SectorEntityToken once in the destination system

The fleet still reads 'Attacking Station'.

If fleets need to resupply, they correctly head to the jump point and exit the system.

13
This might be me just 'doing it wrong' but I have been 'overriding' the core factions .faction files via the mod_info.json replace section.

Note: I do not actually need to do this to achieve what I wanted but I thought I would report the bug-like issue anyway.

e.g. In my mod I have:
data/world/hegemony.faction

e.g. In my mod_info.json I have:
Code
"replace":
[
    "data/world/factions/hegemony.faction",
],

This appears to have the unfortunate side effect of not allowing selection of portraits that are defined in those faction files at the new game creation.

14
Suggestions / Fleet stick to last object clicked in campaign map
« on: September 02, 2013, 07:57:15 PM »
(couldn't think of a better way to describe it...:P)

Currently in campaign map if you click on an Asteroid or Planet your fleet will follow that objects travel/orbit, attempting to remain dead centre of it. This also happens if you click on a fleet in your faction.

This is pretty handy but it doesn't work for stations or fleets that are not from your faction. The difference seems to be in the display of the interaction dialog.

I would like to see the players fleet continue to attempt to stay dead centre of the object even after the dialog is displayed and closed. I think this should be default, as you can easily click somewhere else if needed.

I think it is important for the next update with its addition of more/customisable dialog boxes.

15
Suggestions / Elliptical Orbits
« on: September 02, 2013, 07:35:52 PM »
Currently all orbits you can set (planets, asteroid belts and stations) are circular.

I think it would be great to able to define an elliptical orbit. It would be fun to have things on long orbits so they sometimes appear close in and other times you have to go searching (or wait) :)

Pages: [1] 2