Jump to content

[1.2] WIP: Civilian population development thread


michaelhester07

Recommended Posts

I've begun working on the idea I had for in situ kerbal recruitment. The first step is done: confirm that it is actually possible to generate a new kerbal on board a ship. I'm working this as it's actually possible. The pipeline idea I had before (where you build pipes on a planet) is scrapped as it seems i can't get resources off a ship unless its loaded.

The answer is that it's possible. Here I'm testing the recruitment module using the science lab as a basis. I'll do a new model for this (maybe).

uQyJSFS.png

i2nh7gM.png

The kerbal in the module on the second screenshot was added straight to it from the roster. Apparently that's the only way to do it without breaking game saves. Trying to interact directly with the CrewGenerator will result in being unable to save and go back to the space center (wow).

Now that i confirmed it's possible to recruit a kerbal directly to a ship it's time to build the Civilian population mod.

Heres how ISKR (in situ kerbal recruitment) will work:

Civilian population will be a new resource (like the green resources). In order to build a population on your base or station there will be 3 types of parts you need.

1. Civilian spacecraft dock: This dock will be how civilians actually get to your station. This is a commercial subcontractor dock which will receive new civilians at a rate depending on where the base is. You don't need this if you plan to launch them yourself.

2. Food: There will be new garden modules and biodomes (like my farm biodome) which will add a "food" capacity to your ship. Food will be required to support a civilian population

3. Housing: A house module will be available (that actually stores the civilian resource) in different sizes.

4. Kerbal Resource department (pictured above): Finally once you build up enough civilian population you can recruit from it. This spawns crew in-situ.

If your station or base has enough food and housing and a civilian dock you'll start to receive civilians. The rate you receive depends on where your base is and how big the current population on it is. Within kerbin system would be the order of a few hours at a time. Out by Eeloo would take years to get them there. You can of course launch a ship with civilians on it to seed your base. That ship will need the necessary parts to sustain the population.

Edited by michaelhester07
Link to comment
Share on other sites

You could also have In situ Kerbal reproduction for off world colonies with this too.

With all the mods for new star systems, resource gathering and off world launch pads this is the one resource you can't generate off world.

Edit: I didn't see that last part of your post.

The Kerbal Resource department, I guess that's where you are going with it.

Edited by Tommygun
Link to comment
Share on other sites

The last part about how big the population is: This is where you can start to get kerbals reproducing. That said I don't know what the gestation period and lifespan of a kerbal is supposed to be or how horny they are. I would guess you can hire children right out of the box.

Plan for reproduction balance:

  • Minimum Civie pop for reproduction: around 50 or so
  • Civie birth rate: once every 3 months per 50 population (it grows faster with a bigger population)

Open resource system has a food definition that I'll use.

Kerbal Resource Department: Yes your crew are technically your employees so in order to "hire" them you need an office for them to fill out paperwork in. At the moment I have no plans to make civilian population visible on your ship/base. The civie living space will have some space for crew as well.

A brainstorm of modules I'll do

  • Small mobile KR office: Basic recruitment capability (seen in the picture... i'll probably just recycle the science lab model for it)
  • Small civilian transport pod: Holds a small civilian population (up to 8). (2.5 meter part)
  • Small garden module: Spherical center module with two 2.5 meter end caps contains floating hydroponic garden. Provides enough food for one small transport pod. Garden pod will probably only consume electricity
  • Larger version of those 3 parts for 25 civilians. Large KR office contains training facility so you can produce experienced kerbals.
  • Farm biodome: provides 50 food
  • Apartment biodome: Civilian population of 50, 8 crew capacity
  • Generation ship quarters: Colossal space biosphere (15 meter radius), 100 civie, 20 crew capacity.
  • Generation ship Farm sphere: Basically the farm biodome but space based.
  • Government center: Reduces the cost of recruiting a kerbal at the base/station it's attached to and will increase the civilian growth rate.
  • Civilian space dock: Allows growth of population from kerbin (rate will depend on how far from kerbin you are)

I expect to finish the coding tonight and start modelling.

Link to comment
Share on other sites

A slow day at work leads me to making some concept models for the generation ship biosphere and the small garden

mzvBcN6.png

d7kCj0C.png

The end caps on the biosphere are sized for 3 meters. Final texture details are yet to come.

The garden module is 2.5 meter diameter

New balance brainstorm:

The biospheres will have greater efficiency in space than on the ground while the biodomes will have greater efficiency on ground than in space.

Edited by michaelhester07
Link to comment
Share on other sites

Lol a plausible scenario :)

Making progress on this tonight:

The coding is mostly there. The models are in the works.

This is an initial test with the finished Farm biosphere. It has a sphere collider on it which works surprisingly well.

NOxw94x.jpg

The biospheres come with 3 meter attach points on the ends so they can become part of your ship. The farm lights up inside to indicate it is active. It will eventually use the water resource onboard as well, producing waste water which must be recycled.

Here are a few test shots of a generation ship. Depending on how big your ship gets you may need the hangar extender mod.

YTgCpyW.jpg

lj0EpY6.jpg

Bfe6JiU.png

Heres a break down on the stats that you see here

Aalr8F3.jpg

Food per pop: This is how much food each civilian consumes

population decay rate: if you don't have enough food the decay timer runs. When that timer goes longer than the decay rate the population decays by 1. The number is in seconds. Timewarping speeds this up.

Reproduction rate: You need more than this many civilians for them to start reproducing. The larger your colony gets the faster they reproduce.

Growth Rate: this is the rate at which your kerbal civilian propulation grows. It is a multipler added to the growth timer.

Population growth timer: This timer goes with the Population Growth rate, when it gets higher than the number the population grows by 1. The other Growth Rate accelerates this timer.

Consumption rate: the total speed that your civilians are consuming food on your colony. Your farms need to produce more food than this for your civilian population to survive.

Still to come: making the growth rates process even when the ship is not focused, models for the rest of the parts planned.

Link to comment
Share on other sites

Now that I launched this I saw some suggestions. I'll work on the first of the few. Seems that the biggest questions are about how this interacts with TAC life support and MKS. I developed this independent of those mods but the first thing to do will be to integrate with them. Specifically I'll integrate with the concepts in them.

TAC life support and MKS

Currently the Civilian population only requires food to survive.

Edit:

I've decided to separate the civilian resources from existing life support resources. Those systems are well thought out and it's easier for me to adjust the civilian population balance without breaking those systems by separating the resource.

Entertainment, Schools, etc (brainstorm)

Ideas were brought up and I had them too for entertainment and schooling for the civilians. I'll expand on this for the next update (which will probably come this weekend). I need some play time on TAC and MKS afterall!

Entertainment

Civilian kerbals are easily distracted my flashy movies. Movies would inspire them to become pilots, scientists or engineers. A movie theater module would provide a new "Inspiration" resource. This resource would be required to recruit a kerbal with a specific background (pilot, scientist, engineer). Otherwise the kerbal you get is random (the current "recruit kerbal" method). Kerbals recruited from the movie theater can be of a specific background but will start at level 1. Movie theaters can choose the type of movie they play granting a different bonus for each. Changing the type of movie clears generated inspiration for that movie theater.

Movie Theater options: (cost reductions only apply to kerbals recruited at that movie theater)

  • Play Love Movies: Inspires the Population to reproduce, doubling the growth rate for reproduction. Does not produce inspiration.
  • Play Racing movies: Inspires engineers, generates Inspiration and reduces the cost of recruiting engineers by 10%.
  • Play Scifi movies: Inspires pilots, generates inspiration and reduces the cost of recruiting pilots by 10%
  • Play Science documentaries: Inspires Scientists, generates inspiration and reduces the cost of recruiting scientists by 10%

Universities

Only available in large size components a civilian university on your ship allows you to recruit Scientists and Engineers with level 3 experience. Kerbals recruited from the universities will add to your agency's reputation. Universities generate an "Education" resource which is required to recruit the scientist or engineer. Universities would be able to train existing crew as well.

Universities may also process science experiments (counts as a lab).

Flight School

Only available in large size components a Flight School allows the recruitment of pilots with level 3 experience. Will generate a "Flight experience" resource. Kerbals recruited from the Flight School add to your agency's rep.

Recruting a kerbal with a specific job

  • Recruiting a level 1 kerbal of any job: At the Movie theater, will require 50 inspiration per recruit. May be reduced by the bonus based on the movie type playing.
  • Recruiting a level 3 kerbal scientist or engineer: At the university, will require 5000 education, 500 inspiration per recruit
  • Recruiting a level 3 kerbal Pilot: at the flight school, will require 5000 flight experience, 500 inspiration per recruit

Training crew at university: Only crew in slots at univ may train, will require 1 education per second for the job selected. Crew cannot be trained beyond level 3.

Training at flight school: Only crew in slots at flight school may train, will require 1 flight exp per second for the job selected. Crew cannot be trained beyond level 3.

Edited by michaelhester07
Link to comment
Share on other sites

It looks like you got a good start. I was wondering can this be used with MKS mod? I was thinking if I could use both that way I could start a small colony and then once it starts to grow I can add a bunch of cilizans and create a large colony. So what I am thinking is I use TAC life support. I start a MKS colony on the moon. I am wanting to bring civilivans to the colony. So I drop a apartment moduel and a farming dome. If I connect that with my current MKS colony could I combine all the life support that it's already producing?

Link to comment
Share on other sites

Update from last night (I'll get that question too)

I fixed all of my generators to use double instead of float as that's how all the resources are handled. The generators no longer have floating point errors! This is big because it allows me to finally use the Community Resource pack resources of Food and Water. Along that lines it will become possible to use existing life support systems to feed your civilians. I've gotten into using TAC life support which will be the big integration here. Here's what will change.

Integrating into the existing resources, changes coming

With the generators fixed I can integrate at the proper consumption rate with TAC Ls. Note that TACLS will not be necessary to have civilians. They'll use the same resources though.

Civilian population will grow so long as you have food. You'll no longer have to have a certain amount of it on hand, just that it's around. They'll eat food way slower than before, closer to TAC LS default rate. In later releases they'll consume air and produce CO2 as well. They'll produce wasteWater and probably consume water too.

The farm units will have recyclers on board which can convert waste water back into water. They'll also have always active co2->o2 converters cause they're filled with plants!

When your population grows through reproduction there must be 105kg worth of food on hand for the growth to occur, which will be deducted from your food supply when the growth occurs. Growth through the civilian contractor dock will not incur this penalty so long as it's in kerbin space.

Kerbal Recruitment: Recruiting specific kerbals

A random kerbal may be recruited from any Civilian module. This is functionality you enjoy now.

This random kerbal will have 0 experience.

A specific kerbal job may be recruited from a Movie Theater. Kerbals recruited here will be level 1 (they think they understand how to do a job based on the movies they watched). This will require 50 inspiration(which the theater generates as it operates). You can play any of 4 types of movie with bonuses to each:

  • Racing movies: bonus to engineer recruitment
  • Scifi movies: bonus to pilot recruitment
  • Documentaries: bonus to scientist recruitment
  • Love movies: bonus to popultation growth

Changing the type of movie removes all the inspiration from a movie theater.

As of this point the small movie theater is done.

Yes, there will be a 20 screen multiplex biodome because I can't leave it at just a ball with Movie Theater written on it.

Universities and Flight schools will also be available. These let you recruit level 3 kerbals.

5000 education (if recruiting from a university)

5000 flightexperience (if recruiting from a flight school)

Universities are not done yet.

Update from tonight

I've made my farm generators scalable. They can take any number of input resources and generate any number of output resources. The Civilian regulator does the same thing with the civies. This lets me balance it all.

Civilian Kerbals will consume 1kg of food, 1 kg of water and produce 1kg of waste and wastewater per day.

Farm modules will take .2kg of water and 1kg of biomass and conver them those to 1kg of food and .2kg of waste water per 20 hours (slightly out paces the matched population).

Recyclers on the farms will take 1kg of waste and 1kg of wastewater and convert those into 1kg of biomass and 1kg of water every 12 hours. (so you only need half the recyclers running as you do farms).

No part will have more than 2 resources on it due to that zooming in bug. There are new tanks that you can attach to your ship in addition to pre-existing containers from other mods.

Farm has: Water/Food

Civilian modules only have Civilian population

Containers:

Water/food (sustenance container)

Waste/WasteWater (waste container)

Biomass/Water(fertilizer container)

Edited by michaelhester07
so i don't get too spammy
Link to comment
Share on other sites

Been working on the whole rebalance of things and now that it's finally squared away I got to making the Flight school and university parts.

Flight School:

czLffQL.png

The landing pads are attach nodes so you can actually dock something if you wanted (dock not included)

University

5OTlEH0.png

The university has a lab in it to process science experiments.

Link to comment
Share on other sites

Now that 1.1 is flying high I've turned my attention to the city that you'll be flying places... or building on the surface. With that comes a custom biodome/biosphere framework.

Javascript is disabled. View full album

I've always wanted kerbals walking around inside a biodome park (it was my first mod even). Now that I'm better at this stuff I can see to making that happen. In that set of screenshots the parts provided allowed me to construct a biodome where my kerbal can walk around inside of and also a biosphere he could fly around in space.

This will be part of 1.2 (which i'll save releasing for a while) along with the IVAs for all the civilian population modules.

Link to comment
Share on other sites

These are looking really good :)

My concern would be launching them... something tells me FAR will not be impressed with giant spheres going supersonic xD Maybe an option for a foldaway construction that packs into a 3.75m tube and pops out to full size on demand? ^^

Link to comment
Share on other sites

These are looking really good :)

My concern would be launching them... something tells me FAR will not be impressed with giant spheres going supersonic xD Maybe an option for a foldaway construction that packs into a 3.75m tube and pops out to full size on demand? ^^

You really want to trust Bob with an acetylene torch?

I'd hope a ball would fly well. I'll need to grab FAR and see what happens.

The biodome framework is done. I decided against making them smart enough to remove kerbal helmets. I've turned my attention to the cruisers and generation ships you'll end up with by making some new gigantic structural parts:

mtV5eMu.png

ILlem2c.png

hUOa0bl.png

The structural girders you see are Netherdyne's Jumbo Truss Girder line. Parts included:

6mx6m cube hub, with and without 3 meter core

18mx18mx6m L girder (seen in the first screenshot)

18mx6mx6m Long truss

The truss parts are light because they're mostly welded iron pipes but give a sturdy surface to build generation ships and cruisers out of.

There is also the cruiser landing leg (seen in the last screenshot), which lofts a land base or cruiser up off the ground by up to 8 meters to protect it from the base kraken.

Link to comment
Share on other sites

  • 2 weeks later...

I am wrapping up my first major city build, design population is around 304 LGM. I am on a mod-planet that is in Kerbin's orbit but no civies have shown up. I accidentially built with the orbital dock but swapped in the ground dock by editing the save, maybe that caused a problem... Anyway, a universal algorithm to detect whether u are orbiting something is:

boolean recursive_is_orbiting(local_body, tgt_body) {

if(local_body == tgt_body) return true;

if(local_body.parent == null) return false;

return recursive_is_orbiting(local_body.parent, tgt_body);

}

2. Getting agriculture bootstrapped was kinda tricky because I didn't have any bioMass, I had to ship some up with kerbin using a dinky little multi-function container I had. My life-support tower is overbuilt by a factor of 100 because I wanted to have time to fix things before running out of supplies.

Lag is pretty horrible at the base. =P

Link to comment
Share on other sites

I'm planning to release 1.3 tonight so the recursive thing will wait till 1.4. I didn't expect people to mod planets into kerbin's SOI so it just reads if you're at "mun" or "kerbin" or "minmus".

Laggy base is to be expected as KSP does that with high part counts anyway. You can convert substrate into biomass if you have water on your base and substrate is found pretty much anywhere. It might not be on a modded planet unless it's supported in the community resource pack. I recently had to ship in water to a base I built for QA purposes last night and realized a glitch in the substrate converter. It would produce more water than it consumed.

Stay tuned.. probably by 7pm tonight I'll have the release out.

Some quick teasers!

New landing gear

djLzOsz.png

New textures on everything

RQ9TZMe.png

The test base from last night. The biodome farm has a new texture and it's now properly re-oriented as the Mk2. The original model is kept as the mk1 so I don't end up destroying all your bases when you update it.

8LDqPBr.png

Funny thing is my test base doesn't enough supplies to sustain the 140 population cap it has. The plus side is that it doesn't lag KSP.

Edited by michaelhester07
Link to comment
Share on other sites

okay, kewel.... Here's a snapshot of what I had built:

zYc7psS.jpg

In somewhat related news, I've been trying to fix up that lab from ur StanfordTorus kit because it's one of my faves, I got the exterior texture back... Things look great from the EVA view except for the kerbal's rotations but the IVA view is foobar, I had it working before but it got messed up when I started using Unity to work on this. IVA kerbals are in position but the floor and everything else is rotated 90 degrees and pointed toward the north on the KSP pad.

Wishlist for that part:

Raster Prop Monitor live orbital display over monitor screen.

Get the damn airlock to work again, I totally botched it...

Radiation-proof glass like you find on airplanes, real spaceships.

general fit and finish improvements.

I'm not sure what your workflow is...

By the way, notice the exception report in that screenshot, I'm seeing thousands of "PipLines.[C.P.R].ApplyCalculations exceptions...

Link to comment
Share on other sites

Those exceptions are they from 1.3 or 1.2 civilian pop? I'm pretty sure I didn't see anything but I'll have to take a look.

If you're rebuilding the IVA for the science center there's an easy way to go about it:

Open the External file.

Duplicate the core game object, move it to the right or left. Name it "internal". Rotate it -90 degrees on X.

Rotate the model under the new "internal" 90 degrees on X. This will let you view it properly when you edit it.

I can give you the unity project so you can maintain the stanford torus mod if you want it with my original models in it.

I came to this post to update on the roadmap for 1.4.

Obviously the movie theater didn't get IVAs yet (and i hope you had one in your base). This is because I don't have a plugin to play movies. I'll look at that but there is something more pressing to solve in 1.4: to set out and create the actual namesake for the pipelines namespace: pipelines. Being better at modding now I can make the pipelines mod. It will become part of Civilian Population 1.4. Here's the design plan:

The pipeline system will implement a network. A scenario config will be used to track the networks on a planet.

- Each ship which wishes to use the pipeline has a pipeline installer part. This part allows a ship to register on the planet's network. The initial node on the network does not have to do additional setup work.

- Subsequent nodes which will join it will have to pay a cost in rocket parts and build time. Network will likely cost between 1-10 rocket parts per meter distance to the nearest node. During install the rocket parts from an existing network may be used to expand the network. This expansion is processed on the new node. Maximum network connection range will be 10 km.

- Installation for a 10km pipeline will likely take 1 kerbin month.

- The pipeline is severed if a ship leaves the landed state for more than 3 seconds. Severed pipes need to be rebuilt for the full construction cost.

- Once a ship is connected to the network it submits its resources and delta-resource rate to the network. It then gains the full network resource capacity and delta resource. It will be desirable to have the network node part on landing legs of some kind. I'll have to update the mass of the part to adjust for the resource change.

- Gaining the full network capacity will be the tricky part as it will have to combine almost all in-situ resource generators in existence through every mod. I'll initially have support for regolith based converters and stock generators. Solar panels will be assumed to be on a duty cycle of 50% of their full rated output (to account for planetary rotation). Other generators will submit their current production to the network as is.

- All resources will be capable of being sent through the pipeline network, even civilians :)

- Planets may have multiple networks on them. If two networks have nodes closer than 10km together they'll join into a single network.

I'll be doing the theater IVA as well.

Link to comment
Share on other sites

I have to say I love your mods, simply because of the sheer scale of things. The game gets awfully laggy when you try to stuff hundreds of kerbals into one ship, so I decided I need a civilian population mod to expand my empires beyond mere dozens of kerbals. Until I stumbled across this gem I though I'd have to hack something together myself, but great minds think alike it seems. Keep them coming :D

Edited by Yski
Link to comment
Share on other sites

An update on the progress of the pipeline idea

So it turns out that I can directly modify the resources on unloaded ships. It's a bit more complicated than the usual part.requestResource() thing. The last part for pipelines is simulating the resources that are changing on the unloaded parts in realtime, down to the modules in use on it. This is fairly difficult as I need to simulate every generator in every existing mod. To be frank, there's a strong chance that most mods that make their own generator won't be supported in live unfocused resource updates.

Pipelines will support generators in stock, MKS, and Regolith.

Here's how unfocused resource modification works...

The FlightGlobals variable has to carry certain data about ships so that they can be loaded and unloaded properly. It has a list of Vessel objects for all of the current vessels. Each vessel has a variable "IsLoaded" which tells if it's loaded. If the vessel is loaded then I can get resources directly from it with the part.requestResource() method. If the vessel is not loaded then there is a "ProtoVessel" which contains the information I need.

ProtoVessel contains ProtoPart which contains the resource definitions, stored as a config node. To get resources from the unloaded vessel I parse that protopart, grab what I need, then write back what's left. The result is live access to resources on all ships, regardless of whether they're loaded. This part is working properly as expected even. I setup 2 ships outside of "local area network" range (2.4km) and was able to use resources on the unloaded ship from my main ship. The last part is simulating the resource changes on the ship. This is the tricky part.

During my test for this I zeroed all of the resources on every ship in my sandbox from my loaded ship.

The end result is two types of network.

The "local area network" (LAN) contains the loaded ships. Loaded ships will process in realtime, so I don't need to simulate anything on them.

The "Wide area network" (WAN) contains the unloaded ships. Unloaded ships will need to be simulated.

What I'll end up doing is each "live" ship registers the state of its generators on the pipeline network part module. This keeps me from having to cross reference generators on the part with its config. I don't know how savegame loads do that. I surmise though if one were to swap the order of modules in the save file (or in the config) that one could break their ship's modules as modules don't have IDs stored in the savefile. If they did this paragraph would be way different. I'll see if I can get an initial version working tonight. If I can then for at least regolith supporting mods the modules on the pipeline network will update constantly, even while away, rather than simply simulating what happens when you get back. I'll add support for mods as time goes on.

Edited by michaelhester07
Link to comment
Share on other sites

Heh new bump, cause I finally got the wide area network working!

Supported generators (Regolith, Stock electricity generators) will update in real time while unfocused if they're on the WAN.

-Solar panels: solar panel simulation is tricky as to truly accurately simulate it I need to know if the ship is currently in sunlight. I got the altitude correctly for Kerbin, but may need to update it for sub-bodies, so long as they're not the sun.

- RTG: fully supported :)

- Regolith: I simulate the results of the regolith generators and harvesters. This is so far 100% working.

Any generator not supported in the WAN simulation is considered to be inactive on the network when unloaded. Most mod generators will calculate their changes when you get back to the ship. They don't give any benefit or draw any resource when unloaded. All loaded ships are on the LAN and will update as usual in real time.

I'm going to restrict the pipeline network to basic resources which could realistically be piped around a planet.

Electricity,

Water,

Food,

Ore (molten),

Metal (molten),

Oxygen,

CarbonDioxide,

Waste (mixed in water)

WasteWater

LiqFuel, Oxidizer

Karbonite and Kethane will be too dangerous to pipe through a network.

Resources not carried by the pipe network will have to be handled locally.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...