Modular Flavour Start for RifE 1.3x

EugeneStyles

Prince
Joined
May 21, 2007
Messages
307
First off, let me say: you CAN download this and use it with your current install of RifE 1.30, but I recommend against it - you won't gain too much out of it. The reason I'm posting this here is in hopes of it being included in version 1.31... the only way it'll be useful to modders is if everyone has it.

Anyway, here's the point: In RifE 1.30, flavour start info is not modular. I can create a new civ but I can't define a flavorful environment for them to start in. The only way to do it is to overwrite the base python file, ask the user to hand-merge things, or ask Valkrionn to include my flavour info in the next version. So it occurred to me... why? Why can't it be read in from xml files, so that to modify flavour info for a civ you wouldn't have to modify the code, you just modify the data (in xml form). That way, you can include new versions of the xml in any modularly-loaded module to define flavour starts for that civ (or even for other civs... frex, Fall Under heavily modifies the Amurites and might want to tweak their flavour start info).

Thus, this project has two parts:
1) The python that loads flavour start info modularly instead of hardcoded.
2) The xml file that contains all the flavour start info for the base civs.
(and the attached zip file also includes the Myu modular flavour start info, to show you how it can work modularly)

If you download the attached file, it is meant to be extracted to pathToRife\Assets\. This will put the modified CvFlavourInterface.py file in python\entrypoints\, and will put the flavourInfos.xml file in xml\Flavour\. It will also put the flavourinfos.xml file for the Myu into Modules\NormalModules\Myu\Flavour\.

To use modular flavour start:
Assuming that the python file and base xml are installed in the proper places already, include a flavourInfos.xml file in yourModDirectory\Flavour\ or yourModDirectory\XML\Flavour\. Follow the same format as the Myu file or any of the entries in the base flavourInfos.xml file. Any questions, ask. I did not design the original flavourInterface, so I don't necessarily know what every valid input is for the <FlavourType> tags. You may need to experiment or search to find that out.

Like elsewhere in the game, modular files will overwrite basefiles, and each subsequent LoadPass will overwrite previous passes. Unlike elsewhere in the game, the file is called flavourInfos.xml. Your mod name should not go into the filename. That may have been a mistake, but in my quick-and-dirty implementation, I hardcoded the filename and didn't use a substring check or anything. The file must be called exactly flavourInfos.xml and must be included under your mod in either the Flavour\ or XML\Flavour\ directory.

RifE Team -- how about including this in v. 1.31? It's just two files.
 
It looks good, I think i'm gonna merge it for 1.31, should take a few... seconds.
 
It seems that the data fetched from the XML file isn't turned into an int value when needed, causing some python exception. I'm not sure how to fix this...

Edit: Nevermind, seems a "int(blablah)" fixed it.
 
They be coding, Rife 1.31 be improving.

I would also like to be able to redefine flavour start. Keep up the good work. :goodjob:
 
It seems that the data fetched from the XML file isn't turned into an int value when needed, causing some python exception. I'm not sure how to fix this...

Edit: Nevermind, seems a "int(blablah)" fixed it.

Thanks for fixing it. Do you know what value was causing the exception? Just wondering if it's a bigger problem - I thought I had worked out all the bugs on my side, never saw that one. I'm surprised python didn't properly read an int as an int - wondering if it's a misplaced angle bracket, or something I'm reading wrong in the parser, or maybe it's just a "+1" (I replaced all the "+1" in the original data with just "1", and I can't imagine the "-1" causing a problem).
 
Was in there:
Code:
	def unknown_endtag(self, tag):
		tag = tag.upper()
		if tag == "CIVILIZATION" :
			if gc.getInfoTypeForString(self.data) != -1:
				self.civFlavourInfo = CivFlavourInfo(self.data)
		elif tag == "PREFERENCE" :
			if self.civFlavourInfo:
				if self.flavourType:
					if self.value:
						self.civFlavourInfo.addPreference(self.flavourType, self.value)
		elif tag == "FLAVOURTYPE" :
			self.flavourType = self.data
		elif tag == "VALUE":
			self.value = int(self.data)
		elif tag == "ISEARCHAREAMODIFIER":
			if self.civFlavourInfo:
				self.civFlavourInfo.changeSearchAreaSize(self.data)
		elif tag == "CIVFLAVOURINFO" :
			if self.civFlavourInfo:
				self.civFlavourInfos[self.civFlavourInfo.civ] = self.civFlavourInfo
			self.reset_data()
		else:
			pass
		self.data = self.tag = ""
Not sure what caused the exception exactly though. I didn't check all the values, maybe there's a +1 left somewhere?
 
Was in there:Not sure what caused the exception exactly though. I didn't check all the values, maybe there's a +1 left somewhere?

Well, the +1's should only have been part of the Search Area tag. It's possible there's a space or something that could be causing it (i.e. parsing '1' or '-1' should give an int, but parsing '1 ' would probably give a string). Your int() magic should fix that though. :)

You might want to add the int() magic to this line as well:
Code:
		elif tag == "ISEARCHAREAMODIFIER":
			if self.civFlavourInfo:
				self.civFlavourInfo.changeSearchAreaSize(self.data)

i.e.:
Code:
		elif tag == "ISEARCHAREAMODIFIER":
			if self.civFlavourInfo:
				self.civFlavourInfo.changeSearchAreaSize(int(self.data))
 
So how far off has this gotten?
Will it be available for 1.31?
 
This is in the internal version, anw's code still needs to be added, but, we're making progress in the right direction!
 
Now if only you could do the same for city sets and sounds...
And yes, I know it can not be done, but I have the right to dream.
 
Yeah, for some reason the sound can't be loaded modularly. Something with the way the executable loads them. It doesn't make sense to me, but I've done some searching and it seems lots of people have tried with no luck. You can use the woc_installer to merge audio xml though, see here: http://forums.civfanatics.com/showthread.php?t=347650.

In my Myu mod, I made the woc_installer.jar file into an executable using "jelude" which basically turns it into a setup file that checks for java on your machine and installs it if necessary before running the jar. Then I included that woc_installer.exe as an additional step in the installer for the mod. I can (and should) post a tutorial on how to build a module installer at some point...

I don't know if woc_installer does anything with city sets or not, PPQ might know.
 
Thanks I know about it. I could probably fix up my own installer complete with merging application for both things. But that is not the point.
 
Now if only you could do the same for city sets and sounds...
And yes, I know it can not be done, but I have the right to dream.

Sounds and CitySets will never be modular. It's not possible without a massive rewrite of how those files are loaded, likely beyond what is even possible. I would expect that the sound and graphic engines are locked in the exe, as all we have exposed are functions, no load mechanisms.
 
As I said, can't be done and it is a valid reason to cry about.

And besides since 1.31 is still far away, I have to find other things for people here to cry and complain about. xD


All this said, does anyone have any estimate on how many people actually play RiFE? I mean, if we count the people posting in this section even at it's best it was only a handful. And I don't think that over 100 people actually post in the entire FFH section.
And that gets kind of sad when I consider the possibility that even if I ever finish my race no one will care enough to play with them. :(
 
Top Bottom