Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: StealThisStuff: An example mod for advanced shipsystems and weapons  (Read 2014 times)

EnderNerdcore

  • Commander
  • ***
  • Posts: 172
    • View Profile

StealThisStuff

So I've been working for the past several days on seeing what ship systems and weapons are really capable of in Starfarer (take a look at my fleet-buffing and enemy-fleet debuffing AWACS system in my FreeSpace 2 mod!). I'm not the greatest coder, but I'm able to puzzle my way through things enough to get everything running, so between my own experimentation and helping out some other modders, I've started to get a good feel for what is possible.

So I figured, why not help everyone out?

Thus I present: StealThisStuff - Download Link

This is a mod with a few examples of things I've been experimenting with. It will constantly be expanding as I do more and learn more. The benefit to you all is that I have extensively commented all of my code. So if you're a modder, and you're having trouble getting a ship system to do exactly what you want it to do, or getting the AI to use it correctly, take a look. See if there's something there you can use. All I ask is you thank me somewhere in your mod's thread!

If you're getting started on coding for Starsector, I highly recommend checking out LazyWizard's excellent tutorial on setting up NetBeans. I couldn't have done most of this coding without it!

Note: I am not a good artist. At all. Luckily, medikohl has put a whole bunch of great ship sprites up for anybody to use in this thread: http://fractalsoftworks.com/forum/index.php?topic=1131.0
Go check them out!


The Ships & Systems
These are... sort of balanced. You could probably stick them in your Starsector game if you felt like it. But balance isn't really the point, is it? These are learning tools.


Coyote - High-Tech Experimental Frigate
Ship system: EMP Drone
The Coyote uses the EMP Drone ship system. This is merely a demonstration of that you can put ship systems onto drones, and they will use them (though sometimes it seems unreliably). In this case, since it's a drone, so it doesn't carry the penalty of not being able to fire your ship's weapons, I've reduced the range, damage, and EMP damage.



Barnacle - Assault Missile Destroyer
Ship system: Hull Repair with custom AI
The Barnacle uses the Hull Repair system, complete with a custom AI. The repair system enables quick regeneration of up to 20% of a ship's HP over the course of several seconds, while disabling all other systems. Since your ship is rather vulnerable while using this, I've created a custom AI script that weighs the need to repair with the current danger the ship is in. For example, if the AI's current target is disabled and the ship's hit points are low, it will almost always use the system.
This could be improved by also taking into account the number of enemy ships within some range as well, but I don't currently have that implemented (though it wouldn't be hard).



Torment - Heavy Stealth Assault Destroyer
Ship system: Overloaded Missile Racks with custom AI
Being a phase ship, you'll also find the appropriate glow files in the graphics folder so you can see how those work. (I am a terrible artist, I'm sure you can make it look better). The Torment uses a very simple ship system with a custom AI: Overloaded Missile Racks. All this system does is double the rate of fire of all missile racks for a very short time (2 seconds). The AI though is a bit more complex. It checks on several factors, all of which are explained in comments in the AI file. These factors include: How many of my missile racks are currently reloading? Is my target either vulnerable (venting/overloaded) or at fairly high flux? Do I have enough flux to use the system and still be able to use my phase cloak afterward?



Scythe - Tactical Stealth Carrier
Ship system: Wing Teleporter with custom AI
Another phase ship, this one a capital-size carrier. The ship system is fun: I call it the wing teleporter, and when used, it teleports your fleet's fighter/bomber wing with the least amount of health directly to the carrier. The AI script ensures that the AI doesn't use the system until one of your wings is at below 30% HP. There are plenty of comments through the script files that explain the process.


Pelican - Fleet Support Carrier
Ship system: AWACS with custom AI
A simple support carrier example. The AWACS system applies a buff to all friendly ships within sight range of the Pelican, and a debuff to all enemies within sight range. The AI simply turns the system off if the ship is near max flux to help prevent and overload, but otherwise keeps it running.
Note that this system does have a limitation I haven't figured out how to get around: if a ship is receiving the AWACS buff or debuff and moves out if the sight range of the Pelican, the buff/debuff is not removed (until the Pelican turns the system off).

Sample Mission
There is a sample mission included, based off of a mission in base Starsector. All it does is include each ship in this mod (plus some fighter/bomber wings) so you can check them out.

No campaign integration
As this is just a sample mod meant to teach other modders ship system and AI coding, I have not integrated any part of this with the campaign. If you'd like the ships to show up in the campaign, you'll need to integrate them yourself, but it's pretty easy to find examples in other mods of how to do this.


Changelog
Version 1.1 - January 17th, 2013 - Added Pelican with (lightly modified) AWACS system from my FreeSpace2 mod.
Version 1 - January 16th, 2013 - Initial introduction of the mod. Included Coyote, Barnacle, Torment, and Scythe.
« Last Edit: January 17, 2013, 12:21:04 PM by EnderNerdcore »
Logged

Sproginator

  • Admiral
  • *****
  • Posts: 3592
  • Forum Ancient
    • View Profile
Re: StealThisStuff: An example mod for advanced shipsystems and weapons
« Reply #1 on: January 17, 2013, 07:36:01 AM »

LOVE IT!

Especially the Scythe's one!
Logged
A person who's never made a mistake, never tried anything new
- Albert Einstein

As long as we don't quit, we haven't failed
- Jamie Fristrom (Programmer for Spiderman2 & Lead Developer for Energy Hook)

Uomoz

  • Admiral
  • *****
  • Posts: 2663
  • 'womo'dz
    • View Profile
Re: StealThisStuff: An example mod for advanced shipsystems and weapons
« Reply #2 on: January 17, 2013, 07:37:34 AM »

Love this guy's work. Keep this up, we'll all get better at it. Thanks.
Logged