Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

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 - dmaiski

Pages: [1] 2 3
1
Bug Reports & Support / Spawn on asteroid
« on: October 27, 2014, 05:56:27 PM »
Spawn on asteroid battle bug is still a thing, 6000 damage at the start of battle instagibbed my poor wolf...

2
pretty much that :P

attacked by independent while being scanned by hegemony...

3
Modding / LeadVector
« on: May 08, 2014, 12:35:08 PM »
Derail Moved from
http://fractalsoftworks.com/forum/index.php?topic=7966.30

LeadVector
Code: java
    //find intercept between a missile and a target
    //adapted from code by Jens Seiler
    //http://jaran.de/goodbits/2011/07/17/calculating-an-intercept-course-to-a-target-with-constant-direction-and-velocity-in-a-2-dimensional-plane/
    //have fun if you want to actually understand what going on
    //basicaly gets where T will be by the time M gets to it
    public static Vector2f LeadVector(Vector2f TLoc, Vector2f TVel, Vector2f MLoc, Vector2f MVel)
    {
        //get missiles speed
        float MSpeed = (float)Math.sqrt(MVel.lengthSquared());

        //separate out the vectors
        float Tx = TLoc.getX();
        float Ty = TLoc.getY();
        float Mx = MLoc.getX();
        float My = MLoc.getY();

        float TVx = TVel.getX();
        float TVy = TVel.getY();

        //subtract position vectors
        float x1 = Tx - Mx;
        float y1 = Ty - My;

        //quadratic fun
        float h1 = TVx*TVx + TVy*TVy - MSpeed*MSpeed;
        if (h1==0)
        {
            h1= (float) .0001;
        }

        float minusMHalf = -(x1*TVx + y1*TVy)/h1;  // h2/h1

        float discriminant = minusMHalf * minusMHalf - (x1*x1 + y1*y1)/h1; // (h2/h1)^2-h3/h1 (ie D)

        //can they intersect?
        if (discriminant < 0)
        {
            return new Vector2f(0,0);
        }


        double root = Math.sqrt(discriminant);

        double t1 = minusMHalf + root;
        double t2 = minusMHalf - root;

        double tMin = Math.min(t1, t2);
        double tMax = Math.max(t1, t2);
        //which of the 2 is smaller
        double time = tMin > 0 ? tMin : tMax;

        //can return -ve time (this is less then useful)
        if (time < 0)
        {
            return new Vector2f(0,0);
        }

        //calculate vector
        return new Vector2f((float)(time * TVx), (float)(time * TVy));
    }

this is actualy designed to calculate the intercept of a bullet fired from point Mloc with Mvel speed, at target at Tloc with Tvel velocity
**fixed

for the purposes of this calculation even in cases such as missiles Mvel can be asumed to be the objects maximum speed, as long as object HAS a maximum speed, and IS allways accelerating


IF cases:
Spoiler
1) IF Tvel and Mvel are in the same direction: LeadPoint defaults to Tloc (the objects location)
2) IF Mvel is insufficiet to reach T: LeadPoint defaults to Tloc (the objects location)
3) IF Mvel is still accelerating: by a large this is irelevant as it will default to (2)
4) IF Tvel is changing(trying to djink): LeadPoint will produce the shortest intercept point every time (so as long as it is recalculated say 1/sec it will be on target)
5) IF chasing object has no maximum speed(or very high compared to acceleration): it will produce the best lead it can for its curent speed, not ideal, but accounting for this case is largely irrelevant (error will be insignificant, usualy a few extra % time above the "ideal" time to intercept)
[close]

4
Suggestions / why is it that in starsector Losing != FUN!
« on: May 07, 2014, 03:13:06 AM »
[pulls up soapbox]

we all know that in Dwarf Fortress(DF), FTL, and many similar games Losing == FUN!, now in my experience, and from watching others, it starsector(SS) lacks this property. Its symptom is save scumming battles till you win without losing any ships, and a repetitive end game.

to tackle a simpler problem i will discuss the end game first. In the end game, you invariably have a very large fleet, and this fleet is min/maxed to avoid losing ships, the main issue with this leeds on to the first symptom, losing your ships (by any means) does not feel good.

Now the question to ask is simple: "Why does losing ships in starsector not feel fun?"

Counterintuitively the simple answer of "because you lose a ship" is actually incorrect. In dwarf fortress(best example) when you lose your dwarfs, armies rampage through your fortress, or unfortunate accidents leave large parts of it uninhabitable, you still continue playing. You try to eek out an existence on what you have left, and aim for a glorious victory. (and remember DF is MUCH less forgiving than SS)

The more complex answer, and the one i believe to be correct, is "controll". In DF, FTL, and other games where losing == FUN!, you have control over everything that could result in "FUN!" so (in theory) you can prevent it, and when you inevitably lose, you feel that it was entirely your fault. interestingly this is essential to making losing fun, and what SS lacks.

In starsector when you lose, you can't with any confidence say that it was "your" fault that you lost, the causative agent of your loss are obviously AI, engine level problems (such as 1 speed after battle, ect...), and lack of any ability to "influence" the outcome of the battle.

now how do you fix this issue, and is it possible to fix?

the simplest way to do this would be to give the player more control, something like an RTS level command system (to replace "command points" which noone really uses)

the next layer would require variable AI's the ability to tell your ship "play defensively" or "play aggressively" would go a long way to remedy this issue

the final layer of this would be a more predictable AI (not "smarter")
An AI that will consistently do what you expect it to do is vital to making the player feel in "controll" of the action, it does not need to be particularly smart(most unit AI in RTS games are verry stupid), but it needs to be able to follow orders in a reliable manner.
(for example, currently if you tell the vanilla AI to retreat, and it is in combat, it wont... same thing for move orders, and may other actions)

these three changes would go a significant way to giving the player "control" in battle, and hopefully make the game more FUN!

[steps off soapbox]

TL:DR -- make losing FUN! and fix the command point issue

5
Modding / getVelocity().set() speed capped
« on: December 18, 2013, 06:32:16 PM »
getVelocity().set() is capped to 600 max speed(directionless)


picture of what should be a constantly accelerating asteroid using a beam effect
Spoiler
Code: java
                        Vector2f QVel = query.getVelocity();
                        engine.addFloatingText(QLoc, "Av-> "+QVel, 20f, Color.RED, beam.getSource(), 1f, .5f);
                        //towards line (not used)
                        Vector2f ToL = V2fPerpendicularDisc(dir, (Sadj < 100 ? Sadj : 100), (DtoL<0? 1:0));

                        //towards end (just adds 100 velocity each tick, 50 ticks/second)
                        Vector2f ToE = V2fReSize(dir, (Sadj < 100 ? Sadj : 100));

                        //adjust the velocity (velocity calculator)
                        Vector2f Qre = new Vector2f(QVel.getX()+ToE.getX()/*+ToL.getX()*/,
                                QVel.getY()+ToE.getY()/*+ToL.getY()*/);

                        //setting the velocity
                        QVel.set(Qre);

                        //also tested using
                        //QVel.set(QVel); //observed same 600 speed cap
[close]

screenshots using engine.addFloatingText to display actual object velocity vector
Spoiler

diagonal (works out to be 600speed)
[close]

6
Modding / spawnProjectile bug
« on: December 15, 2013, 04:34:57 AM »
Spoiler
Spoiler
missiles spawned with spawnProjectile do not get their AI consistently

to be specific it seems to have problems about 90% of the time

Code
        package data.scripts.MissileAI;


import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.*;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.combat.AIUtils;
import org.lwjgl.util.vector.Vector2f;

import java.awt.*;


import static jar.UtilityKit.getNearestMissileToPoint;


public class BalundirLightningAI implements MissileAIPlugin{

    private final MissileAPI missile;
    private ShipAPI launchingShip;

    private IntervalUtil MainTimer = new IntervalUtil(2f, 0.5f);
    private IntervalUtil ShortTimer = new IntervalUtil(.5f, 0.4f);
    private IntervalUtil LongTimer = new IntervalUtil(5f, 0.5f);

    private static boolean Fire=false;
    private static boolean Fire2=false;

    public BalundirLightningAI(MissileAPI missile, ShipAPI launchingShip)
    {
        this.missile = missile;
        this.launchingShip = launchingShip;
    }

    //main missile AI
    private Vector2f MouseT=new Vector2f(0,0);
    @Override
    public void advance(float amount)
    {
        CombatEngineAPI engine = Global.getCombatEngine();
        // pause when you are not needed
        if (missile.isFading() || missile.isFizzling() || engine.isPaused())
        {
            return;
        }



        if (MouseT.lengthSquared()==0)
        {
            MouseT = new Vector2f(launchingShip.getMouseTarget());
            if (MouseT.lengthSquared()==0)
            {
                missile.setSource(AIUtils.getNearestAlly(missile));
            }
        }

        ShortTimer.advance(amount);
        MainTimer.advance(amount);
        LongTimer.advance(amount);

        if (MainTimer.intervalElapsed())
        {
            Fire = true;
        }

        if (ShortTimer.intervalElapsed()){
            Fire2 = true;
        }

        if (Fire && Fire2) {
            Fire2=false;
            engine.spawnProjectile(
                    launchingShip,
                    null,
                    "targetdot",
                    MouseT,
                    0,
                    new Vector2f(0,0));

            MissileAPI target = getNearestMissileToPoint(MouseT);

            engine.spawnEmpArc(
                    launchingShip,
                    missile.getLocation(),
                    target, target,
                    DamageType.ENERGY,
                    0f, //real
                    0,   //emp
                    10000f, // max range
                    "tachyon_lance_emp_impact",
                    5f, // thickness
                    new Color(255,10,15,255),
                    new Color(31, 214,255,255)
            );
        }

        if (LongTimer.intervalElapsed()) {
            engine.removeEntity(missile);    }
    }
}

[close]

curently trying to track down what exactly is causing the problem

it seems that very often they fail to get missile.getSource

ok after the first missile is launched(after startup) subsequent missiles become unable to getSource,
spawnProjectile also breaks(this happens on the first run through when the rest of the AI is working corectly, spawnEmpArk works fine in this case)

final test from tonight:
exiting combat(general): causes missileAI to become unable to call missile.getSource or use launchingShip from when the ai is set
spawnProjectile missiles: unable to use spawnProjectile commands on ocasions (related to above issue)

note: this has not caused any null exceptions to date, there is a chance that this happend because the ShipAPI from the previous instance has not been cleared

no the ai itself activates fine, its just parts of the ai like ShipAPI launchingship that encounter problems that souldnt really happen also i need to move this top bug reports, wrote it at 5am today :P

So just set the source as the closest friendly ShipAPI?

Also, you can set the AI directly after it's spawned, instead of hoping that it's caught when the MissileAPI is instantiated via the Plugin :)

im not actualy sure what is going on with this case, but something is broken (error seems to be related to spwanProjectile but im not sure what is cause)

postid this thread in sugestions by accident
[close]
fixed/bugfound, getSource does not work properly on spawnProjectile objects: using launchingship seems to be more much more consistent

7
Suggestions / spawnProjectile bug
« on: December 14, 2013, 05:26:34 PM »
Spoiler
missiles spawned with spawnProjectile do not get their AI consistently

to be specific it seems to have problems about 90% of the time

Code
            engine.spawnProjectile(
                    weapon.getShip(),
                    weapon,                            //who made you
                    "SM_SCbombard",                      //spawn the projectile
                    new Vector2f(WL.getX()+5, WL.getY()+5),                            //Vector2f firing origin point
                    weapon.getArcFacing()+weapon.getShip().getFacing(),                            //float angle of fire
                    weapon.getShip().getVelocity()
            );
code spawning the missile

same missile sucsessfully runs when launched using normal weapon from ship

code of the AI, its a simple one 92 lines...
Spoiler
Code: java
package data.scripts.MissileAI;


import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.*;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lwjgl.util.vector.Vector2f;

import java.awt.*;


import static jar.UtilityKit.getNearestMissileToPoint;


public class BalundirLightningAI implements MissileAIPlugin{
    
    private final MissileAPI missile;
    private static CombatEngineAPI engine = Global.getCombatEngine();

    private static ShipAPI MSource=null;
    private static WeaponAPI MWeapon=null;

    private IntervalUtil MainTimer = new IntervalUtil(2f, 0.5f);
    private IntervalUtil ShortTimer = new IntervalUtil(.5f, 0.4f);
    private IntervalUtil LongTimer = new IntervalUtil(5f, 0.5f);

    private static boolean Fire=false;

    public BalundirLightningAI(MissileAPI missile)
    {
        this.missile = missile;
        MSource=missile.getSource();
        MWeapon=missile.getWeapon();
    }

    //main missile AI
    private Vector2f MouseT=new Vector2f(0,0);
    @Override
    public void advance(float amount)
    {
        // pause when you are not needed
        if (missile.isFading() || missile.isFizzling() || engine.isPaused())
        {
            return;
        }

        if (MouseT.lengthSquared()==0)
        {
            MouseT = new Vector2f(missile.getSource().getMouseTarget());
        }

        ShortTimer.advance(amount);
        MainTimer.advance(amount);
        LongTimer.advance(amount);

        if (MainTimer.intervalElapsed())
        {
            Fire = true;
        }

        if (Fire && ShortTimer.intervalElapsed()) {
            engine.spawnProjectile(
                    MSource,
                    MWeapon,
                    "targetdot",
                    MouseT,
                    0,
                    new Vector2f(0,0));

            MissileAPI target = getNearestMissileToPoint(MouseT);

            engine.spawnEmpArc(
                    MSource,
                    missile.getLocation(),
                    target, target,
                    DamageType.ENERGY,
                    0f, //real
                    0,   //emp
                    10000f, // max range
                    "tachyon_lance_emp_impact",
                    5f, // thickness
                    new Color(255,10,15,255),
                    new Color(31, 214,255,255)


            );
        }

        if (LongTimer.intervalElapsed()) {
            engine.removeEntity(missile);    }
    }
}

[close]

curently trying to track down what exactly is causing the problem

it seems that very often they fail to get missile.getSource

ok after the first missile is launched(after startup) subsequent missiles become unable to getSource,
spawnProjectile also breaks(this happens on the first run through when the rest of the AI is working corectly, spawnEmpArk works fine in this case)

final test from tonight:
exiting combat(general): causes missileAI to become unable to call missile.getSource or use launchingShip from when the ai is set
spawnProjectile missiles: unable to use spawnProjectile commands on ocasions (related to above issue)

note: this has not caused any null exceptions to date, there is a chance that this happend because the ShipAPI from the previous instance has not been cleared
[close]
fixed/bugfound, getSource does not work properly on spawnProjectile objects: using launchingship seems to be more much more consistent

8
Modding / Ship master AI scripting
« on: December 12, 2013, 08:10:17 PM »
I have been considering and I would like to try my hand at improving it up to a level at wich it is actualy as smart if not smarter then the avarage human player.
Thus it has come to a demand

IMPART!!

for need I have to see the curent code lest I miss out bits it already has...

also no idea where that code is atm and i don't think making a chess master enemy AI using EvryFrameCombat would work well

9
Suggestions / ProjectileAI
« on: November 28, 2013, 11:13:51 AM »
this is something for modders, can you make it posible to redefine a MissileAI as projectile for targeting purposes (so PD dose not shoot it)

or make a new AI sctipt called ProjectileAI wich allows scripts to be attached to projectiles without the "fun" of using everyframecombatplugins because they cause more lag in large battles

10
Bug Reports & Support / Bug Small shield radius
« on: November 21, 2013, 05:22:24 PM »
when:
shield radius<colision radius
colision radius=shield radius
so the ship becomes a non coliding ghost
fix it!!!

11
Modding / The Armor dilemma
« on: November 09, 2013, 07:24:23 AM »


i have been fiddling around with armor, this is what i discovered:

an explenation of picture above(in order left to right):
150: the real number of armor cells that ship has
using
Code: java
int maxX = armorgrid.getLeftOf()+armorgrid.getRightOf();
                int maxY = armorgrid.getAbove()+armorgrid.getBelow();
                int counter = 0;
                for (int X=0; X<maxX; X++)
                {
                    for (int Y=0; Y<maxY; Y++)
                    {
                        counter++;}}

14.999... the number of armor cells that ship has acording to (constant)
armorgrid.getArmorRating()/armorgrid.getMaxArmorInCell();

750 armorgrid.getArmorRating()
7500 sum of the armor each cell has
50 armorgrid.getMaxArmorInCell()  this is a real value(oddly enough) and shows the max armor a single cell can have (150 cells)
corresponds to damage the cells can take

these values change between ships (above are apogee specific)


oddesy


paragon


sunderer


what known:
armorrating/15= MaxCell
each cell has MaxCell HP
1 cell hp can absorb 1 damage


can someone explain why this is so?
it makes sense not!

the paragon has 18x its armor rating in armor        capital
the odesy has only 11x its armor rating                cruiser
apoge 10x                                                       cruiser
sunderer 10x                                                   destroyer

what kind of relation dose armor rating have to actual armor

what dose cell number have to do with ect

what is the point ofarmor rating anyways, it seems to have no actual relation to armor

12
Modding / an intresting crash!
« on: November 09, 2013, 04:23:43 AM »
Spoiler
68156 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.IllegalArgumentException: Color parameter outside of expected range: Green
java.lang.IllegalArgumentException: Color parameter outside of expected range: Green
   at java.awt.Color.testColorValueRange(Color.java:298)
   at java.awt.Color.<init>(Color.java:382)
   at com.fs.starfarer.D.OoOO.?0000(Unknown Source)
   at com.fs.starfarer.D.OoOO.?0000(Unknown Source)
   at com.fs.starfarer.D.new.class.renderImpl(Unknown Source)
   at com.fs.starfarer.ui.O.render(Unknown Source)
   at com.fs.starfarer.ui.oOo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.renderImpl(Unknown Source)
   at com.fs.starfarer.ui.O.render(Unknown Source)
   at com.fs.starfarer.combat.F.????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$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:619)
[close]

this was caused be a  pilum lrp hitting an experimental regenerative armor script ship i was playing around with
my best guess is that armor recovered to 101% and this resulted in the colour the armor is set to display going to 256++ green value
it culd also be the colour the  pilum lrp explosion is set to display or something similar (my script dose not even use colours, so i think its an external bug)

ill ph alex the code i used to cause crash

you need to put in a limiter in there saying (colour>0 ? colour:0)

is repreducable on a paragon

small damage (damage less then 100%of the armor black) dose not cause crash

found cause -ve armor values making the color less then 0...

13
Modding / .getProjectileSpeed()
« on: November 04, 2013, 04:21:51 PM »
nm im a noob...
Spoiler
set to give projectile speed in arbitary units
game uses completely different units in combat for length measurements.... (in combat)
getProjectileSpeed() is uterly usless... (for anything to do with coding)
 :'( :'( :'(

how many times its multiplied... (~350)
Spoiler
[close]
[close]

14
General Discussion / Late for haloween, but i present the ghost ship!
« on: November 01, 2013, 04:05:08 PM »

wOOooooOOOoooOOOooooo!!!!

15
Discussions / silly pictures thread!
« on: October 26, 2013, 11:09:25 AM »
you know what this off topic forum needs?
an off topic picture thread(and a cat thread)

so to start us off

lol talk about extreme dieting... harakiri with a carot?


some basic rules, big pictures in spoiler tags, 50mb/page do not want

Pages: [1] 2 3