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

Pages: 1 ... 18 19 [20] 21
286
Modding / Quick Iteration through Stations
« on: September 03, 2012, 11:07:23 AM »
Heyas, was wanting to improve the implementation of the Station Supply limiter and make it less static, because of something else I wanted to do.  Right now, each SupplyControl is an instance, basically a different operation:

Spoiler
Relevant Corvus code:
Code
		SectorEntityToken hegemonyStation = system.addOrbitalStation(system.getEntityByName("Corvus II"), 45, 300, 50, "Orbital Station", "hegemony");
SupplyControl controller = new SupplyControl(sector, system, 1f, 999, system.getEntityByName("Corvus IIIA"), hegemonyStation);
system.addSpawnPoint(controller);

SectorEntityToken tritachyonStation = system.addOrbitalStation(system.getEntityByName("Corvus V"), 45, 300, 50, "Corporate HQ", "tritachyon");
SupplyControl controller2 = new SupplyControl(sector, system, 1f, 999, system.getEntityByName("Corvus IIIA"), tritachyonStation);
system.addSpawnPoint(controller2);

SectorEntityToken pirateStation = system.addOrbitalStation(system.getEntityByName("Corvus IIIA"), 45, 300, 50, "Hidden Base", "pirates");
SupplyControl controller3 = new SupplyControl(sector, system, 1f, 999, system.getEntityByName("Corvus IIIA"), pirateStation);
system.addSpawnPoint(controller3);

Supply Control (mainly not written by me, but by Ventris):
Code
package data.scripts.world.corvus;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.FleetAssignment;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.Script;
import data.scripts.world.BaseSpawnPoint;
import java.util.List;
@SuppressWarnings("unchecked")
public class SupplyControl extends BaseSpawnPoint {

   private final SectorEntityToken station;
 
   public SupplyControl(SectorAPI sector, LocationAPI location, float daysInterval, int maxFleets, SectorEntityToken anchor, SectorEntityToken station)
   {
super(sector, location, daysInterval, maxFleets, anchor);
this.station = station;
   }
@Override
public CampaignFleetAPI spawnFleet()
{
/*
StarSystemAPI theStations = getOrbitalStations();

for (int i = 0; i < theStations.length - 1; i++)
{
Global.getSectorAPI().addMessage(theStations[i]);
}*/
CargoAPI cargo = station.getCargo();

//sets up all the different cargo items, and gets their amounts
float supplies = cargo.getSupplies();
float fuel = cargo.getFuel();
float crewg = cargo.getCrew(CrewXPLevel.GREEN);
float crewr = cargo.getCrew(CrewXPLevel.REGULAR);
float marines = cargo.getMarines();
int f;
int amt;
int i;        
 
//this randomly removes weapons from a station.
List weaponIds = getSector().getAllWeaponIds();
for (int w = 0; w < weaponIds.size(); ++w)
{
i=cargo.getNumWeapons((String)weaponIds.get(w));
//4% chance each day that a weapon will be removed.
if ((float) Math.random() > 0.96)
{
amt = (int)(Math.random() * ((i - 1)));
if (amt > 0)
{
cargo.removeWeapons((String)weaponIds.get(w),amt);
//Global.getSectorAPI().addMessage("Supply Control -Weapon");
}
}
}
   
//As long as the supplies at a station are greater than or equal to 400, there's a 16% chance that this code will run
if ((supplies >= 1000) && (supplies <= 2000) && ((float) Math.random() > 0.76))
{
//the 60s here are the minimum value that can be removed. 350 is the maximum value. Make sure the maximum value is below the value in the if statement above, which is 400 here.
//Otherwise, you might get negatives and I don't know how Starfarer will like that.
f = 60 + (int)(Math.random() * ((350 - 60) + 1));
cargo.removeSupplies(f);   
//uncomment this to get an ingame notification when this code runs
//Global.getSectorAPI().addMessage("Supply Control is truncating supplies");
}

if (supplies > 2000) {
f = (int)(supplies - 2000);
cargo.removeSupplies(f);
//Global.getSectorAPI().addMessage("Supply Control is truncating lots of supplies");
}

if ((fuel >= 600) && ((float) Math.random() > 0.60))
{
f = 160 + (int)(Math.random() * ((350 - 160) + 1));
cargo.removeFuel(f); 
//Global.getSectorAPI().addMessage("Supply Control -fuel");
}

if (fuel > 2000) {
f = (int)(fuel - 2000);
cargo.removeFuel(f);
}  
 
if ((crewg >= 700) && ((float) Math.random() > 0.93))
{
f = 10 + (int)(Math.random() * ((120 - 10) + 1));
cargo.removeCrew(CrewXPLevel.GREEN,f);
//Global.getSectorAPI().addMessage("Supply Control -green crew");
}  

if ((crewr >= 500) && ((float) Math.random() > 0.80)) {
f = 20 + (int)(Math.random() * ((190 - 20) + 1));
cargo.removeCrew(CrewXPLevel.REGULAR,f);
//Global.getSectorAPI().addMessage("Supply Control -regular crew");
}    

if ((marines >= 60) && ((float) Math.random() > 0.87)) {
f = 6 + (int)(Math.random() * ((35 - 6) + 1));
cargo.removeMarines(f);
//Global.getSectorAPI().addMessage("Supply Control -marines");
}

//Veteran and elite crew weren't added because they're rare enough as it is, but if you do want them to be gradually removed, it should be easy to copy.
CampaignFleetAPI derp = null;
return derp;
}
}
[close]

Problem is, I'm having issues iterating through Stations, generically.

I tried this out, but I guess I'm still not getting the concept of how to do this with Java (feeling stupid, if it was Lua, I'd have it done already).  This causes a crash, saying that there isn't any such method, even though StarSystemAPI is loaded.  I was thinking it needs a SectorEntity as a condition, but I don't want to call ever planet, search for stations, etc., at least not more than the very first time; I'd like to build a list that this iterates through every cycle and then does the whole SupplyControl script.  Then it can quit being static.  If anybody's got any ideas about how to clear this up (and in general, it'd be nice to also be able to get lists of Spawn, Planet, etc. objects in this way) I'd appreciate it, it'd let me move on to the next part of my experiment without having a bunch of static junk floating around in my code :)

Code
	
/*
StarSystemAPI theStations = getOrbitalStations();

for (int i = 0; i < theStations.length - 1; i++)
{
Global.getSectorAPI().addMessage(theStations[i]);
}*/

287
Suggestions / MultiShield / Flicker Shield
« on: August 30, 2012, 08:35:21 AM »
MultiShield would allow more than one shield to be mounted on a Hull.  If ships have > 1 shields, additional shields act like PD and rotate to block incoming damage. 

Would be a really cool tool for doing simulations of certain kinds of sci-fi ships and boss-like characters with multiple shields to knock down.

Flicker Shields would operate like PD; they'd be a very rapid, automated response to incoming damage, but with a limited lifetime and a cooldown. 

Difference between them and PD is that they'd be able to respond to beam strikes.  Plus side vs. traditional shields is that Flux costs would be negligible; minus side is that rapid-fire weapons would get some strikes through during cooldown cycles.

288
Suggestions / NoCollide
« on: August 30, 2012, 08:17:47 AM »
Pretty simple; I want to be able to define some ships as unable to collide with other ships, ala Phase, but still collide with projectiles, for "fighter-like" behaviors.  This would be especially useful for ships whose main theme is speed, frigates-as-heavy-bombers, and the like, where they just aren't going to perform well if they're constantly doing collision checks and are stopped in mid-burn-drive because they've rammed a capship.

289
Suggestions / Customizable Stations
« on: August 28, 2012, 09:51:50 AM »
Just some ideas:

1.  I'd like to be able to swap out graphics for them on creation via Java, or have a JSON defining them, or both.  Custom bitmaps would give them a lot more interest.

2.  I'd like some MutableValues:

A.  Dockable.  An operation that allows / rejects all attempts to dock by (faction).  Shorthand of (ALL) and (NONE) would be nice, too.

B.  CostMult.  Would alter the buy / sell cost multiplier (after taking friendliness into account) of any given item.  So MutableStationStatsAPI CostMult("supplies", 0.5) would set the Station's cost multiplier for buying Supplies to 50%.

It'd be handy to have some shorthand available, as well; i.e., MutableStationStatsAPI CostMult(WEAPONS, 1.5), would set all weapon prices to 150% of base value.

C.  Defenders.  Defines the defending fleet type (via fleet API) if the option to attack is there.

D.  BattleScript.  When Campaign battles can be scripted ala Missions, this would associate a given Mission script with the Station, allowing for all sorts of fancy stuff.

E.  Hidden.  Whether this Station can be seen or not.  Right now, Stations may be created, but they apparently can't be destroyed nor hidden from view.  So the "hidden base" of the Pirates is anything but, etc.

F.  TradeConnections.  This would be a table, giving the Sector objects that Fleets that meet "trader" criteria are most likely to select to go to after visiting the Station. 

Personally, I think we're going to want to see trading fleets and patrols become less event-dependent objects and more like real entities that can visit places and then get a new destination, like the player does.  Right now, it's probably more complex to set this up than is desirable.

G.  PatrolPaths.  Much like TradeConnections, this would define patrol routes within a system, creating a much more realistic feeling to in-system traffic.

H.  VisibleOnMap:  Somewhat like Hidden, but only effects the strategic map.

I.  SightRadius:  how far away the Station can "see" and warn nearby fleets about your presence, if hostile.

J.  GreetingsDialogue:  Table. Would give different greetings.  This could become part of scripted missions really fast.

K.  RumorsDialogue:  Table.  Ditto.

L.  ExpectsItemFromPlayerFleet:  a trigger, for all of those fedex quests we'll be doing.  If blah is in inventory, then blahblah.

290
Suggestions / Open Source Starfarer Art
« on: August 27, 2012, 12:17:25 PM »
I'd like to suggest that it's high time to have a stickied Sprite Dump thread where we're allowed to post sprites that don't violate copyright (or are kitbashes of David's art, since he's cool with that) that explicitly says something along the lines of, "if you post it here, it's fair game for any Starfarer mod that wants to use it, period".

I'd like to see rules for it set up the same way I've seen elsewhere; i.e.:

1.  You may only post if you're contributing a sprite, no critique, to keep the thread clean for modders who are browsing for content.  Failure to obey the rules can result in erasure of your post or worse, depending on the severity of the offense.

2.  No work can be submitted if it's ripped from other people's IP.

i.e., no Battleships Forever kitbashes unless you were the author of the sprites used or got the permission of the artist, no Star Wars / Trek / 40K stuff, EV Nova sprites, etc., etc. 

It has to be kept legally clean, basically.



Anyhow, this would solve a lot of possible future issues with Starfarer's modding scene and it's easier to get it done now, when it's small, rather than later, when it's going to cause angst amongst people whose stuff can't be redistributed legally.  It'd also mean that all of the free-to-use sprites were in one easy-to-find, easy-to-browse place.

291
Suggestions / Hidden Hull Mods
« on: August 24, 2012, 07:54:49 AM »
I'd like Hull Mods that can't be picked from the UI, so that we can give ships hidden bonuses that can't be put onto other ships.

292
Suggestions / Custom Rocket Engine Stuff
« on: August 24, 2012, 06:49:30 AM »
None of this is trivial, and I'm sure I'd rather see the Campaign fleshed out and more gamecode accessible through Java first, but I thought I'd make an organized list:

1.  Would be nice to be able to define the core width percentage, ala beams.
2.  Would be nice to have a variable, "curvature" that allows the engines to use multiple quads that follow behind the ship, giving it a curved wake.  The current angular-velocity code just seems to turn the quad.  This has all sorts of uses; for example, we could remake Autoduel and use "engine flares" for tire tracks :)
3.  Would like control over how many particles are being spawned per second, for performance enhancement (i.e., get rid of them, in cases where we can live without) and looks.
4.  Would like to be able to define custom bitmaps for the wake particles.
5.  Would like to be able to use all the beam sprites for the wake, as well as custom sprites to make wavy, curdled, etc. looking wake trails.
6.  Would like some basic control over how quickly the wake contracts; low values would result in a rounded trailing edge after remaining the same width over most of the length, high values would make it scale rapidly to a needle point, for different visual styles.
7.   Would like access to the other events associated with engines, i.e. when / whether it contracts to a glow, etc.  This kind of stuff would really matter for mods that want to make significant visual changes, such as converting the gameplay to WWII ships, aircraft, etc., where we'd want a wake but we might want it to do some really specific stuff or not show some things it does now.
8.  Percentage of the trail before it starts fading out.

In terms of game-side changes, I'd like:

1.  Strafe separated from other forms of acceleration.  This has all sorts of neat implications, and I've been finding that, since it's a multiplier with the math not obvious atm, it's causing some issues in terms of tweaking feel.
2.  Direct control over engine durability and whether the engine's operational.
3.  Control over what sounds are used.
4.  The ability to prevent ships from moving backwards as fast as they can move forwards.

293
Modding / What controls missile auto-launch?
« on: August 23, 2012, 05:08:00 AM »
I've noticed that Pilums, put on auto-fire, will launch automatically, but other missiles with comparable ranges will not, even if DO_NOT_AIM is set, if they're mounted on hardpoints.  Instead, the launcher appears to be waiting for the hardpoint to be lined up with something before firing.  I thought DO_NOT_AIM was supposed to fix that, but apparently not :)

Is there a variable I need to set in the WPN or in the CSV to get them to auto-fire properly?

294
Suggestions / Fighter repair, Carrier improvements
« on: August 23, 2012, 04:17:21 AM »
In the same vein as carriers should carry fighters, it'd be nice if:

1.  Individual fighters in a Wing peeled off to get repaired when below 50% health, instead of getting trashed because the unit's still in action.

2.  We could install a System that would automatically replace dead fighters at a cost in crew, fuel and cargo during battle, or have a System that, if present, passively increased the chances of recovering dead Wings after battle.

The first would allow for the number of Wings to stay low, but the number of total fighters in a battle to rise considerably, helping with performance but increasing the overall role of fighters.

The second would be a big benefit to carrier forces in general; being able to recover fighters more often would greatly enhance their ability to remain on-station, vs. battle groups consisting mainly of capital ships, once that sort of thing actually matters.

3.  Carriers not only had multiple launch points, but the number of same had a direct impact on how many Wings the carrier could service at a time.  I'd really like to have carriers reflect the real-world gamut from lowly Frigates that can only service a single helicopter to supercarriers that can launch and maintain squadrons.

295
Suggestions / Blinky Stuff
« on: August 22, 2012, 03:48:10 PM »
Would like to be able to put dynamic lights onto ships.

I was thinking about how to go about implementing this, and I had an idea (this gets a bit technical)
Spoiler
1.  People would draw a secondary layer map, like the glow maps used for phase ships.

2.  Pass a uniform to a fragment shader that gives a time scale and blur scale.

3.  For each non-zero alpha texel, do a Gaussian blur to adjacent pixels using the time scale to determine overall speed of blinking and size of the blur and the blur scale to determine how many pixels to fade it out (default to 1).  Use the RGB component to draw an alpha * time variable, use the base alpha of the texel to skew the time scale, from 1.0 to slower transitions between sin waves.  

This would give artists a great deal of control and allow for small variations in alpha to create different blink cycles- perhaps you want really fast cycles on a "technical component" but you want slow throbbing glows for a "landing light", etc.

I think this method should be plenty fast; all zero-alpha texels could get discarded immediately and the resulting processing load on the GPU should be pretty small even though there's a fair amount of math involved for each non-zero alpha texel.
[close]

Anyway, just an idea; sorry if providing some implementation thoughts wasn't appropriate, I thought it might be helpful in this case, as the alternatives (like doing it with quads) could get complicated and expensive.  It'd add a lot of life to the ships :)

296
Modding / Stupid Question: Projectile Trail / Drawing
« on: August 21, 2012, 01:25:08 PM »
Sorry for another stupid question, but I'm stumped.

I want to make a rapid-fire spamming weapon like the Vulcan, but I want the projectile's bitmap to be the sole object used to draw it, not the blurry trail effect that gets stuck on the Vanilla projectiles (ideally I'd like the blurry trail but only very faintly, just to antialias the sprite).

So the projectile needs to be performance-friendly but look just right.  Any way to get this done with non-Missile types of projectiles, or is the Rocket type, sans motor, the only way to do this atm?

297
Suggestions / NoBuy
« on: August 21, 2012, 12:36:18 PM »
Boolean in weapon_data.csv; would prevent a Weapon from ever being salvaged or showing up in a store via random-weapons scripts.  Mainly this is for built-ins that are unique objects that shouldn't ever be transferred or show up in stores.

298
Bug Reports & Support / Can't overwrite Vanilla projectiles w/ mod
« on: August 19, 2012, 06:14:58 PM »
I finally began porting my mod out of the core-data files, and I've run into fairly serious problems with files not allowing overwrite.  The error from the log:

Code
[H:\Fractal Softworks\Starfarer\starfarer-core\..\mods\Vacuum\data\weapons\proj\amblaster_shot.proj]
6782 [Thread-6] INFO  com.fs.starfarer.loading.LoadingUtils  - Loading JSON from [H:\Fractal Softworks\Starfarer\starfarer-core\..\mods\Vacuum\data\weapons\proj\amblaster_shot.proj]

6844 [Thread-6] ERROR com.fs.starfarer.combat.String  - java.lang.RuntimeException: Projectile spec [amblaster_shot] already exists
java.lang.RuntimeException: Projectile spec [amblaster_shot] already exists
at com.fs.starfarer.loading.int.o00000(Unknown Source)
at com.fs.starfarer.loading.WeaponSpecLoader.super(Unknown Source)
at com.fs.starfarer.loading.WeaponSpecLoader.super(Unknown Source)
at com.fs.starfarer.loading.SpecStore.super(Unknown Source)
at com.fs.starfarer.loading.G.o00000(Unknown Source)
at com.fs.oOOO.A.new(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)

So, er... I need, not want, to overwrite many, many Vanilla files here, for this to work as designed.  Are there any available workarounds for this kind of error?



299
Suggestions / I'd like more graphical control...
« on: August 15, 2012, 10:02:10 PM »
Specifically, I'd like to be able to call up custom explosion FX, define new gibs and perhaps be able to define gibs on a per-hull basis, be able to give inputs to PLASMA type weapons, use engine trail systems on non-rockets, etc.

It'd also be nice to be able have a bit more control over turret offsets and colors; for example the RGB value for Glow effects both the custom Glow bitmap and Glow that's generated by the engine, which is annoying to discover when you've just made a custom Glow with multiple colors and it's getting overridden or you get white glows when you turn on HEF after setting the values to 255s ;)  I'd really like a barrel-end offset, too, so that I can offset weapon sprites via code and place the position the shot comes out via that offset and not have to add more pixels to the bottom of the sprite to get it as forward as I want.

Lastly, it'd be nice to have a way to reload the CSVs / .ship / .variant / .wpn / etc., etc. text files in Dev mode from the main menu, as just reloading some values from text should be considerably faster than restarting the game.  That would make editing and getting feedback about final results a much faster, cleaner process and I suspect you guys working on this would use it too :)

I know that this stuff is not a minor request, as I'm guessing you atlas that stuff on a specific texture sheet atm, plasma uses pretty specific code and probably isn't, er, flexible atm, and engine trails on things that aren't thrusting may be a pain.  Thought I'd ask anyhow, put it out there for the future :)

300
Suggestions / OnCreate(), OnDeath()
« on: August 15, 2012, 09:42:21 PM »
Two additional callin requests; called when any object (projectile, ship) is created or destroyed. 

Would allow for things like "amoeba" enemies that spawn multiple critters when killed, fireships that do lots of damage to anything around them when they die, fancy self-destruct systems of various sorts, lifeboats and other details being spawned when big ships go boom, carriers that would spawn fighters when they arrive on a battlefield, projectiles that convert into various objects when they detonated, etc., etc.

Pages: 1 ... 18 19 [20] 21