Author Topic: [MOD] Minister version 1.0b5  (Read 5381 times)

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
[MOD] Minister version 1.0b5
« on: February 29, 2012, 04:20:53 AM »
So, I love Star Ruler, but there are few things I really wasn't happy about.
Fortunately, SR is highly mod-able.

It all started out with a mod called "Smart Gov". I tried it, and I ran into troubles.
I thought, heck, I can poke around in the code and see what is wrong.
I tried to fix what I though was broken, and it started to snow ball, ended up pretty much rewriting the whole thing.
I also found few issues with SR's base code, so I fixed that.
Then, I got tired of AI out-multi-tasking me.

In the end, I have collection of code I call "Minister".
It's still work in progress, but it should be polished enough to call it beta.
Keep in mind, Ministers will not win you the war, that's your job.
But they will keep the menial tasks going so you can focus on more important things, like blowing things up.

The b5 has lots of features, and it should be pretty much final.


1.0b5
   Science Minister will now offer to research a ship design if importing fails due to lack of tech.
      If you select "Research", he will prepend queue items to make it a top priority.
      He will *not* ask, if "Import All" was used.
   Science Minster will automatically shift research strategies.
      He will pick a strategy from a collection of 'profiles'. He can switch strategy based on current
      level/importance of techs, research rate and/or war/peace status.
      He will research new tech, if wait time is acceptable.
      The player can select profiles (if they are available at time) manually.
         If the current profile becomes invalid, he will go back to selecting profile automatically.
      The more advanced players can edit the profiles in XML file.
   Science Minster will tag the sub-systems in the blue prints with tech level when exported.
      When importing, he will warn you if your tech does not meet the exported level.
      He will *not* warn, if "Import All" was used.
   Auto Research can no longer be turned off.
   Expansion Minister will coordinate with your invation effort. If you are winning in a system,
      she will make it her priority to colonize that system.

1.0b4
   Expansion Minister will check the food/lux supply before building farm/lux world.
   She will send out ColonyShips to under defended system if she knows there is no piracy in the universe.
   Removed Shipyard and Cargo in Farm/Research/Lux world.
      If you do not build Haulers, trying to build anything in these world will be very slow.
   Removed Space Port from Lux/Research.
      Note, if you use Colonizer with 3 or more slots, ports are built by initial landing.
      Minister will remove these ports at very last step.
   Fixed build_queue to have Minister take over just after building Capitals.
   Defense Minister will no longer retrofit the only Military Outpost in the system.
      He will build a new one before taking down the old one.
   Military Minister now have control over rallying of ships
      Rallying ships now use Jump Drive, if they has one.
      Rally now only affect war-ships (ships with both weapons and engines).
      Rallying can be set at site and/or system level.
         The site rally point will take priority over system rally point.
      When entering a system, war-ships will check the systen rally point, and move on, if they are not needed.
         This is also true for the system where the war-ships are built.
         This behavior will effectivly create patrol path of war-ships.
      You will no longer get nice line pointing to the rally point. It's a side-effect of new Rallying system.
   Governors have been sent to re-education camp. They can now count the population of planet correctly.
   They will now upgrade both Galactic Capital and Planetary Capitals.
   Science Minister will turn on Auto-Research by default, and set the first technology to General Science.
   He will also allow save/loading for research queues.
      The research queue can contain un-locked technology, when he encounters these, he will try to unlock it.
   He will hide away those embrassing default ship designs, and import all he can from his own stash, if he has any.
   Default Minister Settings are now configurable in Settings.txt. It also have some settings that are not in GUI.

1.0b3 - Updated for 1.2.1.0
   Fixed the bug that cause it to crash under 1.2.1.0
   The Defense Minster was assassinated, he was found strang outside one of over-produced 'Military Outpost'.
      New one is taught to read the defense strength report before building more.
      He will make his own decision how many 'Military Outpost' to build per system.
   Domestic Minister will now retrofit Haulers.
      He will also obey the number of Haulers he is suppose to make.
   Balanced/Ecconomic Governer was punished for oscillating between building and destroying the last slot.
   Fixed error on importing carriers. Now it should work with blueprints created with base-game.

1.0b2 - Updated for 1.2.0.0
   Updated code to match 1.2.0.0 where needed.
   b2 actually work as mod, rather than the patch.
   Removed bug fixes that are included with 1.2.0.0.
        Carrier remember its fighters
        Crash fix on fleet command, docked Dry Dock.
   Defense Minister was found guilty of not retrofitting. He's been shot, and his replacement should know better.
      The new Defense Minister is also easier on the pocket book, and will construct multiple stations per planet
         only if he can afford it.
      He does insist on the first one, however.
   When importing a carrier with default fighter, the Minister will look for the figher. If it is not found, he will
         try to import the figher first, then the carrier.
      This behavior was included with b1, as bug fix for the carrier to remmeber the fighters.
      The 1.2.0.0 does fix the bug, but the carrier will still forget the fighter if the fighter was not imported
         first.
   Expansion Minister will now reserve tiwce the resource before sending out the Colony ships off-system.
   Domestic Minister will build Haulers once the 2nd planet is colonized in the system.
      You can set number of Haulers to be built per system.
      The layout used is 'Hauler'.
   Fixed transparent Hover on system window.

1.0b1 - Initial Beta
    Domestic Minister will drag out the current governors and shoot them, replace them with someone with bit more
         brain.
        Every Planet will make Ship Yard/Farm/Metal mining/Cargo/City/Port.
        Balanced will make Metal/Elec/Adv, in somewhat balanced ratio, and Goods (if not eusocial).
        Economic will Metal/Elec/Adv, in somewhat balanced ratio. also remove metal mining when it runs out of ore.
        Production world (Metal/Elec/Adv/Farm) will make what they are suppose to.
        All your production worlds will evaluate the population bonus and make decision on how many cities/ports
         would be optimal.
        All your production world will consider the planet condition and adjust the mix.
        Ship yard/Construction world will maximize the import/cargo, I use these with Dry Docks and Haulers.
        Outpost/Ship yard has Fuel/Ammo.
        Research will make Labs.
        Luxury world will make Luxuries, and Goods if your bank seems low (make sure you get rid of extra Goods from
         these world when your bank start to fill up, Minister is slow on removing them by design).
    Expansion Minister will order your planets to make 'Colony Ship's and send them out.
        The layout he uses must be named 'Colony Ship' I usually have handful of design with this name, but rename
         the files to 'Colony Ship1.xml' (or 2, 3, etc), this way, when you import all, it will pick the most advanced
         ones that your empire can build.
        He will check your defense and avoid over-colonization.
        He will check your bank and avoid over-expansion (configurable).
        He will tell the ship captains to USE THE JUMP DRIVE.
        He will try to avoid the system with allies, it's just rude to colonize planets under your friend.
        He will try to assign larger planets to Balanced/Economic, leaving smaller ones to research/farm/luxury (in
         that order). You can override his decision, he only does this when you first takeover.
    Defense Minister will construct 'Military Outpost' on your planets to defend against bad guys.
        The layout he uses must be named 'Military Outpost'. Same trick apply to this as the Colony Ship.
        He will build more as your empire grows, up to the maximum number you configure.
        He will retrofit really old ones.
    Ministers are not TOO smart or fast, (again, by design), but they should free you up to do what you like doing
      the best (I assume you like what I like, that's to blow things up).
    Some GUI/bug fixes.
        Carrier remember its fighters
        Moved the 'Delete' button on loading construction queues, I kept hitting that instead of 'Ok'.
        Crash fix on fleet command, docked Dry Dock.
        Planets will no long have both Rich and Scattered Ore.
        Mouse over the system window and you get tool-tip. (I know it's kind of hard to read, but best I can do for
         now).
        Sub-system accordion is MUCH faster for those of us that like large design window.
« Last Edit: January 09, 2013, 12:02:05 PM by Jyin »

stevedrumsdw

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Checking interest for Mod/Patch, that I am working on.
« Reply #1 on: February 29, 2012, 04:30:57 AM »
Release it, I love this game as well, just needs some more mods!

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Checking interest for Mod/Patch, that I am working on.
« Reply #2 on: February 29, 2012, 02:45:54 PM »
There you go, let me know how it works.
Remember it's still beta, and I can use all the help with testing/feedback.

Lord_Raith

  • Sentient
  • **
  • Posts: 52
  • Karma: +4/-1
    • View Profile
Re: Checking interest for Mod/Patch, that I am working on.
« Reply #3 on: February 29, 2012, 10:52:22 PM »
Hell, if this mod does HALF of what you claim it does, it would be a MASSIVE success.

Definitely DLing.

losarn

  • Newbie
  • *
  • Posts: 46
  • Karma: +2/-0
    • View Profile
Re: Checking interest for Mod/Patch, that I am working on.
« Reply #4 on: March 01, 2012, 02:12:03 PM »
if you can somehow make it so that the AI will use the jumpdrive...
I WILL GIVE YOU A SPACE PUPPY

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Checking interest for Mod/Patch, that I am working on.
« Reply #5 on: March 01, 2012, 06:23:05 PM »
The aim for Minister is to assist Player. To that end, I've assigned limited AI to the player based empire. I think the computer AI can be modified to use Jump Drives, but it is out of scope of this mod.

If you are interested, here's the chunk of code from Minster regarding Jump Drive.
Code: [Select]
bool useJump = false;
Star@ star = null;

string@ strJumpDrive = "Jump Drive";
HulledObj@ hulled = ship;
if (hulled !is null && hulled.getHull().hasSystemWithTag(strJumpDrive)) {
SysObjList children;
children.prepare(sys);
if(children.childCount > 0) {
Object@ child = children.getChild(0);
@star = @child;

if( @star !is null ) {
useJump = true;
}
}
}

orders.clearOrders(false);
orders.giveGotoOrder(sys, false);
if( useJump ) {
orders.giveGotoOrder(ship.getParent(), false);
orders.giveUseToolOrder(strJumpDrive, star, true, true, false);
}
else {
orders.giveGotoOrder(ship.getParent(), true);
}
orders.prepare(null);

Another note, b1 has problem with retro-fitting sats, I will address that on b2.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
I finally have 1.2.0.0 running on my system (darn you steam!).
I am in the process of testing the b2 against 1.2.0.0 and hopefully post it soon.

Skye

  • Sentient
  • **
  • Posts: 129
  • Karma: +6/-0
  • OMG WTF
    • View Profile
awesome mod i love the ideas you have put forward, i assume the ministers are toggleable right? if not then it would be a good option under the empire window. i think this would be great for players who as you said are more interested in blowing stuff up rather than the micromanagement of an economy. Great Work!!  :D
SpeedDaemon said: " The jump drive is the single most powerful system in the game. A big bad-ass ship/fleet is useless if it can't get to where it needs to be bad-ass AT before the situation requiring its bad-assery is resolved."

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #8 on: May 11, 2012, 11:35:55 PM »
Yes, most of the Minister's feature is configurable.
The b1 had all sorts of issues it seems, it was my fault of not testing it as a mod, rather than a patch living inside of SR's base code.

The b2 should be better. Sadly, I haven't had a lot of time testing it.
But at least it should load as Mod w/o error, and I couldn't find any issues in first hour of (speedx10) auto-play.

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #9 on: May 19, 2012, 10:49:20 PM »
Just getting into seeing how the insides of Star Ruler function and your mod addressed a lot of issues I had as a new player. Im not sure if its because i change my growth rate values but the ministers still seem to leave behind too many cities. Decided id try to edit the research and farm governer scripts in your mod and came up with these. I noticed you didnt have a cargolvl value for automatically renovating those buildings.  Did i understand the rest of your planet.as file that this should work?


Code: [Select]
bool farmgov(Planet@ pl, Empire@ emp) {
float population;
float citylvl, farmlvl, portlvl, prodlvl, scilvl;
float citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive;
float foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate;
float ore;
float workrate, nextrate, prevrate;

analyzePlanet( pl, emp, population,
citylvl, farmlvl, portlvl, prodlvl, scilvl,
citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive,
foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate, ore,
workrate, nextrate, prevrate );

uint foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine;
float foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl;
bool offline = countStructures( pl, foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine,
foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl );


if( uint(pl.getStructureCount()) == uint(pl.getMaxStructureCount()) ) {
//TODO: check if we need to destroy anything

//only keep metal factories while we have ore
if( ore <= 0 ) {
if( pl.getStructureCount(metal) > 0 ) {
pl.removeStructure(foundmetprod);
return true;
}
} else {
if( pl.getStructureCount(metal) > (ore/1000000) ) {
pl.removeStructure(foundmetprod);
return true;
}
}

//we dont need other products on Farm World
if( pl.getStructureCount(elects) > 0 ) {
pl.removeStructure(foundelecprod);
return true;
}
if( pl.getStructureCount(advpts) > 0 ) {
pl.removeStructure(foundadvprod);
return true;
}
if( pl.getStructureCount(goods) > 0) {
pl.removeStructure(foundgengoods);
return true;
}
if( pl.getStructureCount(lux) > 0) {
pl.removeStructure(foundlux);
return true;
}
if( pl.getStructureCount(cannon) > 0 ) {
pl.removeStructure(foundcannon);
return true;
}
if( pl.getStructureCount(laser) > 0 ) {
pl.removeStructure(foundlaser);
return true;
}
if( pl.getStructureCount(fuel) > 0 ) {
pl.removeStructure(foundfuel);
return true;
}
if( pl.getStructureCount(ammo) > 0 ) {
pl.removeStructure(foundammo);
return true;
}

//OK we do allow a couple of these...
if( pl.getStructureCount(cargoblock) > 1 ) {
pl.removeStructure(foundcargo);
return true;
}
if( pl.getStructureCount(port) > 1 ) {
pl.removeStructure(foundport);
return true;
}
if( pl.getStructureCount(yard) > 1 ) {
pl.removeStructure(foundyard);
return true;
}

//cities are almost the last thing we want to dismantle
if( pl.getStructureCount(city) > 1 && population > wrequired + citygive ) {
pl.removeStructure(foundcity);
return true;
}

//we dont touch planetary shields/thrusters

// We only have buildings we want but not enough people to run them.
// Time to make room for another city
if( population < wrequired ) {
else if( pl.getStructureCount(scifac) > 0 ) {
pl.removeStructure(foundsci);
return true;
}
else if( pl.getStructureCount(farm) > 1 ) {
pl.removeStructure(foundfarm);
return true;
}
}
}
else {
//ensure minimum living quarters
if( population < wrequired ) {
pl.buildStructure(city);
return true;
}

//setup initial infrastructure
if( pl.getStructureCount(yard) < 1 ) {
pl.buildStructure(yard);
return true;
}
if( pl.getStructureCount(port) < 1 ) {
pl.removeStructure(foundport);
return true;
}
if( pl.getStructureCount(cargoblock) < 1 ) {
pl.buildStructure(cargoblock);
return true;
}
if( ore > 0 && pl.getStructureCount(metal) < 1 ) {
pl.buildStructure(metal);
return true;
}

//make sure we have enough ports for our export requirements
if( (combinedprodrate > portrate) ) {
pl.buildStructure(port);
return true;
}

if( population > wrequired + farmtake ) {
pl.buildStructure(farm);
return true;
}

// We dont have enough workers for another building so leave last slot empty
//   until renovations make something worthwhile to build (why waste resources)
}

//nothing destroyed, nothing built. Check for renovations

if( portlvl > 0 + foundportlvl ) {
pl.rebuildStructure(foundport);
return true;
}
if( farmlvl > 1 + foundfarmlvl ) {
pl.rebuildStructure(foundfarm);
return true;
}
if( citylvl > 0 + foundcitylvl ) {
pl.rebuildStructure(foundcity);
return true;
}
if( prodlvl > 1 + foundmetprodlvl ) {
pl.rebuildStructure(foundmetprod);
return true;
}
if(  scilvl > 0 + foundscilvl ) {
pl.rebuildStructure(foundsci);
return true;
}

ResearchWeb web;
web.prepare(emp);
cargolvl = 1.f;
const WebItem@ itemMet = web.getItem("Cargo Storage");
if( itemMet !is null )
cargolvl = itemMet.level;
if( cargolvl > 0 + foundcargolvl ) {
pl.rebuildStructure(foundcargo);
return true;
}

return true;
}

If im learning from your mod well enough my next goal is to get the ministers upgraded so that they dont attempt to start construction or renovation of a building without having enough resources immediately available in the cargo hold. That should keep the ministers from stalling the economy when left unattended.

A tiny critique on your colonization minister. Havent looked at code yet but he is REALLY _INSANELY_ effecient. I had about 12 planets colonized then forgot to pause the game when I went into the blueprint editor to work on a new jump ship design. By the time i came out my empire had more than quadrupled in size.  If you take feature requests an option so colony ships are only built at docks, or maybe a rate adjustment to be able to slow it down would be nice.

Love playing the mod
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #10 on: May 20, 2012, 01:01:46 AM »
The minister does not really examine the cargo capacity.
He does build some, but he really rely on Haulers and Ports to get what he needs.
Yes, it could stall the economy, but he control that by slowing down the colonization.
You have good point about renovation, I will have to think about how I control that.

Minister will build cities to account of the population bonus, so, if the population bound of the city is higher than building resource, it will build city. That maybe the reason it seems like he builds too many.

As to efficiency, he actually is pretty slow compare to your computer opponents.
You can slow him even more by increasing the reserve resource in the setting.

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #11 on: May 20, 2012, 07:51:46 AM »
I know your ministers dont look at cargo capacity but they never _specifically_ try to renovate the cargo bay on the planet either.  they specifically look at other renovations and if they dont want to do one of them they do  'choose a random building and see if it needs upgraded'.  I removed that from my local copy as i dont want to waste resources on buildings not specifically intended for that planet.  Your mod is set up to retreive the citylvl, farmlvl and a few others but there is no 'cargolvl' variable already assigned to do the comparison I needed.  I was curious if i did the ResearchWeb portion of the code correctly since I have no idea where to find out the list of available strings.
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #12 on: May 20, 2012, 03:27:31 PM »
OK have some tweaking done to my new farm governor and research governor.  Code is:

Code: [Select]

bool agragov(Planet@ pl, Empire@ emp) {
float population;
float citylvl, farmlvl, portlvl, prodlvl, scilvl;
float citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive;
float foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate;
float ore;
float workrate, nextrate, prevrate;

analyzePlanet( pl, emp, population,
citylvl, farmlvl, portlvl, prodlvl, scilvl,
citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive,
foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate, ore,
workrate, nextrate, prevrate );

uint foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine;
float foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl;
bool offline = countStructures( pl, foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine,
foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl );


if( uint(pl.getStructureCount()) == uint(pl.getMaxStructureCount()) ) {
//TODO: check if we need to destroy anything

//only keep metal factories while we have ore
if( ore <= 0 ) {
if( pl.getStructureCount(metal) > 0 ) {
pl.removeStructure(foundmetprod);
return true;
}
} else {
if( uint(pl.getStructureCount(metal)) > uint(1 + sqrt(ore/1000000)) ) {
pl.removeStructure(foundmetprod);
return true;
}
}

//we dont need other products on Farm World
if( pl.getStructureCount(elects) > 0 ) {
pl.removeStructure(foundelecprod);
return true;
}
if( pl.getStructureCount(advpts) > 0 ) {
pl.removeStructure(foundadvprod);
return true;
}
if( pl.getStructureCount(goods) > 0) {
pl.removeStructure(foundgengoods);
return true;
}
if( pl.getStructureCount(lux) > 0) {
pl.removeStructure(foundlux);
return true;
}
if( pl.getStructureCount(cannon) > 0 ) {
pl.removeStructure(foundcannon);
return true;
}
if( pl.getStructureCount(laser) > 0 ) {
pl.removeStructure(foundlaser);
return true;
}
if( pl.getStructureCount(fuel) > 0 ) {
pl.removeStructure(foundfuel);
return true;
}
if( pl.getStructureCount(ammo) > 0 ) {
pl.removeStructure(foundammo);
return true;
}

//OK we do allow a couple of these...
if( pl.getStructureCount(cargoblock) > 1 ) {
pl.removeStructure(foundcargo);
return true;
}
if( pl.getStructureCount(yard) > 1 ) {
pl.removeStructure(foundyard);
return true;
}
if( pl.getStructureCount(port) > 1
&& combinedprodrate < portrate - portgive ) {
pl.removeStructure(foundport);
return true;
}

//cities are almost the last thing we want to dismantle
if( pl.getStructureCount(city) > 1 && population > wrequired + citygive ) {
pl.removeStructure(foundcity);
return true;
}

//we dont touch planetary shields/thrusters

//Handle overworked population
if( population < wrequired ) {
if( pl.getStructureCount(scifac) > 0 ) {
pl.removeStructure(foundsci);
return true;
}
else if( pl.getStructureCount(farm) > 1 ) {
pl.removeStructure(foundfarm);
return true;
}
}
}
else if( offline ) {
//if we have a building offline the only NEW buildings we will make are cities.
if( population < wrequired ) {
pl.buildStructure(city);
return true;
}

//we're still willing to renovate old buildings
}
else {
//ensure minimum living quarters
if( population < wrequired ) {
pl.buildStructure(city);
return true;
}

//setup initial infrastructure
if( pl.getStructureCount(yard) < 1 ) {
pl.buildStructure(yard);
return true;
}
if( pl.getStructureCount(port) < 1 ) {
pl.buildStructure(port);
return true;
}
if( pl.getStructureCount(cargoblock) < 1 ) {
pl.buildStructure(cargoblock);
return true;
}
if( ore > 0 && uint(pl.getStructureCount(metal)) <= uint(pl.getStructureCount(farm))
&& uint(pl.getStructureCount(metal)) <  uint(1 + sqrt(ore/1000000) )) {
pl.buildStructure(metal);
return true;
}

//make sure we have enough ports for our export requirements
if( (combinedprodrate > portrate) ) {
pl.buildStructure(port);
return true;
}

//if we have a huge food surplus we build sci labs instead
if( population > wrequired + farmtake ) {

double val = 0;
double inp = 0;
double outp = 0;
double demand = 0;
emp.getStatStats(strFood, val, inp, outp, demand);
if( val < 1000000 || foodrate < farmprodgive ) {
pl.buildStructure(farm);
return true;
}
}
if( population > wrequired + scitake ) {
pl.buildStructure(scifac);
return true;
}

//didnt have enough free labor to work another farm and this isnt last slot
if( uint(pl.getStructureCount()) + 1 < uint(pl.getMaxStructureCount()) ) {
pl.buildStructure(city);
return true;
}

// We dont have enough workers for another building so leave last slot empty
//   until renovations make something worthwhile to build (why waste resources)
}

//nothing destroyed, nothing built. Check for renovations

if( portlvl > 0 + foundportlvl ) {
pl.rebuildStructure(foundport);
return true;
}
if( farmlvl > 0 + foundfarmlvl ) {
pl.rebuildStructure(foundfarm);
return true;
}
if( citylvl > 0 + foundcitylvl ) {
pl.rebuildStructure(foundcity);
return true;
}
if( prodlvl > 1 + foundmetprodlvl ) {
pl.rebuildStructure(foundmetprod);
return true;
}
if(  scilvl > 1 + foundscilvl ) {
pl.rebuildStructure(foundsci);
return true;
}

ResearchWeb web;
web.prepare(emp);
float cargolvl = 1.f;
const WebItem@ itemMet = web.getItem("Cargo Storage");
if( itemMet !is null )
cargolvl = itemMet.level;
if( cargolvl > 0 + foundcargolvl ) {
pl.rebuildStructure(foundcargo);
return true;
}

return true;
}


bool resgov(Planet@ pl, Empire@ emp) {
float population;
float citylvl, farmlvl, portlvl, prodlvl, scilvl;
float citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive;
float foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate;
float ore;
float workrate, nextrate, prevrate;

analyzePlanet( pl, emp, population,
citylvl, farmlvl, portlvl, prodlvl, scilvl,
citygive, farmprodgive, portgive, metprodgive, elecprodgive, advprodgive, gengoodsprodgive, luxprodgive,
foodrate, portrate, metprodrate, elecprodrate, advprodrate, goodsrate, combinedprodrate, ore,
workrate, nextrate, prevrate );

uint foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine;
float foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl;
bool offline = countStructures( pl, foundsci, foundmetprod, foundelecprod, foundadvprod, foundgengoods, foundlux, foundcity, foundbunker, foundfarm, foundcannon, foundlaser, foundshield, foundport, foundyard, foundfuel, foundammo, foundcargo, foundpengine,
foundscilvl, foundmetprodlvl, foundelecprodlvl, foundadvprodlvl, foundgengoodsprodlvl, foundluxprodlvl, foundcitylvl, foundbunkerlvl, foundfarmlvl, foundcannonlvl, foundlaserlvl, foundshieldlvl, foundportlvl, foundyardlvl, foundfuellvl, foundammolvl, foundcargolvl, foundpenginelvl );

//print( "Planet " + pl.toObject().getName()
// + " Prod: " + standardize(combinedprodrate)
// + " Port: " + standardize(portrate)
// + " Population: " + standardize(population)
// + " wrequired: " + standardize(wrequired)
// );

if( uint(pl.getStructureCount()) == uint(pl.getMaxStructureCount()) ) {
if( ore <= 0 ) {
if( pl.getStructureCount(metal) > 0 ) {
pl.removeStructure(foundmetprod);
return true;
}
} else {
if( uint(pl.getStructureCount(metal)) > uint(1 + sqrt(ore/1000000)) ) {
pl.removeStructure(foundmetprod);
return true;
}
}

//research worlds have no need of such things
if( pl.getStructureCount(elects) > 0 ) {
pl.removeStructure(foundelecprod);
return true;
}
if( pl.getStructureCount(advpts) > 0 ) {
pl.removeStructure(foundadvprod);
return true;
}
if( pl.getStructureCount(goods) > 0) {
pl.removeStructure(foundgengoods);
return true;
}
if( pl.getStructureCount(lux) > 0) {
pl.removeStructure(foundlux);
return true;
}
if( pl.getStructureCount(cannon) > 0 ) {
pl.removeStructure(foundcannon);
return true;
}
if( pl.getStructureCount(laser) > 0 ) {
pl.removeStructure(foundlaser);
return true;
}
if( pl.getStructureCount(fuel) > 0 ) {
pl.removeStructure(foundfuel);
return true;
}
if( pl.getStructureCount(ammo) > 0 ) {
pl.removeStructure(foundammo);
return true;
}

//might need some of these ...
if( pl.getStructureCount(farm) > 0 ) {
double val = 0;
double inp = 0;
double outp = 0;
double demand = 0;
emp.getStatStats(strFood, val, inp, outp, demand);
if( val > 50000 &&  foodrate > farmprodgive ) {
pl.removeStructure(foundfarm);
return true;
}
}
if( pl.getStructureCount(cargoblock) > 1 ) {
pl.removeStructure(foundcargo);
return true;
}
if( pl.getStructureCount(port) > 1
&& combinedprodrate < portrate - portgive ) {
pl.removeStructure(foundport);
return true;
}
if( pl.getStructureCount(yard) > 1 ) {
pl.removeStructure(foundyard);
return true;
}


//cities are almost the last thing we want to dismantle
if( pl.getStructureCount(city) > 1 && population > wrequired + citygive ) {
pl.removeStructure(foundcity);
return true;
}


// Handle overworked population (maybe needs more considerations)
if( population < wrequired ) {
if( pl.getStructureCount(scifac) > 1 ) {
pl.removeStructure(foundsci);
return true;
}
}
}
else if( offline ) {
//if we have a building offline the only NEW buildings we will make are cities.
if( population < wrequired ) {
pl.buildStructure(city);
return true;
}

//we're still willing to renovate old buildings
}
else {
if( population < wrequired ) {
pl.buildStructure(city);
return true;
}
if( pl.getStructureCount(yard) < 1 ) {
pl.buildStructure(yard);
return true;
}
if( pl.getStructureCount(cargoblock) < 1 ) {
pl.buildStructure(cargoblock);
return true;
}
if( ore > 0 && uint(pl.getStructureCount(metal)) <= uint(pl.getStructureCount(scifac))
            && uint(pl.getStructureCount(metal)) <  uint(1 + sqrt(ore/1000000)) ) {
pl.buildStructure(metal);
return true;
}
if( pl.getStructureCount(port) < 1
|| combinedprodrate > portrate ) {
pl.buildStructure(port);
return true;
}

if( population > wrequired + scitake ) {
pl.buildStructure(scifac);
return true;
}

if( uint(pl.getStructureCount()) + 1 < uint(pl.getMaxStructureCount()) ) {
pl.buildStructure(city);
return true;
}

// We dont have enough workers for another building so leave last slot empty
//   until renovations make something worthwhile to build (why waste resources)
}

if( citylvl > 0 + foundcitylvl ) {
pl.rebuildStructure(foundcity);
return true;
}
if( portlvl > 1 + foundportlvl ) {
pl.rebuildStructure(foundport);
return true;
}
if( prodlvl > 1 + foundmetprodlvl ) {
pl.rebuildStructure(foundmetprod);
return true;
}
if(  scilvl > 0 + foundscilvl ) {
pl.rebuildStructure(foundsci);
return true;
}
if( farmlvl > 1 + foundfarmlvl ) {
pl.rebuildStructure(foundfarm);
return true;
}

ResearchWeb web;
web.prepare(emp);
float cargolvl = 1.f;
const WebItem@ itemMet = web.getItem("Cargo Storage");
if( itemMet !is null )
cargolvl = itemMet.level;
if( cargolvl > 1 + foundcargolvl ) {
pl.rebuildStructure(foundcargo);
return true;
}

return true;
}

Both governors will try to keep a minimum 1 each for shipyards, space ports, and cargo sheds.

If for whatever reason the planet is producing more than its ports can send to the bank it will build more so that no resources are wasted.

They will remove all Goods, Luxuries, Cannons, Lasers, Ammo/Fuel Depots, and Electronics/AdvParts factories.  Research governor will remove farms if the empire is profiting AND has a 50k or greater surplus in the bank. Both governors no longer allow ANY wasteful cities to remain and will free up the space. They will only remove buildings when there are no slots remaining and the space should now be used for their main job.

Both governors are now aware that metals are a valuable resource and wont neglect its presence. They will attempt to keep a number of metal refineries equal to 1 if there is a million ore remaining, and 1 more each time the remaining ore is doubled.  ie: 2 at 2 million. 3 at 4 million. 6 at 32million, etc...  They have not forgotten their primary task though, and will not attempt to build more metal refineries than their main building (farms/sci labs). As the remaining ore is depleted they automatically recycle unused refineries and build their main building in its place, if this reduces the planet production unused spaceports are also recycled.

These tweaks makes it so using a research or farm minister on a world with significant slots/ore will no longer be a waste and these planets can be forgotten knowing they will do their job in the best manner possible for the empire. The only other feature is that the farm minister MIGHT decide to convert some farms to science labs if there is an utterly massive surplus in the bank and the empire is also profiting on production. I didnt play long enough to test if he will actually do this. He WILL destroy sci labs if the empire is ever running a food deficit.

Only thing left for me to figure out on these two ministers is how to make them not attempt an upgrade/construction they cant afford. Really want to make them 'stall proof'. Thanks for doing such a good job on this mod that I'm able to learn from it. Any code i post is derived from yours so feel free to integrate it if you like. Credit is all yours.
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #13 on: May 21, 2012, 10:20:51 PM »
obscure bug in  analyzeplanet()

population = pl.getStructureCount(city) * citygive + (isGCap ? 24 : 6) * million;

should be

population =   pl.getStructureCount(city) * citygive +
                   ( pl.getStructureCount(gcap) * 24 + pl.getStructureCount(pcap) * 6 ) * million;


Later in the game tech levels of the other buildings result in them being more space effecient than the capital buildings so i always destroy them. This throws off population calculations since AnalyzePlanet doesnt take that into consideration.
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #14 on: May 22, 2012, 12:59:19 PM »
That is obscure :)
Didn't know you can get away not having caps.

You will also want to re-work this chunk of code then.

   if( isGCap ) {
      advprodrate += 100;
      elecprodrate += 250;
      metprodrate += 500;
      foodrate += 10;
   }
   else {
      portrate += 30;
   }
« Last Edit: May 22, 2012, 01:02:12 PM by Jyin »

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #15 on: May 22, 2012, 01:41:50 PM »
i've had over a dozen instances where i have destroyed an AI planets population, capture it with a colonizer and end up with two planet capitals too.  Its not consistant so maybe there is some other obscure thing that causes the double capital to happen. Either way this catches the problem.

btw what is the FRB constant in your code for?  Its always false and a lot of the planetary condition modifiers dont execute unless its true. Something leftover from a previous version of StarRuler ?
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

Azalrion

  • Delusional
  • ****
  • Posts: 1325
  • Karma: +147/-1
  • Memory Murderer
    • View Profile
Re: Minister version 1.0b2
« Reply #16 on: May 22, 2012, 01:55:24 PM »
Its a left over from the code borrowed by Jyin from the Smart Gov mod which tried to keep compatibility with the two major mods of the time FRB and GA.
GA - Mod Team
GA Forums

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #17 on: May 22, 2012, 08:22:52 PM »
Yeah, I removed most of that, but still have few left in it.

daniwes

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #18 on: June 18, 2012, 01:34:08 PM »
Though I love the idea of this mod, it really doesn't work well. First thing that happens on any balanced planet is that all science labs are destroyed. So starting with a balanced homeplanet quickly leaves me in the stone age and giving everyone else a quick advantage over me. Additionally most new planets are balanced and won't build any science labs either. Building a research planet early in a game is a much too high drain in resources (particularly advanced components)

Secondly, when all ore is gone, it will still leave a minimum of two metal mining buildings standing. When I destroy both, they are instantly build back  ???

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #19 on: June 18, 2012, 01:51:12 PM »
I disagree.  My first 3 planets are usually econ, econ, research and that early research planet gets your metallurgy, econ and bio levels going well enough to counteract any percieved loss of production.  Also once the homeworld is built up just switch it to a renovate governor and put a few sci labs on it yourself if you just dont want a dedicated research world. Nothing says that you have to use governors everywhere.

Also on any planet other than farming and research you SHOULD have mines when the ore runs out. As a matter of fact you need to INCREASE the ratio of mines as relation to elec/advp factories in order to avoid having to import from the galactic bank.
« Last Edit: June 18, 2012, 01:53:22 PM by seronis »
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

daniwes

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #20 on: June 18, 2012, 01:54:56 PM »
But that actually increases the need to manage planets. In the default game the balance between the governors is actually pretty good based on what your empire needs. With this mod I'm constantly out of advanced components and have very little research.
Secondly it doesn't remove mining plants when the planet is out of ore, which is my biggest wish.

seronis

  • Distracted
  • ***
  • Posts: 338
  • Karma: +25/-0
    • View Profile
    • Steam Profile Link
Re: Minister version 1.0b2
« Reply #21 on: June 18, 2012, 02:00:15 PM »
Actually in the default game a governor isnt even told exactly what to build but instead giving a set of 'odds' that it will build a particular building.  You get worlds occasionally that have 2 mines, no elec factories and 12 advp.. this is ludicrously wasteful and just doesnt happen with scripted governors like Jyins.

If you read further up the thread i posted updated governors for farming and research that were compatible with jyins code.  requires a tiny bit of code knowledge to put them into his files but its not hard to figure out. They will be more intelligent about removing mines as they run out of ore and replacing them with useful buildings.
Any code/mods I post on this site should be considered Public Domain. Borrow it, steal it, shred it into little pieces to your hearts content. I dont require credit but I appreciate bug fixes and suggestions.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b2
« Reply #22 on: June 19, 2012, 08:55:56 AM »
My free time has been sucked away by Evil called D3 :)

When I get back to playing SR, I will look into removing the mines.
Minister should be doing that, but I really haven't verified it working.
Remember, for balanced, you want to keep your mines, even if ore is gone.
In fact you want more mines.
For Economic, it should remove all the mines.. but again, I haven't tested.
For Production world, it should keep at least one.

Reason to keep one mine in your world is to stave off the blockade, that's why you have one farm too.

As far as research, Minister is modeled for economic gain.
It will only build research world on smaller plants to save the big ones for better economy.
Due to the way SR's economy works, you get better return if you use larger plants for production.
Smaller plants can't sustain balanced production mix, and suffer from import/export bottleneck.
By placing research facility on economical worlds, you are effectively reducing the size of planet, making it less efficient.

On the other hand, lux and research doesn't suffer from import/export, so they are best suited for smaller planets.
In particular, research world takes so much Advanced Parts that in the early game, you want as small of plants as possible for this.
Farm world also suffer from import/export, but since food doesn't take up a lot of room, it's OK to make small one.

To overcome the import/export bottleneck during the initial build up for non-economical worlds, 1.0b2 builds haulers.

The minister will slow down the expansion if you are low on the resource, so if you are running out of Advanced Parts, you are probably trying to manage the planets by yourself. Try leave them be, and focus on the fleet building.
All you really need to pay attention in early game with Minister is that verify that Minister has picked at least one research world by the time you get your home system fully colonized, or if your home system is really good and has all the big planets, manually colonize the 2nd planet (1st planet should always be for economy) on your 2nd system (make sure it is small) and make it research.
« Last Edit: June 19, 2012, 08:58:51 AM by Jyin »

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: Minister version 1.0b3
« Reply #23 on: July 26, 2012, 03:39:19 AM »
So, I haven't really had a lot of time for SR yet.
But I managed to fix few things up that was messing up with new patch.

Do let me know if you run into issues with b3.

morline1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #24 on: July 28, 2012, 05:04:16 PM »
it's a helpful addon, thanks. especially the cleared build queue after a planet takeover. scaling in 0.05 steps is nice too.
auto colonization helps, but i think it prefers small planets, or maybe he just colonizes everything, but i already colonized the big ones, so he has to travel quite far or just take the small ones nearby.
the building mix on economic worlds looks convincing, that's what it builds at planets of size 18 and bigger, some get balanced. the lower ones get research mostly, some farm worlds.
who does he pick between balanced and economic? and what are the building differences?
the military stations get build right from the start, but it takes ages to finish one. so i have to turn it off.

what i don't get is why every planet gets at least one shipyard, one farm and one cargo bay. are they supposed be self sufficient in case of a blockade? maybe, but i surely don't need shipyards on farm and research worlds.
and building farms everywhere decreases the production potential of all world. dedicated farm worlds should be more efficient.
maybe this defense mode should be toggle able.

also why does it build farm worlds, if every planet gets their own farms?

it also does not remove unneeded cities from research and farm worlds. i think population bonus only works with metal, elec and advp.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #25 on: July 28, 2012, 10:33:22 PM »
Ok, this is a good question. It gives me time to review some of the design decisions.

Minister make decision on what to colonize based on quite a few factors.
Some of them are:
  Defense strength of a system, he will not colonize system that are not well defended. This is to avoid pirates/AI attacks.
  Ally/Enemy presence in a system. he will avoid these system.
  Size of planets. Minister will always prefer larger planets, in given system.
  Location of colony ship built. Minister will colonize in-system, before he send ships out-system.
  Random chance. Minister will not always make colony ship, even if he can. This is done to stop from making Minster too effective.

Governor choices are made:
  Balanced if 25 slots or bigger.
  Economic if 17 slots or bigger.
  Research if 15 slots or bigger.
  if smaller, 30% chance being farm, 70% Luxury (or more research if you don't need them).

I may have to put a check for farm world and see if you actually need them....
Main difference between balanced and economic world is handing of metal mines after ore runs out.
Another difference is the economic world does not make general goods, nor cargo.

You need *some* defense in the system to avoid pirate, that's what Military Outpost is for.
Reduce the size of Military Outpost if you don't want to spend a lot of resources.
Keep in mind, Minister looks at *strength* of defense, so if they are too small, he will make more.
Or park a war ship or two in the system you are colonizing.
Turn it off, if you don't play with pirate and have mobile defense against AI.

Shipyard/Cargo is made to help building those Military Outpost. With b3, not every planet get them. I will have to re-consider that.
One farm per world is to make sure a planet doesn't starve while blockade. Since you never know which system come under attack, you should always have this.

One farm per world may or may not be enough, depends on the tech level. Again, I will have to put in some check against food level before making farm world.

Minister tends not to reduce number of cities too much, he will only act if more than two of the cities are excess.
« Last Edit: July 28, 2012, 11:11:30 PM by Jyin »

Akidi

  • Newbie
  • *
  • Posts: 41
  • Karma: +2/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #26 on: July 29, 2012, 12:22:34 AM »
Well okay, I may be having a momentary lapse of intelligence.. but how do you install this, I figured it would just go into 'mods' folder under SR folder then select from menu.. am I missing something?

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #27 on: July 29, 2012, 02:04:39 AM »
You do have to decompress it :)
It should look like this:

C:\Users\YOURLOGIN\Documents\My Games\Star Ruler\Mods\Jyin's Minister Mod\

In that folder, you should see:
Game Data/
Changelog.txt
modinfo.txt

morline1

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #28 on: July 29, 2012, 02:53:10 PM »
for defense i use ships, i find stations too static. can you show me what i have to edit to make the defense minister turned off by default?

the "every planet a farm" has it's advantages, but much more often they don't get blockaded. it would be better, if it builds the farm when the system gets blockaded.

research and farm worlds get cargo, with a tech lvl of about 15 it held 436k food but only used 27,7each (tick/second don't know). if it's per second it could withstand an over four hour long blockade. it also had a farm producing 550 food. one farm on the smallest planet on every system + haulers and if tech is low + farm planets should be the way to go. at least one of the cargo or the farm is too much.

why do farm and research worlds have shipyards? you don't need them for building upgrades and they are to weak to produce real ships.

a couple of mines on every planet is resourceful, it uses the remaining ore and the spaceport. additionally reducing the imports needed while building.

the building removal is the main argument to use a mod instead of a edited builds_queue.xml, because the normal ministers won't tear down buildings. some of them only remove the flat out wrong ones.
of the planets i checked one was nearly colonized from the start, so he had four cities from back them, but he only needed one.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #29 on: July 29, 2012, 07:26:24 PM »
Defense Minister will make anything that is named "Military Outpost", just design it with standard hull and engines.
I am not about to change the 1-farm thing. I don't think I want to worry about building farm when blockaded.

Older version made the Military Outpost on every planet. That's what shipyard/cargo/port was for.
I am removing some of that in b4.

Point of Minister is not building removal, although it will do that in most cases.
The point of Minister is help the player, not replace one. For that, it does what it does less precise/efficient than you would.
Minister will not optimize, they will only correct gross mis-management. If you want tight control, Minister is not for you.
« Last Edit: July 29, 2012, 09:52:42 PM by Jyin »

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b3
« Reply #30 on: August 03, 2012, 01:32:19 AM »
I am about to wrap up b4.
The b4 has a lot of new features. Here's what I have in change log.
It's a complete list for b4, I just need to make sure I didn't break anything.

Code: [Select]
1.0b4
Expansion Minister will check the food/lux supply before building farm/lux world.
She will send out ColonyShips to under defended system if she knows there is no piracy in the universe.
Removed Shipyard and Cargo in Farm/Research/Lux world.
If you do not build Haulers, trying to build anything in these world will be very slow.
Removed Space Port from Lux/Research.
Note, if you use Colonizer with 3 or more slots, ports are built by initial landing.
Minister will remove these ports at very last step.
Fixed build_queue to have Minister take over just after building Capitals.
Defense Minister will no longer retrofit the only Military Outpost in the system.
He will build a new one before taking down the old one.
Military Minister now have control over rallying of ships
Rallying ships now use Jump Drive, if they has one.
Rally now only affect war-ships (ships with both weapons and engines).
Rallying can be set at site and/or system level.
The site rally point will take priority over system rally point.
When entering a system, war-ships will check the systen rally point, and move on, if they are not needed.
This is also true for the system where the war-ships are built.
This behavior will effectivly create patrol path of war-ships.
You will no longer get nice line pointing to the rally point. It's a side-effect of new Rallying system.
Governors have been sent to re-education camp. They can now count the population of planet correctly.
They will now upgrade both Galactic Capital and Planetary Capitals.
Science Minister will turn on Auto-Research by default, and set the first technology to General Science.
He will also allow save/loading for research queues.
The research queue can contain un-locked technology, when he encounters these, he will try to unlock it.
He will hide away those embrassing default ship designs, and import all he can from his own stash, if he has any.
Default Minister Settings are now configurable in Settings.txt. It also have some settings that are not in GUI.


I am getting pretty close to full feature set that I envisioned when I started this.
I think b5 will be the last version to add new feature, and will become 1.0rc1 once most of bugs are stumped out.
I will be enhancing the new Science Minister in b5, make him adaptable.
It's a pretty big item, so I wanted to get b4 out before I start on that.
The new Science Minister will be the only new feature of b5, unless something change.

If you have any request of features that I didn't add yet, now would be the time  :)
« Last Edit: August 03, 2012, 01:37:04 AM by Jyin »

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: [MOD] Minister version 1.0b4
« Reply #31 on: August 09, 2012, 09:53:29 AM »
What GUI changes have you made? Can you please compile them into one post for easy ref? 'cause your ideas sound promising, but I don't want to mess up the interface, I like it as it is.
« Last Edit: August 09, 2012, 10:18:18 AM by WarpObscura »

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b4
« Reply #32 on: August 09, 2012, 06:49:33 PM »
What GUI changes have you made? Can you please compile them into one post for easy ref? 'cause your ideas sound promising, but I don't want to mess up the interface, I like it as it is.

Just the GUI changes?
Not a lot, let's see.

When importing a carrier with default fighter, the Minister will look for the fighter. If it is not found, he will try to import the fighter first, then the carrier.
Moved the 'Delete' button on loading construction queues, I kept hitting that instead of 'Ok'.
Mouse over the system window and you get tool-tip.
Sub-system accordion is MUCH faster for those of us that like large design window.
Science Minister will turn on Auto-Research by default, and set the first technology to General Science.
He will also allow save/loading for research queues.
The research queue can contain un-locked technology, when he encounters these, he will try to unlock it.
He will hide away those embrassing default ship designs, and import all he can from his own stash, if he has any.
You will no longer get nice line pointing to the rally point. It's a side-effect of new Rallying system.

The b5 will have bit more changes too. Mostly related to research.

WarpObscura

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: [MOD] Minister version 1.0b4
« Reply #33 on: August 09, 2012, 09:22:18 PM »
May I know which are the relevant bits of code?

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b4
« Reply #34 on: August 10, 2012, 03:27:31 AM »
May I know which are the relevant bits of code?

Sure, anything in the "Game Data/gui" folder is for GUI.
But, some code are more complex than others. If you want to know how I've done things specifically, let me know I can point stuff out.
Some GUI code ties deeply into server code too.

Jyin

  • Sentient
  • **
  • Posts: 66
  • Karma: +6/-0
    • View Profile
Re: [MOD] Minister version 1.0b4
« Reply #35 on: January 08, 2013, 08:40:45 PM »
I just realized I was sitting on b5 code and forgot to post it.
I haven't really been active in SR, but it should work fine with 1.2.
I will add it in the 1st post.

scarface2cz

  • Newbie
  • *
  • Posts: 8
  • Karma: +1/-0
    • View Profile
Re: [MOD] Minister version 1.0b5
« Reply #36 on: August 21, 2014, 07:05:15 PM »
Is this fully compatible with game version 1.2.1.2?