Jump to content

[1.7.X] Civilian Population [RELEASED : 07/04/2018]


Pamynx

Recommended Posts

I made some progress, Kerbals can now BREED (like rabbits) as you can see here :

Laythe colony
There are still some bugs I need to fix (Kerbal count is not remade after undocking, Only females seems to be created) and the natural growth is really to quick, I need to add age so that new born won't start breeding just after their birth. I will try to fix all this in the next pre-release, adding age ... and death by old age.
Edited by Pamynx
Link to comment
Share on other sites

3 hours ago, rabidninjawombat said:

Awesome!  i'm glad to see someone still keeping this alive. 

If i ever get enough spare free time again to actually mess around with KSP, id love to make up a few new models for some of the parts :)

Glad to see you back :)

If you have spare time, I indeed need help on many parts to make them work properly (see the TODO list :wink: )

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi,

I have few questions : I am planning to play with galactic neghborhood with tons of star systems so,

1- for getting the first few civils into a station do we need to be in kerbin's orbit?

2- what is the birth rate? I mean, if i move a colony with lets say 4 civilians away from kerbin and it's target star system is the farthest star in the galaxy, when would a station with 10 of your biggest (civil capacity vise) parts become full without any more room?

3- what will happen if the station is full with capacity and the birth ability is still active?

Edited by Jiraiyah
Link to comment
Share on other sites

I invite you to get the version I am currently testing, and just released for you (2.0.11). This will help me if you encounter any bug or have any feedback !

This version adds the age of the kerbals into the equation.

Here are the answers to your questions for this version :

1 - In order to get your first civilian, you need a civilian docking port active in Kerbin SOI (Kerbin, Mun, or Minus orbit), not landed. Then contractors will send civilian to your station. You will have to wait 85 kerbin days (double for Mun or Minus) between each contractor mission. The other option is to recruit the civilian and fly him as regular Kerbals anywhere. Note that pilots, engineer, and scientist breed too.

2 - In the last version (2.0.11), the birth rate is more "realistic", females will have a young roughly 1 per kerbin year (426 Kerbin day), between the age of 15 to 45 year. Provided at least a male is present in the station and breeding is allowed.

There is a lot of random of course, but as the "Civilian Large Apartment Complex" have room for 60, you want your population grow from 4 to 600. Let's also assume your initial population is made of 2 males and 2 females in age to have kids (15 year old).

I made a simulation ( if you can read .Net code, the simulator is here : CivilianPopulation/plugin/src/test/cs/InfraConsole/CivilianPopulationGrowthSimulator.cs , I just modified the values to match your request ) and the station was full after 40 years.

3 - In case of birth in a station full, the kid is lost.

If you prefer security, try the version 2.0.10, but in that case kerbals have babies at any age and won't die from their old age.

Link to comment
Share on other sites

4 hours ago, Pamynx said:

I invite you to get the version I am currently testing, and just released for you (2.0.11). This will help me if you encounter any bug or have any feedback !

This version adds the age of the kerbals into the equation.

Here are the answers to your questions for this version :

1 - In order to get your first civilian, you need a civilian docking port active in Kerbin SOI (Kerbin, Mun, or Minus orbit), not landed. Then contractors will send civilian to your station. You will have to wait 85 kerbin days (double for Mun or Minus) between each contractor mission. The other option is to recruit the civilian and fly him as regular Kerbals anywhere. Note that pilots, engineer, and scientist breed too.

2 - In the last version (2.0.11), the birth rate is more "realistic", females will have a young roughly 1 per kerbin year (426 Kerbin day), between the age of 15 to 45 year. Provided at least a male is present in the station and breeding is allowed.

There is a lot of random of course, but as the "Civilian Large Apartment Complex" have room for 60, you want your population grow from 4 to 600. Let's also assume your initial population is made of 2 males and 2 females in age to have kids (15 year old).

I made a simulation ( if you can read .Net code, the simulator is here : CivilianPopulation/plugin/src/test/cs/InfraConsole/CivilianPopulationGrowthSimulator.cs , I just modified the values to match your request ) and the station was full after 40 years.

3 - In case of birth in a station full, the kid is lost.

If you prefer security, try the version 2.0.10, but in that case kerbals have babies at any age and won't die from their old age.

were can i find this test version? I'm all for it, specially if the dead mechanics work it would only serve for my purposes.

found that version on the first OP page. woot, although it will take time but I think it's a much needed system for a mod like this. you and people like you are great men and women who put time and effort so that others enjoy their fun time, I really appreciate that. thanks

 

also, on a second thought, 1 baby per year, hmm, can you set a config file for this? because in human nature, that is not realistic, normally it would be a baby per 5 years the most and most of the time they stop after second or third baby although when it comes to modding, I'm not sure how would you track the number of babies but at least, increasing the gap for pregnancy would reduce the number of birth because you have age limit there? so 30 years of ability, lets say every 6 years a female would become pregnant, that would let her have only 6 babies instead of 30 ! also, for the male/female ratio, it's not that hard, each time you want to provide a baby, you generate a random number between 0 and 1, if it was bellow 0.25 then the baby becomes male, above that would become female and let's just say between 0.245 and 0.255 it would become a fail pregnancy that ended up with abortion, although the abortion rate in reality is higher than that but reducing the number of possible births would be a limiting factor on this. you can also provide these numbers in the config file so that if people desire they can change them?

Edited by Jiraiyah
Link to comment
Share on other sites

In fact it is even more than 1 baby per year. Here is how it works in detail :

- Each kerbal in age (15 year or more) have 1 out of 3 chances to be "in the market".

- Kerbals in the market will find a match in the market, any excess male or female will be left behind.

- If the female in the couple is in age (45 year or less) and not pregnant, there 1 out of 10 chances that she turn pregnant.

This happens every day.

After 3/4 year (319 days), a young kerbal will be born (50% male, 50% female).

That way during her 30 year period of fertility, a female kerbal can have tons of babies which is not very realistic, it only mathematical and "nature", no moral, no birth control, no fail pregnancy.

 

What is done :

- You can activate or stop the breeding process for your vessel (option in present in any civilian home part).

What could be done :

- Activate birth control on your vessel (Allow 1, 2, 3, etc. baby per female), but to do that I need to track the children count.

- Implement a fail pregnancy probability : Kerbal can have good medecine, space radiation can be a problem.

- Genetic consanguinity ?

- Moral and mariage, instead of "in the market" match making.

 

All this needs time, I prefer making baby steps and release often a playable plugin (and want to play myself :) ).

Link to comment
Share on other sites

2 hours ago, Pamynx said:

- Each kerbal in age (15 year or more) have 1 out of 3 chances to be "in the market".

- If the female in the couple is in age (45 year or less) and not pregnant, there 1 out of 10 chances that she turn pregnant.

This happens every day.

After 3/4 year (319 days), a young kerbal will be born (50% male, 50% female).

That way during her 30 year period of fertility, a female kerbal can have tons of babies which is not very realistic, it only mathematical and "nature", no moral, no birth control, no fail pregnancy.

I would look at the problem as simple as possible, if i could reduce the baby count just by tweaking the numbers I already have implemented, i would do that, when i read this, here is what i think :

1- reduce the chance of a female and to get into market after certain number of population, you can even use a linear reduction of chances there

2- reduce the chances of getting pregnant to even 1 out of 100

3- increase the gap between happening of this system to maybe every 3 days?

4- as i said, change the chances to 24.5% male 74.5% female and 1% failure.

these should be easier to implement, if you don't mind and just guide me to the place of birth mechanics in code, i may be able to put these into place

when you think about this, applying all 4 tweaks :

when the population rise, the chances of population get into market drops, now from those in market chances of getting pregnant dropped and the number of tries goes down even more and as time passes more females than males will be populated and still there is 1% chance of failure for birth at each pregnancy.

this should DRASTICALLY reduce the number of baby production,

and at the end, provide the ability for config tweak (something i am not familiar with) and you give flexibility to players to fine tune this for themselves if needed.

this approach may need as little coding and changing of the system as possible

Link to comment
Share on other sites

1- reduce the chance of a female and to get into market after certain number of population, you can even use a linear reduction of chances there

Could do, but not as simple as that to find a good reduction fonction.

2- reduce the chances of getting pregnant to even 1 out of 100

Easy to set up, I plan to expose the values I use to allow people to tweak the mode to their desire.

3- increase the gap between happening of this system to maybe every 3 days?

This is a no, it is easier and more logical to reduce the chances to "go in the market" by a factor 3 for the same result.

4- as i said, change the chances to 24.5% male 74.5% female and 1% failure.

Why do you want 4 times more females than male ? But I should indeed introduce a chance of death on birth... A chance of miss miscarriage each day.

Next step in my todo list, add the ability to change the different probabilities (and bug fixing of course).

Link to comment
Share on other sites

37 minutes ago, Pamynx said:

Why do you want 4 times more females than male ? But I should indeed introduce a chance of death on birth... A chance of miss miscarriage each day.

lol sorry sorry, i'm a medical doctor, academic education shows itself here and there, in reality the chance of a human baby to be a boy is 25% vs 75% being a girl because of genetics. that was the only reason :D

about the way of calculating the drop value, did you think of animation curves in unity? you can provide a curve and evaluate it by giving a number and it will give you the result? the shape of the curve can easily be recreated by code.

also, why tracking the every three day is hard? i would think that a float value for cool down that would be reduced properly each time you tick the system would do the trick? when it gets to 0 or bellow, you can go for birth and at the same time put the cool down float back to what it should be for another period of time?

Edited by Jiraiyah
Link to comment
Share on other sites

Quote

lol sorry sorry, i'm a medical doctor, academic education shows itself here and there, in reality the chance of a human baby to be a boy is 25% vs 75% being a girl because of genetics. that was the only reason :D

> What ? I will need a reference here (First link in google search : https://www.scientificamerican.com/article/is-a-pregnant-womans-chan/ )

About making curves... well, I do not know how to do that, and I think it is not the priority :)

Changing from 1 to 3 days is possible of course but reducing the probability each day will do the trick and be more logical in the structure of the plugin as rent and death are also once a day events.

 

Edited by Pamynx
Link to comment
Share on other sites

2 minutes ago, Pamynx said:

lol sorry sorry, i'm a medical doctor, academic education shows itself here and there, in reality the chance of a human baby to be a boy is 25% vs 75% being a girl because of genetics. that was the only reason :D

> What ? I will need a reference here (First link in google search : https://www.scientificamerican.com/article/is-a-pregnant-womans-chan/ )

About making curves... well, I do not know how to do that, and I think it is not the priority :)

Changing from 1 to 3 days is possible of course but reducing the probability each day will do the trick and be more logical in the structure of the plugin as rent and death are also once a day events.

 

OUCH, I should stop my brain when it passes mid night (2 AM here), men are XY and women are XX, for a male child we need XY match, now, during the gestation, the x and y component separate and try their chance with each other :

  X Y
X XX YX
X XX YX

Yah you are right, chances are 50-50 stupid me

 

Link to comment
Share on other sites

Pfiou I was about to think all I learnt were just fake news made by reptilians and illuminaties :D

Anyway, this could also be an editable parameter, why not 3 boys (Jeb, Bill, Bob) for 1 girl (Valentina) ? :)

Default should be 50/50 anyway.

Link to comment
Share on other sites

 

9 hours ago, Pamynx said:

@CaptKordite : do you have the "Community Resource Pack" installed ?

I've tried with several versions. CRP v0.7.2.0 for 1.3, the previous CRP v0.6.5.0 for 1.1, and the current CRP v0.8.0 for 1.3.1. All the same results. Some modules have content, the Small Fertilizer Tank, for example, but the other tanks show nothing. The Small Hydroponic Garden in the VAB just has an "Activate" button and, when launched, has only "Status: Moving". Nothing seems to consume electricity.

Again, I suspect this is because I'm running 1.3.0 and I don't plan on upgrading until Making History and 1.4 is out (I don't want to start over a career again). If there's not a simple fix already known, I don't expect much troubleshooting on an old version. I just wait for the fully up to date version later.

Link to comment
Share on other sites

I'm having an issue. I'm getting about 48 exceptions a second with this mod. Here's the exception:

 

ArgumentException: An element with the same key already exists in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,CivilianPopulation.Domain.Repository.CivPopVessel].Add (System.String key, CivilianPopulation.Domain.Repository.CivPopVessel value)
    CivilianPopulation.Domain.Repository.CivPopRepository.Add (CivilianPopulation.Domain.Repository.CivPopVessel vessel)
    CivilianPopulation.Infra.CivilianPopulationModule.UpdateRepository (CivilianPopulation.Domain.Repository.CivPopRepository repo)
    CivilianPopulation.Infra.CivilianPopulationModule.FixedUpdate ()

Any idea where I should start looking? Modlist below (CKAN installed everything but civiliam pop as it crashes trying to install it for some reason):

    kind: metapackage,
    abstract: A list of modules installed on the default KSP instance,
    installed-default,
    license: unknown,
    version: 2018.01.15.04.38.39,
    identifier: installed-default,
    spec_version: v1.6,
                AirlockPlus
            ModuleManager
            xScience
            ActionGroupManager
            AllYAll
            AmpYearPowerManager
            KerbalAlarmClock
            KerbalEngineerRedux
            Toolbar
            Chatterer
            REPOSoftTech-Agencies
            TransferWindowPlanner
            JSIAdvancedTransparentPods
            EnvironmentalVisualEnhancements
            SCANsat
            KSP-AVC
            PreciseManeuver
            TacFuelBalancer
            AviationLights
            BetterBurnTime
            BetterCrewAssignment
            BetterTimeWarpCont
            DiverseKerbalHeads
            ChattererExtended
            CommunityResourcePack
            CommunityTraitIcons
            PortraitStats
            DistantObject
            CrowdSourcedFlags
            CrowdSourcedScience
            CustomAsteroids
            CustomAsteroids-Pops-Stock-Inner
            CustomAsteroids-Pops-Stock-Outer
            CustomAsteroids-Pops-Stock-Stockalike
            DatedQuickSaves
            LSPFlags
            MagiCore
            CanadianFlags
            EntchenFlag
            DockingPortAlignmentIndicator
            DogeCoinFlag
            EditorExtensionsRedux
            EVAEnhancementsContinued
            EVAHandrailsPackContinued
            JanitorsCloset
            KIS
            KAS
            FinalFrontier
            ForScience
            IndicatorLights
            ConfigurableContainers
            Hangar
            AT-Utils
            ConfigurableContainers-Core
            KerbalJointReinforcement
            CommunityCategoryKit
            InfernalRobotics
            KerBalloons
            Konstruction
            MechJeb2
            MechJebForAll
            KEI
            RCSSounds
            InterstellarFuelSwitch-Core
            SnapDock
            ReCoupler
            ReentryParticleEffect
            InfernalRobotics-LegacyParts
            TweakScale
            SimpleConstruction
            FirespitterCore
            USITools
            DistantObject-default
            TakeCommandContinued
            ExceptionDetector
            MemGraph
            TriggerAu-Flags
            Trajectories
            TextureReplacerReplaced
            Ceteras-Suit-Pack

Edited by CttCJim
formatting and typo
Link to comment
Share on other sites

It means that you have 2 vessels with the same "Universal Unique Identifier", which should not happen...

How many vessels do you have ? Do you have EVA ? Many debries ? Any mod that create stuff (like asteroids for examples) ? Made docking and undocking ?

Will try to fix this asap.

Link to comment
Share on other sites

It's an almost-new save, all I have in the sky is 6 satellites. I even removed a bunch of mods like CustomAsteroids to try to fix this last night. Also just tried creating a new game on sandbox, still getting the error. All mods aside from this one installed by CKAN, and i'm using the custom DLL for [x]Science that reduces its performance hit.

 

current modlist:

KSP: 1.3.1 (Win64) - Unity: 5.4.0p4 - OS: Windows 10  (10.0.0) 64bit
Toolbar - 1.7.16.5
USI Tools - 0.10.1
AirlockPlus - 0.0.9
AllYAllContinued - 0.11.13.2
BetterTimeWarpContinued - 2.3.9
Community Category Kit - 2.0.2
Community Resource Pack - 0.8
Community Trait Icons - 0.1.2
Crowd Sourced Science - 4.1.2
DistantObjectEnhancement - 1.9.1
EditorExtensionsRedux - 3.3.16
EVAEnhancementsContinued - 0.1.12.1
Firespitter - 7.6
Interstellar Fuel Switch - 2.10.3
Kerbal Attachment System - 0.6.3
Kerbin Environmental Institute - 1.2.3
Kerbal Engineer Redux - 1.1.3
Kerbal Joint Reinforcement - 3.3.3
Kerbal Inventory System - 1.9.6571.274
KSP-AVC Plugin - 1.1.6.2
MagiCore - 1.3
Infernal Robots - 2.0.14
Docking Port Alignment Indicator - 6.7
EVAHandrailsPackContinued - 0.2.1.6
Final Frontier - 1.3.6.3189
Portrait Stats - 1.0.15.1
Precise Maneuver - 2.3.2
RCS Sounds - 5.2
ReentryParticleEffect - 1.2.0.1
SCANsat - 1.1.8.2
Simple Construction - 3.4.6
Extraplanetary Launchpads - 5.9
TAC Fuel Balancer - 2.14
TextureReplacerReplaced - 0.5.4
Trajectories - 1.7.1
Kerbal Alarm Clock - 3.8.5
Transfer Window Planner - 1.6.2
TweakScale - 2.3.7
Konstruction - 0.3
[x] Science! - 5.11

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