Softcoding Inquisition Civics

@johny smith

Is there anyway you could isolate out the specific source files that contain the inquisitions functionality in them? I really can't go through and compare the entire source to the current RevDCM SVN and isolate out the inquisitions functionality, it's impossible. Taking the current python code I have now, and turning it to SDK would probably be easier at this point.
 
iInquisitorUnits.append((info.getProductionCost(), eUnit)

I'm getting a python exception here. It says append() takes only 1 argument, 2 given :(
 
That line you posted needs a second ) at the end:

Code:
iInquisitorUnits.append((info.getProductionCost(), eUnit))

(info.getProductionCost(), eUnit) is a tuple (unmodifiable list). It is added as a single element to the end of the iInquisitorUnits list. This makes iIU a list of lists. This is also known as a multidimensional array.

The first subscript [x] accesses the xth element in the iIU array. This element is itself a list, so the next subscript [y] accesses the yth element in that list.

Imagine a parking lot full of cars. Lot[spot][seat] denotes a single car seat. [spot] picks the car parked in a single spot from the list of cars (the lot) and [seat] picks a single seat in that car.
 
Took a while, and I currently have 3 seperate pages found from google about varias python stuff, but I figured out how to use a dictionary to do what I want. Here is the code, and it is working (the AI is building and using Inquisitors, no more python exceptions):

Code:
dInquisitorUnits = {}
lInquisitorUnitCosts = []
for eUnit in range(gc.getNumUnitInfos()):
	pUnit = gc.getUnitInfo(eUnit)
	if ( (pUnit.isInquisitor()) and (pCity.canTrain(eUnit, False, False)) ):
		dInquisitorUnits[pUnit.getProductionCost()] = eUnit
lInquisitorUnitCosts = dInquisitorUnits.keys()
if (len(lInquisitorUnitCosts) > 0):
	iInquisitor = dInquisitorUnits[min(lInquisitorUnitCosts)]
else:
	iInquisitor = None
 
I was getting an exception and didn't understand the method you were describing, so that's what I came up with after researching. I'll try your corrected code if it's more optomized. I didn't realized dictionaries where slower. It seemed to be exactly what I needed.
 
There are only a few items involved here, so it won't be noticeably slower. The bigger downside is that it's more complicated. However, if you understand it, that's a big thing.
 
This is just the inquisition code changes. I did not test this by compiling yet. Just adding in the changes to RevDCM 2.61 sources. The Civics Screen has changes to add in the inquisition stuff, but I know you guys are talking of removing that section. Just letting you know the sections in between "Civics Screen" it is not required for this to work. It is just the text for the WoC civics screen.

Anyway if you want units for this as well I made some, and Chuggi made some about 3 years ago for this as well. The code was made a long time ago back in 2007. Well I hope it helps.
 
Just something that I did not think about till now. Is there any point of using Inquisition units when someone plays RevDCM without the Revolution options turned on?

I thought the WoC code was to effect diplomacy. The inquisition mission was done to remove other religions in order to convince other civilizations to convert to another religion by removing the religion that was in your way. Thus removing religions that were an obstacle in diplomacy eventually. But I have not paid close attention to it while playing with it.

I would only suggest that you have an option for it with Revolution and an option when it is turned off. RevDCM is about options right? I mean I think no Revolution no inquisition is a bad idea.

This was definitely stable. I just did not really look for problems with it anymore because it was dependable in the past. I just always ran Autoplay and let it go. It may need some tweaking now though. I been paying attention to other things instead of analysing the inquisition code.
 
Thanks Johnny. Most likely we'll have to abandon most of the AI code in there because as far as I can tell there simply isn't any reason to conduct inquisitions when Revolutions are off, so no reason to have the AI waste hammers doing that. That'll be up to jdog or glider though, I'm not going to mess with it. I mainly just want to get the functionality moved over to the SDK from python, and probably move over the current RevDCM AI python code to the SDK as well. This will be something I'll probably work on later, at least I've put it in the Todo list for 2.71. Alot depends on jdog though, as the current BBAI crash and fixing a OOS error has to happen first before the 2.7 release, so if that takes a long time I'll be working on the stuff in the 2.71 list anyway (everything left in the 2.7 todo list is over my head). If you want to help with it, please take a look at the current 2.7 SVN, and see if you can't get started in moving over Inquisitor SDK code, also keep in mind that the civic screen has already been replaced by RoM's civic screen in the current SVN.
 
Just a bump here, I've written 65% of the Inquisitor code in the SDK, and it seems to work fine. I modelled it after the python code. I've coded the part that controls when cities choose to build inquisitors, but the actual unit management is still in python, I'm not good with UnitAI code.
 
Back
Top Bottom