View Full Version : RFC Rand "Optimized"
musicfreak Aug 19, 2008, 10:01 PM I've already made (http://forums.civfanatics.com/showthread.php?t=286521) a fast/optimized version of normal RFC, so I thought I'd post the same changes for RFC RAND. With these changes, the game runs a LOT faster. You'll notice a lot less delay in between turns.
Enjoy. :)
EDIT: I removed the attachment because my optimization was included in the official mod. Don't worry though, there is more to come. :) Stay tuned.
AnotherPacifist Aug 20, 2008, 02:02 PM Thanks musicfreak. Can you incorporate onedreamer's fix for the mountain cow/sheep/wheat and maybe also change the settler numbers that used to be in RFC?
http://forums.civfanatics.com/showpost.php?p=7122196&postcount=25
AnotherPacifist Aug 20, 2008, 02:18 PM Um, I tried it and it basically reverted me back to Civ without RFC. When I tried a game of Egypt I was defeated before my first move.
musicfreak Aug 20, 2008, 11:17 PM Thanks musicfreak. Can you incorporate onedreamer's fix for the mountain cow/sheep/wheat and maybe also change the settler numbers that used to be in RFC?Sure, I'll take a look.
Um, I tried it and it basically reverted me back to Civ without RFC. When I tried a game of Egypt I was defeated before my first move.Really? I just finished playing a game of this. Did you get any Python errors? I'll take a look and see if maybe I hiccuped.
onedreamer Aug 21, 2008, 03:10 AM works like a charm Musicfreak.
@AP what I did was just change the line musicfreak has posted in his first thread in the python files we had previously modified (they are only 3).
@Musicfreak if you really want to incorporate the peak fix be sure to correct the line about Japan/England which I forgot. In case you haven't done anything yet then don't worry because I am going to reupload it and with cPickle.
AnotherPacifist Aug 21, 2008, 10:37 AM I think both MAM and I (in the succession game) were getting problems trying to load a save that was generated without the optimized version. I'll have to wait until we finish that game before, and hopefully by then Rhye would have come back from Japan and updated RFC RAND.
The interesting thing is that I'm able to use the optimized files with plain RFC and previous saves.
onedreamer Aug 21, 2008, 12:35 PM Well, I have loaded unoptimized rand saves with optimized rand...
musicfreak Aug 21, 2008, 09:24 PM AnotherPacifist, are you sure you overwrote all the files? Maybe you forgot something? Because I have not had a problem loading regular games...in fact, that's how I test it, by loading a game where I've already played into the modern age in normal RFC Rand. It seems like it works for onedreamer as well. Maybe you have a different version of RFC Rand? Or maybe I have a different version...? :blush:
kairob Aug 21, 2008, 10:17 PM It is working fine for me too...:crazyeye:
Metal Alloy Man Aug 21, 2008, 10:57 PM I had the same problem as AnotherPacifist as well and I can gurantee I had all the right files because I only changed StoredData.py and RFCUtils.py from pickle to cPickle.
musicfreak Aug 21, 2008, 11:15 PM Hmm...what version are you guys using? 1.00?
musicfreak Aug 21, 2008, 11:17 PM Try making the changes yourself (pickle -> cPickle) and see if it works. If it does then we just have different versions of RFC Rand. If not...then I have no idea.
scu98rkr Aug 22, 2008, 04:14 AM I've tried this works fine tis quick
kbk Sep 27, 2008, 07:14 AM If you updated to 1.10 then the python files are back to using pickle and not cPickle.
Just go in and change each line that says
import pickle
to
import cPickle as pickle
Dafy Nov 20, 2008, 09:15 AM I'm little confused :P
is the RFC Rand Optimized.zip file in first post up to date / compatable with RFC Rand 1.10 OR not (must do the following changes - see below).
If you updated to 1.10 then the python files are back to using pickle and not cPickle.
Just go in and change each line that says
import pickle
to
import cPickle as pickle
Did you mean:
from import cPickle as pickle
to import pickle
so the python files are back to using pickle and not cPickle is correct? :)
blizzrd Nov 20, 2008, 10:55 PM No, kbk had it the right way around.
Presuming that you had RAND 1.0 optimized to use cPickle, if you then updated to RAND 1.10, the optimization is lost as the code is replaced with pickle again. To re-optimize, as kbk says, now replace instances of pickle with cPickle.
Dafy Nov 21, 2008, 04:00 AM Ok, thanks :)
musicfreak Dec 26, 2008, 02:17 AM Hey guys, been a while. I updated my first post with the files for RFC RAND version 1.10, in case people were confused on how to manually implement the changes. As always, just overwrite the original files.
Cheers and happy holidays! :)
Fierabras Jan 20, 2009, 12:02 PM I was looking through the Python code to make the starting spot map reveal even bigger, when I noticed something:
def revealSurroundings(self, iCiv, tCapital):
for iX in range(tCapital[0]-2,tCapital[0]+3):
for iY in range(tCapital[1]-2,tCapital[1]+3):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
for iX in range(tCapital[0]-1,tCapital[0]+2):
for iY in range(tCapital[1]-3,tCapital[1]+4,6):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
for iX in range(tCapital[0]-3,tCapital[0]+4,6):
for iY in range(tCapital[1]-1,tCapital[1]+2):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
This is how the 3 square radius BFC is created. I used a fictitious map coordinate to work out the following example:
x=20, y=30
for x in range (18, 23)
for y in range (28, 33)
18,28 19,28 20,28 21,28 22,28
18,29 19,29 20,29 21,29 22,29
18,30 19,30 20,30 21,30 22,30
18,31 19,31 20,31 21,31 22,31
18,32 19,32 20,32 21,32 22,32
for x in range (19, 22)
for y in range (27, 34)
19,27 20,27 21,27
19,28 20,28 21,28
19,29 20,29 21,29
19,30 20,30 21,30
19,31 20,31 21,31
19,32 20,32 21,32
19,33 20,33 21,33
for x in range (17, 24)
for y in range (29, 32)
17,29 18,29 19,29 20,29 21,29 22,29 23,29
17,30 18,30 19,30 20,30 21,30 22,30 23,30
17,31 18,31 19,31 20,31 21,31 22,31 23,31
There are a lot of tiles that are set to revealed 3 times. I "optimized" this by using the third argument for the range() function, which is the 'step'. The initial square is 5x5, so a step of 6 is needed to make it into the big cross (additions in bold):
def revealSurroundings(self, iCiv, tCapital):
for iX in range(tCapital[0]-2,tCapital[0]+3):
for iY in range(tCapital[1]-2,tCapital[1]+3):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
for iX in range(tCapital[0]-1,tCapital[0]+2):
for iY in range(tCapital[1]-3,tCapital[1]+4,6):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
for iX in range(tCapital[0]-3,tCapital[0]+4,6):
for iY in range(tCapital[1]-1,tCapital[1]+2):
gc.getMap().plot( iX, iY ).setRevealed(iCiv, True, True, -1);
This results in:
x=20, y=30
for x in range (18, 23)
for y in range (28, 33)
18,28 19,28 20,28 21,28 22,28
18,29 19,29 20,29 21,29 22,29
18,30 19,30 20,30 21,30 22,30
18,31 19,31 20,31 21,31 22,31
18,32 19,32 20,32 21,32 22,32
for x in range (19, 22)
for y in range (27, 34, 6)
19,27 20,27 21,27
19,33 20,33 21,33
for x in range (17, 24, 6)
for y in range (29, 32)
17,29 23,29
17,30 23,30
17,31 23,31
This will hardly increase performance though, but nevertheless, it's something optimized...
musicfreak Jan 20, 2009, 09:21 PM Fierabras, good work. You're right, that probably won't make a difference at all over the course of the game, but it's things like this that need optimizing in this mod. Basically, now that pickle is replaced with cPickle, we just need to get rid of as many loops as we can (and moving stability to the DLL...but that's a different story). What I'm working on is getting rid of all the loops that loop through tiles on the map, and instead using one big one that does everything. This should speed up the game a LOT, especially with things such as Russia's UP (which currently loops through what could amount to 100+ squares, every turn). "For loops" are notoriously slow in Python, so if all these loops could be joined into one loop, it should speed up the game dramatically.
|
|