Fractal Softworks Forum

Starsector => Mods => Topic started by: Verrius on August 14, 2012, 05:51:36 PM

Title: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Verrius on August 14, 2012, 05:51:36 PM
Download Link (Current Version) (http://www.mediafire.com/download.php?rq21cpn1538qhgw)

Hey there guys, as I recently mentioned in my Fleet Control Mod Threat, I've been secretly working on ships that can make resources and the ability to mine. This mod probably won't be actively updated for content, I just want it to be out there so people can see and use the tech. I've TRIED to document it as best I could, but when it comes to documentation, that's what kept me from acing Computer Science, so you'll have to forgive me. Feel free to ask any questions though.

I will most likely integrate a system like this to the Fleet Control Mod, but your more than welcome to use this code. Heck, that's why it's here!

How it works:
For the Farmstead to produce supplies (I don't think I switched it to "food", it's still supplies) it must be combat ready. It will produce 3 each day, however this amount is modified by your crew level. Green crew produces 25% less, Regular produces the normal amount, Veteran is 25% more, and Elite is 50% more.

I've used Alex's Mining Pods to do the mining. Pick up a wing or two of em from the Hegemony, the fly to an asteroid. Each day a check is made to see if you (actually if every fleet in the system) are sitting near an asteroid. If you are, it calculates your mining power based on your ships. How much mining power you have depends on your combat ready mining pods. The more you have, the more resources you can drain from the asteroid. At the moment, the asteroids never actually die or anything, don't know if I can do that yet.

There are three types of resources you can drain from asteroids. Ore, Metal, and Precious Ore. Precious Ore is rare, but worth a lot to sell. It's worth noting that, as you'd expect, Ore is a fair bit heavier than regular supplies and such, so pack yourself some good cargo space.

If you actually look at the code, it's not too hard to add your own mining ships. There is a hashmap at the bottom of the SupplyEvent and the MiningEvent scripts. Simply add a value to whichever map you like with your ships ID, and the production amount/mining power, and bam it'll get to work.

Version 0.1: (Not publicly released) Added the Farmstead, a modified tanker that actually looks sorta pretty that produces supplies.
Version 0.2: Gave Mining Pods the ability to mine.
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: CrashToDesktop on August 14, 2012, 05:58:45 PM
Lucky I checked recent posts, I or I would never have found this. :)
Anyways, let the testing begin!

EDIT:
Mining pods?  Don't you mean Mining Drones? ;D
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Strifen on August 14, 2012, 06:03:55 PM
No more drone wings since ship system drones
http://fractalsoftworks.com/forum/index.php?topic=3593.0
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: CrashToDesktop on August 14, 2012, 06:06:40 PM
Arg, OP.  A drone is anything that's unmanned.  The wasps have crew, presumably to take care of the drones while in storage. That's just the name of them, ok? 
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: xenoargh on August 14, 2012, 06:09:18 PM
This looks awesome.  I'll have to look at this and see how hard it would be to make some miners go out to the asteroids to provide different targets for players and the factions, I'm really looking forward to a Corvus that has a lot of semi-autonomous stuff happening :-)
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Sproginator on August 14, 2012, 06:18:18 PM
Awesome idea! Can't wait to try it
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Verrius on August 14, 2012, 06:19:31 PM
This looks awesome.  I'll have to look at this and see how hard it would be to make some miners go out to the asteroids to provide different targets for players and the factions, I'm really looking forward to a Corvus that has a lot of semi-autonomous stuff happening :-)
Actually I think it'd be rather easy. What I plan on adding to Fleet Control are automated miners that choose a nearby Asteroid (You could also make them choose a random one) and add a go to location assignment to said Asteroid. Problem is, there is no "just sit there" assignment, once they go to the location I THINK they'll start to wander. If I use a Defend assignment, they ALSO wander, which is rather irritating to say the least. We'll have to see what happens.
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: CrashToDesktop on August 14, 2012, 06:30:02 PM
All parts of the mod work as intended. :)
Although I suggest better names for the ore, Metal might become Ore (very common in asteroids, some are entirely made of iron), Ore might become Infernium (slightly less common ore, but still reachable).

EDIT:
I find that it takes quiet a long time to find a good amount of ore/metal/precious metal, leaves you kinda vulnerable while you're doing that.
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Verrius on August 14, 2012, 06:31:59 PM
Don't bet on any updates to this thing, it's just an example :p.

I'm integrating the features here into Fleet Control as we speak.
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: CrashToDesktop on August 14, 2012, 06:35:24 PM
Ah, nice! :)
Anyways, edited my post, read my suggestions or die! :D
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: Verrius on August 14, 2012, 06:38:57 PM
If you look at the code, you might notice I actually tried to make it so it'll do the check 10 times per day, but it obviously cares not for my attempts. You could always change the Mining Power in the hashmap to a much greater value, that'll be a good idea for anybody planning on using it.

Fun fact, it was extremely annoying to test mining at times because the pirates wouldn't get off my back. Gave me flashbacks to MMO resource gathering... I'm personally sticking to contracting mining fleets thank you very much!
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: CrashToDesktop on August 14, 2012, 06:51:36 PM
Just hang out on the other side of the system, that's what I did.  Dev mode it up, get a condor, three mining drones, and headed out for the journey. ;D
Title: Re: Resource Production Mod example (Hydroponic Ship and Mining)
Post by: xenoargh on August 14, 2012, 07:44:51 PM
Quote
Problem is, there is no "just sit there" assignment, once they go to the location I THINK they'll start to wander. If I use a Defend assignment, they ALSO wander, which is rather irritating to say the least. We'll have to see what happens.
Just add a behavior loop that, until satisfied, keeps them near their target, with a random range of waiting times.  A wait time of 2-3 game days should be about right- just long enough to get intercepted.  Can't wait until we're able to mod interactions with ships other than just attacking people and 3-way battles are possible, then players can "come to the rescue" of the miners being raided by pirates, buy materials from them at "source prices" and then sell them at standard commodity prices, etc., etc. :)