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.

Messages - JWill

Pages: [1]
1
Mods / Re: Blackrock Drive Yards - v0.30
« on: September 16, 2013, 09:29:39 PM »
Mainly ship systems scripting.

Well, I did mess around a bunch with the Kurmuraja's ship system, so I could certainly take a look.

I'd love to take a look too, if you end up not working on this.  I've been itching to play with Starsector scripting for a while, and contributing to such a great mod would be awesome!

I've been working with java for several years now, so I could probably help with a ship systems script.

2
Mods / Re: [0.54.1a] Uomoz's Corvus 17: Allegiance (Factions Collection)
« on: February 28, 2013, 06:38:48 PM »
Thanks a lot for the massive amount of feedback, will try to answer everything.

Spoiler
BUG

So I've been trying to get a certain Gedune ship for a while.  But after sitting on their station for ages, only really small fleet types were spawning.  The only ones I saw were Scavengers, Scouts, and Raider.  But in /data/world/factions, there's three bigger fleet types: Liberators, Elites, and Seige Group.

After digging around a bit, I think I found the problem in /data/scripts/world/GeduneSpawnPoint.java:
Code
	@Override
protected CampaignFleetAPI spawnFleet() {
float r = (float) Math.random();
if (       (r -= .5f) < 0) {
return raidFleet("scout");
} else if ((r -= .4f) < 0) {
return raidFleet("longRangeScout");
} else if ((r -= .3f) < 0) {
return raidFleet("raiders");
} else if ((r -= .2f) < 0) {
return Math.random() > 0.3 ? raidFleet("libers"): defendFleet("libers");
} else if ((r -= .2f) < 0) {
         return l33tFleet(Math.random() > 0.1 ? raidFleet("elite"): defendFleet("elite"));
} else {
return Math.random() > 0.1 ? raidFleet("siege"): defendFleet("siege");
}
}

Looks like an oversight when adding new fleet types; the probabilities total more than 100%, so the top several are the only ones that ever get picked.

I think this should fix it; just chose some probabilities that summed to less than 1.0 (and the remaining 0.1 goes to the else for seige fleet type)
Code
	@Override
protected CampaignFleetAPI spawnFleet() {
float r = (float) Math.random();
if (       (r -= .3f) < 0) {
return raidFleet("scout");
} else if ((r -= .1f) < 0) {
return raidFleet("longRangeScout");
} else if ((r -= .2f) < 0) {
return raidFleet("raiders");
} else if ((r -= .2f) < 0) {
return Math.random() > 0.3 ? raidFleet("libers"): defendFleet("libers");
} else if ((r -= .1f) < 0) {
         return l33tFleet(Math.random() > 0.1 ? raidFleet("elite"): defendFleet("elite"));
} else {
return Math.random() > 0.1 ? raidFleet("siege"): defendFleet("siege");
}
}
[close]

The probabilities aren't actually more then 100%, it's just that more then 1 fleet can happen in the r -= .2f range (so 3 types of fleets in the space of 20%). To be more accurate the Gedune table is this:
30fp - 50%
14fp - 10%
40fp - 10%
120fp - 21%
60fp - 08%
200fp - 01%

I was pretty sure that those are not the actual spawn rates.  So I tested it.  Below is code that tests 100000 spawns, and says how many of them were which.  Here are the actual Gedune spawn probabilities are:
scout - 50%
longRangeScout - 40%
raiders - 10%
libers - 0%
elite - 0%

Code
public class UomozBug {
    public static void main(String[] args) {
        for (int i = 0; i < 100000; i++) {
            System.out.println(testGeduneSpawn());
        }
    }
   
    private static String testGeduneSpawn() {
        float r = (float) Math.random();
        if (       (r -= .5f) < 0) {
            return "raidFleet(\"scout\")";
        } else if ((r -= .4f) < 0) {
            return "raidFleet(\"longRangeScout\")";
        } else if ((r -= .3f) < 0) {
            return "raidFleet(\"raiders\")";
        } else if ((r -= .2f) < 0) {
            if (Math.random() > 0.3) {
                return "raidFleet(\"libers\")";
            } else {
                return "defendFleet(\"libers\")";
            }
        } else if ((r -= .2f) < 0) {
            if (Math.random() > 0.1) {
                return "l33tFleet(raidFleet(\"elite\"))";
            } else {
                return "l33tFleet(defendFleet(\"elite\"))";
            }
        } else {
            if (Math.random() > 0.1) {
                return "raidFleet(\"siege\")";
            } else {
                return "defendFleet(\"siege\")";
            }
        }
    }
   
    /** Output:
     * jackson@jdesk ~/Desktop $ java UomozBug | sort | uniq --count
     * 39947 raidFleet("longRangeScout")
     *  9866 raidFleet("raiders")
     * 50187 raidFleet("scout")
     *
     * I know Math.random() isn't perfectly random, but this is one
     * heck of a co-incidence if the spawn code is correct!
     */
}

I love this mod; you've done a great thing integrating all these ship mods into a coherent whole.  It's single-handedly added hours of play value to the game!  I'm glad I could help in a small way by finding this bug.  Keep making awesome releases :D

3
Mods / Re: [0.54.1a] Uomoz's Corvus 17: Allegiance (Factions Collection)
« on: February 27, 2013, 06:01:32 PM »
BUG

So I've been trying to get a certain Gedune ship for a while.  But after sitting on their station for ages, only really small fleet types were spawning.  The only ones I saw were Scavengers, Scouts, and Raider.  But in /data/world/factions, there's three bigger fleet types: Liberators, Elites, and Seige Group.

After digging around a bit, I think I found the problem in /data/scripts/world/GeduneSpawnPoint.java:
Code
	@Override
protected CampaignFleetAPI spawnFleet() {
float r = (float) Math.random();
if (       (r -= .5f) < 0) {
return raidFleet("scout");
} else if ((r -= .4f) < 0) {
return raidFleet("longRangeScout");
} else if ((r -= .3f) < 0) {
return raidFleet("raiders");
} else if ((r -= .2f) < 0) {
return Math.random() > 0.3 ? raidFleet("libers"): defendFleet("libers");
} else if ((r -= .2f) < 0) {
         return l33tFleet(Math.random() > 0.1 ? raidFleet("elite"): defendFleet("elite"));
} else {
return Math.random() > 0.1 ? raidFleet("siege"): defendFleet("siege");
}
}

Looks like an oversight when adding new fleet types; the probabilities total more than 100%, so the top several are the only ones that ever get picked.

I think this should fix it; just chose some probabilities that summed to less than 1.0 (and the remaining 0.1 goes to the else for seige fleet type)
Code
	@Override
protected CampaignFleetAPI spawnFleet() {
float r = (float) Math.random();
if (       (r -= .3f) < 0) {
return raidFleet("scout");
} else if ((r -= .1f) < 0) {
return raidFleet("longRangeScout");
} else if ((r -= .2f) < 0) {
return raidFleet("raiders");
} else if ((r -= .2f) < 0) {
return Math.random() > 0.3 ? raidFleet("libers"): defendFleet("libers");
} else if ((r -= .1f) < 0) {
         return l33tFleet(Math.random() > 0.1 ? raidFleet("elite"): defendFleet("elite"));
} else {
return Math.random() > 0.1 ? raidFleet("siege"): defendFleet("siege");
}
}

Pages: [1]