View Full Version : Has anyone ever split production between units and buildings?


DaddyHolby
Mar 04, 2009, 02:25 PM
So that you could have two production bars in a city, one producing a building and another producing a unit?

Is this even possible?

How about only allowing unit generation through buildings so that buildings like factories can be assigned to build units and the city itself could only build buildings? (This is more for the mods like RTW or FF which have the ability to build unit specific buildings like Tank Factory)

Shiggs713
Mar 04, 2009, 02:27 PM
yes that is all possible I'm sure, but has it been done, I couldn't tell you. There are a lot of innovative mods out there, perhaps someone knows better than me.

To do these things would most likely require some changes to the SDK or at minimum some python.

DaddyHolby
Mar 04, 2009, 02:38 PM
Had a feeling that I would have to do some python or change the SDK. I'm hoping someone might be able to point me to where this has been done in the past.

phungus420
Mar 04, 2009, 04:24 PM
Hasn't been done. Well there is a remote possibility it has been done, but I don't know how I wouldn't have noticed. I browse through the mod sections pretty frequently and look at what's around. This would have been a pretty impressive mod, and I can't see how it could slip under the radar as it were.

So you'd have to design this mod from scratch. This would require SDK & Python, you would need to set up a new city screen for the UI, and you would need to have the game calculate hammer distribution differently and you'd need to teach the AI how to use it.

DaddyHolby
Mar 04, 2009, 04:36 PM
So that's all I'd have to do:rolleyes:

How about this then, have buildings build a unit every X number of turns. Thus a new tank would roll out of the tank factory every few turns, but if the tank factory was destroyed you would no longer get tanks. And if you had a tank factory and a aircraft factory you might get two units few turns (one tank and one fighter or bomber).

This should be easier to mod right?

mechaerik
Mar 04, 2009, 05:46 PM
That could probably be done in python.

Ajidica
Mar 04, 2009, 06:12 PM
It could be done in python with saving data and such to get variables. Primordial Stew did something like that on Rise and Fall of the Roman Empire and I am pretty sure davidlallen did that on his Fury Road mod. If you do implement it, remember, alot of python is relativly processor intensive, so if you have alot of civs late game, the game will be very slow.

DaddyHolby
Mar 04, 2009, 07:19 PM
Thanks.

I'll look at those and see if I can figure it out. Too bad it can't just be controlled in the xml.

Ajidica
Mar 04, 2009, 07:24 PM
XML is only a data storage system, it cant say when something occurs, only what the abilities of the effects are.

Shiggs713
Mar 04, 2009, 08:48 PM
So that's all I'd have to do:rolleyes:

How about this then, have buildings build a unit every X number of turns. Thus a new tank would roll out of the tank factory every few turns, but if the tank factory was destroyed you would no longer get tanks. And if you had a tank factory and a aircraft factory you might get two units few turns (one tank and one fighter or bomber).

This should be easier to mod right?

that combined with the RTW functions like industrial bombing would make for a really really nice mod. I'd say teaching the AI to use it all would be the hardest part

DaddyHolby
Mar 04, 2009, 08:53 PM
I understand, I was just hoping that there might be an option in the definitions of the buildings or units, kinda like Civ III where you could have a building that would build a unit after X turns.

Tholish
Mar 04, 2009, 09:26 PM
That was Civ III Conquests only, not Vanilla. And it was a great feature. There is the free missionary you get with some religions. If the code for that is in python it would be a good place to start.

DaddyHolby
Mar 04, 2009, 10:15 PM
Thanks, I'll look there.

snipperrabbit!!
Mar 05, 2009, 06:00 AM
What about substracting a given amount (%) of hammers from the production and re-add them in a counter ( same as gold ) reseted upon completion of the item (like for 'food storage' upon growth).
That way, you will get rid of "crappy-production cities spamming units every five turns" exploit

DaddyHolby
Mar 05, 2009, 09:01 AM
After thinking about this some more here's what I'd really like to do:

Be able to give buildings production queues. Whatever is in the production queue would raise the maintenance cost of the building by X amount until the unit was built. After the building builds the unit then the maintenance cost would go back to the original cost or to the X amount for the next unit.

The city would still have a production queue but it would be limited to just buildings. Buildings production queues would be limited to either a specific unit or a specific unit type.

Ex. Say you build a tank factory. Once the tank factory is complete it can then start building tanks and you can open up a build queue for it and assign which tanks you want built. The factory's maintenance cost would go up by a number equal to the cost of building a tank per round until the tank was built. While the factory was producing the unit the city could still build buildings to improve it's infrastucture. After building the number you need you could set it to do nothing at which time the maintenance would be reduced back to the number for just the building.

Now I'm not sure what that X number per turn should be yet or how to calculate it, but I think this might work. Of course it will require changes to the SDK, Python, the UI, and teaching the AI how to use it, which means it's probably out of the reach for me to do (wife won't let me spend that much time dealing with this and after a full day of coding at work I usually don't feel like touching the stuff at home).

So I doubt I'll attempt this, but I'll keep you posted if I do.

Thanks again for all of your help.

The_J
Mar 05, 2009, 02:30 PM
Would be really interesting to see this project working :).

For an easier way: Tsentom has done a wonder, which produces units after some turns (here (http://forums.civfanatics.com/downloads.php?do=file&id=11387)), this can easy be changed to every building, with different time periods.

The Monster
Mar 07, 2009, 10:37 AM
How about this then, have buildings build a unit every X number of turns. Thus a new tank would roll out of the tank factory every few turns, but if the tank factory was destroyed you would no longer get tanks. And if you had a tank factory and a aircraft factory you might get two units few turns (one tank and one fighter or bomber).Take a look at CvFinalFrontierEvents.py for how Jon Shafer got Starbases (which are units, not buildings) to generate a missile every 15 turns. That ought to give you an idea.

In fact, you might want a "tank factory" to be a unit instead of a building, allowing you to pretty much lift Jon's code and do a quick search/replace. Then you could do things like "retooling the factory" (upgrading) to produce a newer kind of tank, APC, etc. You could also provide a mechanism to give the factory XP periodically, (like the spell-casters in FfH2), so that it can earn promotions. One promotion might increase its production rate; others might act like Military Instructors/Barracks/Stables etc. and give the tanks/planes produced there some XP, while another kind might be like Red Cross and give a specific promotion to the units it creates.

You'd have to cause the tank factory to somehow drain some hammers from the city it's in, to reflect the cost of producing the tanks. Starbases give the missiles for free, but a lot of players end up killing them off to avoid paying 1 gold/turn to support that many units.

And that's another reason to make the tank factory be a unit. It would allow the owner to disband it if they no longer wanted to pay maintenance on the factory.