View Full Version : "Babylon II" - Civ3 Culture Flip Calc
Chieftess May 12, 2003, 05:59 PM Semi-spawned from this thread (http://forums.civfanatics.com/showthread.php?s=&postid=977256#post977256).
This is what happens when two great minds think alike. :p
Latest Version:
Civ3 Culture Flip Calc v1.03 (http://www.civfanatics.net/uploads4/B2CFC1_03.zip)
Older Versions
Civ3 Culture Flip Calc v1.02 (http://www.civfanatics.net/uploads4/B2CFC1_02.zip)
Civ3 Culture Flip Calc v1.01 (http://www.civfanatics.net/uploads4/B2CFC1_01.zip)
Civ3 Culture Flip Calc v1.00b (forums.civfanatics.com/attachment.php?s=&postid=983217)
Civ3 Culture Flip Calc v0.95b (http://www.civfanatics.net/uploads4/B2CFC0_095b.zip)
Civ3 Culture Flip Calc v0.94b (http://www.civfanatics.net/uploads4/B2CFC0_094.zip)
Civ3 Culture Flip Calc v0.91b (http://www.civfanatics.net/uploads4/B2CFC0_091.zip)
Civ3 Culture Flip Calc v0.90b (http://www.civfanatics.net/uploads4/B2CFC0_090.zip)
Civ3 Culture Flip Calc v0.01b (http://www.civfanatics.net/uploads4/CT_CultureCalc.zip)
v1.00 - This is the GUI version (Visual Basic) of the calculator.
Known problems/issues
- Cumulative value will occasionally jump around at a very low flip risk value, but corrects itself as the turns advance.
http://www.civfanatics.net/uploads4/Babylon2CFC100.jpg
0.91b screenshot (http://www.civfanatics.net/uploads4/Babylon2CFC091.jpg)
(as you can see, something just doesn't look quite right).
P=[(F+T)*Cc*H*(Cte/Cty) - G]/D
where:
P = probability that it will flip this turn
F = # foreignors, with resistors counting double
T = # working tiles under foreign control (out of the max of 21, no matter what the cultural
boundaries are atm)
Cc = 2 if foreign civ has more local culture than you, 1 otherwise
H = .5 for WLTKD, 2 for disorder, 1 otherwise
Cte = Total culture of the foreign civ
Cty = Total culture of your civ
G = # garrison units ( n / d )
D = factor based on relative distance to capitals
Now reorganizing this gives the required garrison as:
G = (F+T)*Cc*H*(Cte/Cty)
I am calling for beta testers and for assistence on Visual C++ dialog programming, active memory access programming, and DirectX programming (like some of the utils that run with Civ3).
Right now, I want to see if the algorithm is 100% accurate.
CivGeneral May 12, 2003, 06:15 PM I have voluntered myself to Beta test this program :). Thank goodness for that Algebra II class ;).
Sirp May 12, 2003, 08:52 PM So where's the source code Chieftess? :)
If you post it I'll look into sticking a gui onto it.
EDIT: Oh, and, what'd be cool is to be able to tell you the chance of it flipping over the next n turns. E.g. "what's the chance of it flipping sometime over the next 50 turns?"
-Sirp.
Chieftess May 12, 2003, 08:59 PM Sirp - Just the Australian I was looking for! Come to the chat room. :D
This is a picture of what I hope it will look like (not messy, but you get the idea). I pasted stuff together quickly in Visual Basic.
http://www.civfanatics.net/uploads4/CT_CultureFlipCalc.jpg
Steph May 13, 2003, 01:27 AM Originally posted by Chieftess
I am calling for assistence on Visual C++ dialog programming, active memory access programming, and DirectX programming (like some of the utils that run with Civ3).
Why do you need all that? Like DirectX, memory access, etc? It sounds quite simple to do without that. Or do you have a grand plan in mind?
Sirp May 13, 2003, 04:16 AM I assume Chieftess wants to be able to access the Civilization process and extract information about cities to be able to provide a list of cities. For that you'd need to be skilled in doing nasty things with the memory of another process. In fact I didn't/don't know that it's possible to do this at all in true 'protected mode' operating systems such as Windows XP and 2000, since one of the main ideas of protected mode is that you can't access the memory of another process. (But...maybe Microsoft exposes some evil API which lets you do it...)
I suspect Chieftess wants someone experienced in DirectX so she can do nasty things with popping the window up over the running civilization program.
Personally, I'd suggest that it's too much effort to do all that, and just stick with a simple dialog-based system that lets you key in all the variables. It's not like you want to calculate culture flip risk every turn or something...
-Sirp.
Steph May 13, 2003, 07:43 AM I agree with you Sirp. Too much work for the objective.
Chieftess May 13, 2003, 07:44 AM Here's a diagram that factors the small 'd' (or the distance between capitals). (note - it might be reversed though, and after looking at it, I think it is).
http://www.civfanatics.net/uploads4/CivCulture_capitals.jpg
If there's one question I have about the algorithm, it's what are considered foriegners and resistors. Say there's 10 citizens, and all of them are foreigners, but 3 are resisting. Does that mean 10 foriegners and 3 resistors? Or 7 foriegners and 3 resistors?
anarres May 13, 2003, 08:57 AM Hi CT, I just posted version 1 of mine too :p
http://forums.civfanatics.com/showthread.php?s=&threadid=53157
http://www.civfanatics.net/uploads4/FlipCalc.jpg
Sirp May 13, 2003, 04:09 PM Chieftess: A resister counts as a doubly-bad foreigner. If you have 7 foreigners and 3 resisters, that counts as if you had 13 foreigners, since resisters count for double.
-Sirp.
Chieftess May 13, 2003, 06:41 PM Originally posted by Sirp
EDIT: Oh, and, what'd be cool is to be able to tell you the chance of it flipping over the next n turns. E.g. "what's the chance of it flipping sometime over the next 50 turns?"
-Sirp.
I believe I saw that in one of the culture flipping threads. It's a cumulative effect, right?
anarres May 13, 2003, 06:49 PM CT, once you have
P = Probability of flip
The chance of it not flipping in 'n' turns is:
(1 - P) <to the power of> n
Chieftess May 13, 2003, 09:10 PM Mine is now updated.
sgrig May 14, 2003, 03:58 AM Originally posted by Chieftess
P=[(F+T)*Cc*H*(Cte/Cty) - G]/D
I'm not convinced that this is the correct formula, because a correct formula for probability is not allowed give an arbitrarily large result* - otherwise it is not possible to scale the probability to be between 0 and 1 (or 0 and 100). So it is simply not valid mathematically as a formula for probability.
(*Here for example if D=0.01, the result can be huge, which obviously does not give a probability)
Of course in the game D cannot be arbitrarily small (the largest distance between two capitals can be 362, and smallest distance between two cities can be 2, so D is at least 1/181). So maybe there should some scaling factor, although that still won't guarantee validity of this formula.
EDIT: Didn't read further on - there is in fact a scaling factor! Sorry for the rant! Next time I'll read the whole thread before replying!
anarres May 14, 2003, 04:07 AM Damn CT, you sure move fast!
Chieftess May 14, 2003, 10:30 AM Flip Calc 0.94 has been added.
There's a culture flip risk per turn that's been added, but still needs some tweaking.
Chieftess May 15, 2003, 06:15 AM [b][color=red]I'd also like to get the civ culture values and X/Y locations from the Civ3 save. I have the source for file decompression/compression, but it's in C++, not Visual Basic. Anyone know how to make a COM file?
anarres May 15, 2003, 06:24 AM CT, I have PM'd you with my daytime (work) msm.
Chieftess May 15, 2003, 03:02 PM Here's version 1.00.
Chieftess May 15, 2003, 05:59 PM Version 1.01 has been uploaded!
What's different/added?
- Added a distance calculator
- Fixed some typos in the distance help window
- Added a sample image so you can see how to measure the distance
What's next?
- Adding an option to automate the Culture Flip Calc from the save
- Making an ingame version to read from the memory (because I want to try. :p)
So, any comments from anyone besides Sirp and Anarres? Good? Bad? Ugly? buggy? Anarres' thread has 4x as many views as mine.
CivGeneral May 15, 2003, 06:20 PM Looks good. This is one of the Best Versions of the Program :).
Chieftess May 19, 2003, 08:05 AM Umm... doesn't ANYONE have any comments on mine? :(
Hygro May 20, 2003, 12:27 AM Yours gives differant results than the other one:
I did everything the same,
and w/ annares' I got 0% and 0% (for 1 and 10 turns respectively)
with yours I got ~.8% and ~10% (for 1 and 10 turns, respectively)
anarres May 20, 2003, 02:26 AM Tell us the numbers Hygro so we can see where one of them is going wrong.
Hygro May 20, 2003, 03:56 PM Here's the two results. Don't mind the promotion of my currently favorite station :D
http://www.civfanatics.net/uploads4/Differant_Flip_rates.JPG
anarres May 20, 2003, 04:34 PM P=[(F+T)*Cc*H*(Cte/Cty) - G]/D
P = probability that it will flip this turn
F = # foreignors, with resistors counting double
T = # working tiles under foreign control (out of the max of 21, no matter what the cultural
boundaries are atm)
Cc = 2 if foreign civ has more local culture than you, 1 otherwise
H = .5 for WLTKD, 2 for disorder, 1 otherwise
Cte = Total culture of the foreign civ
Cty = Total culture of your civ
G = # garrison units ( n / d )
D = factor based on relative distance to capitals
Now reorganizing this gives the required garrison as:
G = (F+T)*Cc*H*(Cte/Cty)
F + T = 26, Cc = 1, H = 1, (Cte/Cty) = 0.25
G = (F+T)*Cc*H*(Cte/Cty) = 6.5 , so 7 troops will stop flips.
Calculating P:
P = ((26 * 0.25) - 16)/D , which is less than zero.
Thor091 May 20, 2003, 05:01 PM Great Work. Keep it up. I think you are heading in the right direction Chieftess.
Just how do you get the culture level for the AI?
What this needs most is allowing it to calculate the distance from the save file (and reading the other data to).
Chieftess May 21, 2003, 10:03 PM Hygro - I found a bug in my garrison data. There was a typo, which was fixed. It works now. I'm also adding an "AI controls the city" switch. Then I'm going to try and get the file data.
Anyone know how from Visual Basic?
Chieftess May 22, 2003, 11:35 AM v. 1.02 uploaded! (http://www.civfanatics.net/uploads4/B2CFC1_02.zip)
Desperately Needed:
Save info for:
All cities of each civ.
City locations (for the capitals)
Current culture of each civ
units in the city
Citizens in the city (foriegn, resisting, native)
City status (WLTKD, rioting, normal)
culture of the city for each civ.
Chieftess May 22, 2003, 12:46 PM Civ3 Culture Flip Calc v1.03 uploaded! (http://www.civfanatics.net/uploads4/B2CFC1_03.zip)
What's New/Fixed/Added
- Error checking improved for each data field
- Ability to enter a value into the "AI Controlled Tiles" combobox instead of having to click
This phase is pretty much done - unless anyone finds any typos or other bugs.
I still need testers! I have ZERO!
anarres May 22, 2003, 01:04 PM I'll test yours if you test mine. :)
Padma May 23, 2003, 10:30 AM Hi CT!
I'll see if I can play with it some this weekend. :D
Gramphos May 23, 2003, 11:00 AM Is there a create the best Culture flip calculator contest going on somewhere? ;)
...
Maybe if I added a calculator to C3MT I could take part in the contest too... Nah, too mush work involved :D I'll let you play your game. ;)
Chieftess May 23, 2003, 11:17 AM Originally posted by Gramphos
Is there a create the best Culture flip calculator contest going on somewhere? ;)
...
Maybe if I added a calculator to C3MT I could take part in the contest too... Nah, too mush work involved :D I'll let you play your game. ;)
It was just sponteneous! :D
Dr Alimentado May 23, 2003, 10:32 PM Hi CT :)
I am testing yours already ;) so you can sign me up. I can be pretty nitpicky about stuff which may or may not be what you want :D but let me know.
One thing yours has that anarres lacks, the reqd. garrison figure, this is extremely useful! You could perhaps have it give a (rounded up) integer value though (nitpicking...).
The visual sample for working out the ratios is also a very very good thing - espeically for ppl like me who sometimes 'just don't get it' (even though there is only one way to do it, the sample meant I knew I was doing it right.) I would maybe consider moving the ratio help button to the same place as the view sample button, or even integrating the 2 screens into 1... but again, I'm nitpicking....
Good Job :goodjob:
CivGeneral Jun 02, 2003, 10:22 PM Ill be still continuing Beta Testing this Utility Program, along with another Mod for another game that I am also Beta Testing.
Boy how much fun being a Freelance Beta Tester is.
|
|