OIL vs MOVE

I had also thought of perhaps requiring fuel for vehicles to move. But I was thinking more of an item that provided fuel for a while. That would represent supply better. You could do the same thing with ammo.

For example, a refinery produces 4 cans of fuel per turn. Each can provides movement for a vehicle for 5 turns and it can carry 4 cans as cargo.

I realize that Civ IV is supposed to be abstract though, so that seemed excessively complicated.
 
I had also thought of perhaps requiring fuel for vehicles to move. But I was thinking more of an item that provided fuel for a while. That would represent supply better. You could do the same thing with ammo.

For example, a refinery produces 4 cans of fuel per turn. Each can provides movement for a vehicle for 5 turns and it can carry 4 cans as cargo.

I realize that Civ IV is supposed to be abstract though, so that seemed excessively complicated.

That's what I'm trying to do. In the context of a narrowly defined scenario, this does make sense. I have various factories essentially providing oil, rubber, aluminum, "trained crews" even, etc -- all of which/whom has an impact on whether something can be built or operated properly. Lack of fuel could prevent some units from moving. Lack of ammo would rather translate into a combat penalty. And do forth...

This is just industrial strategy 101. ;)
 
Yes, this is possible. Basically, what you'd do in Python is check to see how many sources of oil the player has, and if he has none, then execute the cannotMove function for units that require oil.

Of course, the devil is in the details. :D

One of the things I never liked about that possibility is that it's too unrealistic. You might lose your oil supply, but in the real world you'd have reserves, at least for a while. That's why Japan didn't immediately lose its strategic abilities once the U.S. cut off its trade before December 1941.

This would require Quantitative Resources to be fully implemented :mischief: but I am working on it. ;)
 
Another issue I ran into is that I need to have units requiring more than two resources -- say OIL + ALUMINUM + CREW (etc).

Right now, I can get two resources OK, but if I add a third it reads as "Requires OIL + either ALUMINUM or CREW... "

Is there a way to get around this?
 
Plus in the real world you would have some gas left in the vehicle or convoy. Its not like if the oil was cut off tonight all of our cars wouldn't work tomorrow.

You would have to create additional supply units to make this work. Truck carrying ammo, and tankers carrying fuel.

As for trained crews, thats what the promotions are for. I consider Combat 1-5 as experience. IE Combat 1 = Blooded, Combat 2 = Experienced, Combat 3 Veteran, etc.
 
Plus in the real world you would have some gas left in the vehicle or convoy. Its not like if the oil was cut off tonight all of our cars wouldn't work tomorrow.

You would have to create additional supply units to make this work. Truck carrying ammo, and tankers carrying fuel.

As for trained crews, thats what the promotions are for. I consider Combat 1-5 as experience. IE Combat 1 = Blooded, Combat 2 = Experienced, Combat 3 Veteran, etc.

Thanks for your views on this. I'm not disagreeing with you for a regular Civ game. On the other hand, this isn't what I was asking about. Within the context of what I want to do, I need units to either receive a move penalty or a combat penalty depending on which resource goes missing.
 
It is relatively easy to do this in Python, the problem is that it will slow the game down. I'm 90% certain I can rig it so that if you have no oil supply (or, if using Quantified Resources, when your stockpile runs out) you can't move any mechanized unit, but I would need to find a function that doesn't get called so often that it will significantly slow down the game. Originally, I'd planned to use CanMoveInto or CannotMoveInto, but was told that's not the best idea.

Another issue: this won't affect planes. You'd have to take into account all the bombing missions and disable them if your oil runs out. I do not know if there is a Python function which handles that, but it would be needed before this could be done. (Unless you resort to SDK, but that's out of my area of expertise right now.)
 
This has been looked at before and Duke176 did come up with something that worked for Warlords.

It was done using SDK by assigning a oil counter to oil well improvements and then having a oil usage counter against units. Once the oil ran out, units with the counter could not move.

Duke176 (from what I know) has been busy with real life but he does drop past the forums....send him a PM and see if he still is working on a BTS version of this mod.

http://forums.civfanatics.com/showthread.php?t=194293
Additional thread that shows how he does it in SDK: http://forums.civfanatics.com/showthread.php?t=201247

As you said, it would only be useful for specific scenarios rather then open ended games. I specifically wanted to use it in my WW2 Eastern Front scenario, but alas, I am doing it in BTS and the DLL that comes with the mod no longer works.
 
It looks very promising, but my knowledge in SDK is presently limited to implementing what other people have done, and I do not have a debugger so I cannot solve the problem he ran into.

Again, I can do this in Python, but it might slow things down a bit... and I still don't know what to do about planes.
 
This has been looked at before and Duke176 did come up with something that worked for Warlords.

It was done using SDK by assigning a oil counter to oil well improvements and then having a oil usage counter against units. Once the oil ran out, units with the counter could not move.

Duke176 (from what I know) has been busy with real life but he does drop past the forums....send him a PM and see if he still is working on a BTS version of this mod.

http://forums.civfanatics.com/showthread.php?t=194293
Additional thread that shows how he does it in SDK: http://forums.civfanatics.com/showthread.php?t=201247

As you said, it would only be useful for specific scenarios rather then open ended games. I specifically wanted to use it in my WW2 Eastern Front scenario, but alas, I am doing it in BTS and the DLL that comes with the mod no longer works.

If the source code is available you should be able to adapt it to the current version of BTS.

By the way, I'm posting because I really like your signature: "The Pope? How many divisions has he got?" -Joseph Stalin.

Do you have a source for that?
 
It is relatively easy to do this in Python, the problem is that it will slow the game down. I'm 90% certain I can rig it so that if you have no oil supply (or, if using Quantified Resources, when your stockpile runs out) you can't move any mechanized unit, but I would need to find a function that doesn't get called so often that it will significantly slow down the game. Originally, I'd planned to use CanMoveInto or CannotMoveInto, but was told that's not the best idea.

Another issue: this won't affect planes. You'd have to take into account all the bombing missions and disable them if your oil runs out. I do not know if there is a Python function which handles that, but it would be needed before this could be done. (Unless you resort to SDK, but that's out of my area of expertise right now.)

You can run into some lag if you throw tons of code into cannotUnitMoveInto, but I wouldn't shy away from it for things that are useful, just be effecient about it.
For somthing like this, checking if a player has oil, you wouldn't see any lag by using cannotUnitMoveInto. Even in the context of QR, I don't forsee the same check causing any noticable lag while moving units. In huge maps with TONS of units it may add a few secs to AI proccessing at the end of turns, but not to bad.
 
What concerns me is that I'm using pickle to store and retrieve data, so I don't know how that affects things. (I admit I'm not much of a performance guru - I just know the basics. :D)

Even so, I still don't see how you'd prevent planes from flying in Python, unless there's a function I'm unaware of (very possible :)).
 
To do what you want, just replace the cannotUnitMoveInto method in the CvGameUtils.py file to this:
Code:
	def unitCannotMoveInto(self,argsList):
		ePlayer = argsList[0]		
		iUnitId = argsList[1]
		iPlotX = argsList[2]
		iPlotY = argsList[3]
		pPlayer = gc.getPlayer(ePlayer)
		pUnit = pPlayer.getUnit(iUnitId)
		if (gc.getUnitInfo(pUnit.getUnitType()).isMechUnit()):
                        if (pPlayer.getNumAvailableBonuses(gc.getInfoTypeForString("BONUS_OIL")) < 1):
                                return True
                return False

EDIT: I don't know if this will have any effect on planes and not sure how you would stop them. I'll look around and see if I can come up with something.
 
Yea, in the simplest terms you could just do you oil check at the beginning of each game turn and if no oil then finishMoves all the air units. The downside there is that if you then get oil in that turn the air units won't automagically get their movement back.
To then fix that you'd have to spinkle various checks around the eventmanager to give back the movement points when appropriate.

But before worring about all that, someone that has access to the game itself should check that code I posted and see if it stops air units. It might just do it, but I give it 50 percent chance of working.
 
Back
Top Bottom