RevolutionDCM for BTS

Bah, I didn't succefully get it to run the init or reset functions in Civ4lerts, I was just writing to my file in the SVN, not the mod, so it wasn't even loading up. After actually loading it up, I get errors because of function arguments.

What I think would work, would be to get Civ4lerts to reinitialize after the player is changed. So based on the code here:

Code:
def changeHuman( newHumanIdx, oldHumanIdx ) :
##********************************
##   LEMMY 101 FIX
##********************************
	game.changeHumanPlayer( oldHumanIdx, newHumanIdx )
	import Civ4lerts
	Civ4lerts.AbstractStatefulAlert.onLoadGame()
##********************************
##   LEMMY 101 FIX
##********************************

should execute the onLoadGame function, but it does not work, because of the arguments. The function for onLoadGame in Civ4lerts is this:
Code:
class AbstractStatefulAlert:
	"""
	Provides a base class and several convenience functions for 
	implementing an alert that retains state between turns.
	"""
...

	def onLoadGame(self, argsList):
		self._init()
		self._reset()
		return 0
But I have no idea what I"m supposed to put in the arguments. Putting in self, or putting in Civ4lerts.AbstractStatefulAlert as the argument fails, self is aparently undefined (even though it is everywhere in Civ4's python, I can't figure out where it is undefined), and putting in Civ4lerts.AbstractStatefulAlert says it's a class object, and it wants a AbstractStatefulAlert class instance. :dunno:

Also trying to run Civ4lerts.AbstractStatefulAlert._init() & Civ4lerts.AbstractStatefulAlert._reset() by themselves the way onLoadGame does also runs into the same argument problems.
 
Revert all changes and try recreating the bug after this change to the last 2 lines:
Code:
	def _reset(self):
		"""
		The enemies dictionary maps all teams to their worst enemy.
		It will hold -1 for any team or enemy the active team hasn't met.
		"""
		self.enemies = {}
[COLOR="Green"]		#for player in PlayerUtil.players():
		#	self.enemies[player.getID()] = [-1] * gc.getMAX_TEAMS()[/COLOR]
[B]		for i in range(0,gc.getMAX_CIV_PLAYERS()):
			self.enemies[i] = [-1] * gc.getMAX_TEAMS()[/B]


and apply the same change refusals' _reset, it's ~110 lines above that.
 
Get a python exception on loading the game:
Code:
Traceback (most recent call last):
  File "BugConfig", line 110, in unknown_endtag
  File "BugConfig", line 334, in endChild
  File "BugConfig", line 337, in end
  File "BugConfig", line 318, in process
  File "BugConfig", line 547, in handle
  File "BugUtil", line 652, in callFunction
  File "Civ4lerts", line 117, in __init__
  File "Civ4lerts", line 820, in __init__
  File "Civ4lerts", line 889, in _reset
AttributeError: RefusesToTalk instance has no attribute 'enemies'
Traceback (most recent call last):
  File "BugEventManager", line 361, in _handleDefaultEvent
  File "Civ4lerts", line 176, in onLoadGame
  File "Civ4lerts", line 889, in _reset
AttributeError: RefusesToTalk instance has no attribute 'enemies'
 
I'm an idiot, checking again, this time actually accounting for the fact one function is refusals and the other is enemies. Just had to actually look at the error, should have checked it before posting though.
 
OK, this is wierd, I now get these errors on load:

Code:
Traceback (most recent call last):
  File "BugEventManager", line 361, in _handleDefaultEvent
  File "Civ4lerts", line 829, in onBeginActivePlayerTurn
  File "Civ4lerts", line 871, in check
AttributeError: 'list' object has no attribute 'difference'

Line 871 is the same class:
Code:
	def check(self):
		if (not Civ4lertsOpt.isShowRefusesToTalkAlert()):
			return
		eActivePlayer, activePlayer = PlayerUtil.getActivePlayerAndID()
		refusals = self.refusals[eActivePlayer]
		newRefusals = set()
		for player in PlayerUtil.players(True, False, False, False):
			if DiplomacyUtil.canContact(activePlayer, player) and not DiplomacyUtil.isWillingToTalk(player, eActivePlayer):
				newRefusals.add(player.getID())
		[B]self.display(eActivePlayer, "TXT_KEY_CIV4LERTS_ON_WILLING_TO_TALK", refusals.difference(newRefusals))[/B]
		self.display(eActivePlayer, "TXT_KEY_CIV4LERTS_ON_REFUSES_TO_TALK", newRefusals.difference(refusals))
		self.refusals[eActivePlayer] = newRefusals
 
I take it you replaced
self.enemies[i] = [-1] * gc.getMAX_TEAMS()
with
self.refusals[i] = set()
?

Ah I think I can see now. One moment .. Actually no, I can't see it after all. Damn
 
No, I didn't use set(), just blindly replaced the enemies with refusals... that's what I get for blindly putting up code without trying to understand it first.

Nice job change player works now :goodjob:

Now I can start trying to work on some of the remaining revolutions stuff.
 
Eh Kel
I wouldn't say that Jdog has left I highly doubt it Kel. He's just takin a break while he's got stuff to do in the real world and other limitations. The central dilemma is that we have these computers that can run civ4 but not civ5. In every other respect they are fine. So we upgrade our machines for civ5, but civ5 is a game that should only cost $70 but now costs $1500. Surprisingly, some of the best modders on Civfanatics do not necessarily have the latest machine... It is for the love of all that is good in civ despite what machine it runs on.... In other words, brother I can't justify the money to upgrade to civ5... So thankfully, all these good people including yourself, continue to do work on what we have right now, which is civ4. Once the civ5 next generation come through, I will still lag on civ4 and at the very least tie up whatever loose ends are left after all these good people on this forum have done their thing for RevDCM as much as they can. I expect that there should be a nostalgia wave at some stage and RevDCM will live again for a short while. If nothing else, the core RevDCM will one day run 50 civs on a giant map at one second turn time on a smart phone.
Cheers
 
hey man!

i havnt seen post from you in a while so i got worried :)

your totally right about civ5 costs 1500$! that was my thought as well, i was actually gonna buy a new cpu , just for civ5, i bet all crazy civ fanatics like me would do so eventually.

civ5, will sure do take a while until modding will come alive, probably 6-12 month, so theres time.
probably there will be those who will prefer civ4, so like civ2 and civ3 is still being modded, i bet civ4 will be even more.

when i saw jdog's post that he is for now taking a break, its kinda bummed me out, making me think about the future of bbai and revdcm, that im eager to see...

huh, giant map...thats like a dream...i really wish it.

im happy to hear from you, thanks for the extensive reply brow.

its new years eve in my country, so, happy new year to you and all.
 
glider1, that is good to hear! I am also one of those poor guys who also have to think twice (or even more) about buying civ5 for $1500. So, I am grateful that you and so many other great modders have announced to keep on modding civ4 - at least for a while.
I am looking forward to a new version of revdcm - until then I will enjoy the current version along with its "derivative" mods... :)
 
There's one more isue to look at before 2.8 though: in that AIAutoplay game starting from phungus' save, no AI adopted any victory strategy, even by turn 475/500.
 
If nothing else, the core RevDCM will one day run 50 civs on a giant map at one second turn time on a smart phone.

And when that day comes, I'll be spending way too much time on the crapper at work! :D
 
There's one more isue to look at before 2.8 though: in that AIAutoplay game starting from phungus' save, no AI adopted any victory strategy, even by turn 475/500.

Also need to get the leader revolt to work correctly, ie the Human needs to loose control, and not be able to turn it off by hitting the AIAutoplay button. I just added a new set of functions that mirror the AIAuotPlay ones but will force AIAuotplay and override the regular function when active, and I think I can get this to work; testing it now before checking this into the SVN though. Also need to get the "Accept and lead rebels" option to work as well. Finally, and the most difficult part is to ensure that these Revolution options work in multiplayer. But yeah, since you started helping out RevDCM 2.8 is very close, the most recent version on the SVN seems very stable and other then the afformentioned problems there are no other known issues.
 
I meant "one additional issue", in addition to the issues already mentioned.
As for the losing control event: Unless you can confirm it works in MP I think you should leave it out. Actually why not simply get rid of that whole event and all the code it needs. I really dislike loading a savegame where AIAutoplay starts running without even asking me, and I can only assume this behavior is there for the sole reason of this one event, it doesn't make much sense otherwise, and it doesn't work that way in BetterAI.

I know I am biased, as I don't really like any part of Revolutions, so my vote probably doesn't carry much weight, just please before you commit all that new stuff, think about removing that feature (loss of control) as a whole for a bit. Leaving AIAutoplay functionality as a debugging tool, and nothing else, sounds so much saner to me than what you are trying to do that I think I can ask this much :p
 
I know I am biased, as I don't really like any part of Revolutions, so my vote probably doesn't carry much weight, just please before you commit all that new stuff, think about removing that feature (loss of control) as a whole for a bit. Leaving AIAutoplay functionality as a debugging tool, and nothing else, sounds so much saner to me than what you are trying to do that I think I can ask this much :p

I've got it set up working in single player now. Will need testers to ensure that these fixes didn't break MP again though :crazyeye:

I agree about loading the game with AIAutoplay on. So I will set it up so that unless AIAutoPlay is forced, AIAutoPlay will be zeroed on game loading. I can't find an equivalent to the onGameLoad function in python in the SDK at this time, which would be much simpler to do. If need be I'll set up, using the bug system, this function so that AIAutoPlay is zeroed, but I'm hoping someone can point me toward a function in the SDK so that I can zero it on game loading.

Edit:
Does anyone know if you just remove a class member variable from the read and write stream if it initializes with the zeroed value?

Negative, the game hangs on load when doing this. It looks like it loads fine, but just stays stuck on "Waiting for other Civilizations"
 
SVN has been updated, very close to having the 2.8 checklist done now, and most everything seems to be working in Single Player. Need the recent updates checked to make sure that I didn't break MP though, and my computer simply can't be set up to test it, I only have 1Gig of RAM.

Here is the thread on MP testing on a single machine:
http://forums.civfanatics.com/showthread.php?t=357943

I also think that the Control Lost handler functions in the Revolutions python could probably be completely removed at this point, but I'm not comfortable with it enough to be sure about this... it's very confusing code.
 
Back
Top Bottom