Questions about The BUG Mod

yep - worked with and without BUG on my pc. Guess it is something mac related.
 
That is very, very strange. It seems that the Mac version is allowing BUG Python files to load when loaded via the game engine or the standard "import" statement, but it isn't loading them when using dynamic import.

I don't know if this is possible, but I'd be curious to see the result if it is: start a multiplayer game (should ignore BUG) and see if you get the same issues. Another idea: start a new PBEM game and check Lock Modified Assets to ensure nothing from CustomAssets folder (BUG) is used.

I would report this bug in the main BTS bug reporting thread. If there's a Mac one, report it there of course.
 
It seems that the Mac version is allowing BUG Python files to load when loaded via the game engine or the standard "import" statement, but it isn't loading them when using dynamic import.
When I debug BUG (or any mod with Python code) on the Mac, if I change a Python file I have to reload the mod from the main menu, so the Mac's Python interpreter seems not to be able to reload a module once it is loaded. This is clearly not the same as the Windows version, which picks up and reloads changed files on the fly.

If so, and if BUG needs to load Python modules dynamically for PBEM saves, then it will fail on the Mac.
 
If so, and if BUG needs to load Python modules dynamically for PBEM saves, then it will fail on the Mac.

BUG loads Python modules dynamically as part of its initialization phase regardless of the type of game being played. And given that you can play BUG games on the Mac, clearly BTS can dynamically load Python modules on the Mac under normal circumstances.

AFAIK BUG works fine for dr_s when starting a game from scratch (is this true?). The only problem is when playing a PBEM game which because it's a multiplayer game should ignore the CustomAssets folder, but it's not. It's only ignoring it for dynamically-loaded modules.

This seems like a bug in the Mac version of BTS.
 
OK, now I think I understand. Sorry to be slow on the uptake.

Note that you can't load a game file on Mac BtS by double clicking it. Presumably, CustomAssets are loaded when BtS Starts up, and before it knows which game you want to run, and it can't then unload the assets when it discovers assets are locked. I'll try some experiments.
 
EmperorFool - re your post #1009. The suggested changes to put the list of wonders into one neutral colour require editing a Python file, which frankly I do not feel competent to do. But if it can be put into a later version of BUG, I for one would be obliged.

Now something completely different. I started a thread in the General Discussions forum called "Worst enemy of ?", prompted by two alerts which showed on screen as :-
Ragnar is the worst enemy of Churchill.
Churchill has no worst enemy.
The first could be rewritten as "Churchill's worst enemy is Ragnar", which is in flat contradiction of the second statement.
But if the first means "Ragnar hates Churchill more than he hates anybody else" then it should say "Ragnar's worst enemy is Churchill" or even "Churchill is the worst enemy of Ragnar".

So on what information are such "worst enemy" alerts based ? Should the alert text be revised ?
 
Note that you can't load a game file on Mac BtS by double clicking it. Presumably, CustomAssets are loaded when BtS Starts up, and before it knows which game you want to run, and it can't then unload the assets when it discovers assets are locked. I'll try some experiments.
If that is the case, then that could be the cause of the pbem problem that I saw reported (BUG not loading correctly) as BtS (Mac) got confused about how much of BUG to load.
 
I have reproduced dr_s' symptoms, but only with a non-Locked Assets PBEM save from Windows.

[Worryingly, if I create a Locked Assets save - single or multiplayer - using my Windows BtS I cannot load it on the Mac. It gives the Locket Assets error. I need to investigate this. Maybe my assets have become corrupted in one of the installations.]

I created a PBEM random game in BtS for Windows with no mod loaded. When I loaded this game with no Mods loaded, it ran OK. With BUG loaded from CustomAssets, it gave the symptoms described by dr_s - loaded with no interface and the Python init error.

SO. If anyone has any bright ideas as to how we can stop BUG from part-loading from CustomAssets on a Mac, I can try it. I did suggest once before that BUG initialisation could be left until late in the game loading cycle. Maybe this is the time to try that out, but I'm not confident that I know how to do that to BUG myself.
 
How can I use "handleInput" function in "SevoPediaUnits.py"?
It seems to never be called.

I want to change shown contents depending on SHIFT key is being pressed down or not.
 
So on what information are such "worst enemy" alerts based ? Should the alert text be revised ?

I just tested this with my test game, and AFAICT the worst enemy alerts are correct. A saved game showing incorrect behavior would help a lot. There may still be a problem where a player that died is reported as no longer being a WE or having a WE, but nothing about two alerts fired the same turn being contradictory.

BTW, the message "Ragnar is the worst enemy of Churchill" means exactly what it says: Churchill hates Ragnar the most.

Ah, there are some game actions that trigger these alert messages during AI turns, so it is possible that something happened before your turn that changed the WE or Churchill twice.

Worryingly, if I create a Locked Assets save - single or multiplayer - using my Windows BtS I cannot load it on the Mac. It gives the Locket Assets error.

I assume this happens because the DLL is included in the asset-checking, and the two games have different DLL mechanisms.

If anyone has any bright ideas as to how we can stop BUG from part-loading from CustomAssets on a Mac, I can try it. I did suggest once before that BUG initialisation could be left until late in the game loading cycle.

BUG depends on BTS not loading its modules if the CustomAssets folder should be ignored. The problem is that BTS is loading BUG modules when it shouldn't. The only solution I can think of would be quite tedious to implement, and it may not even work.

First, I'd have to write a function that would detect if the CustomAssets folder should be loaded. The CA folder should be ignored if playing a MP game or if the mod has NoCustomAssets set to 1. Are there any other conditions?

The tedious part comes next: I'd need to rewrite any module that replaces an existing BTS module so that BUG's initialization would inject the changes into the original BTS module on-the-fly. In some cases BUG replaces a function in a module; other times it replaces an object with its own. Hopefully having access to the globals() for a module would be enough here.

BUG replaces a few modules in EntryPoints. The ones it replaces in Screens could be
done easily enough by having a separate BUG version as is done with the Military Advisor.

I think we could do a simple test to see if this is at all possible. Python allows it for sure; the doubt is BTS's interface with the interpreter. If it works it would be quite a bit of work to make this change. @AlanH - Would you have some time to help with this part if I can explain what needs to be done?

How can I use "handleInput" function in "SevoPediaUnits.py"?

I think all input goes through SevoPediaMain.py. However, clicking on the items in a list is handled by the SDK: it checks the WidgetType assigned to the item and goes through CvScreenInterface.py IIRC. This latter module calls functions in SevoPediaMain.py.
 
I think all input goes through SevoPediaMain.py. However, clicking on the items in a list is handled by the SDK: it checks the WidgetType assigned to the item and goes through CvScreenInterface.py IIRC. This latter module calls functions in SevoPediaMain.py.

Wow great!:goodjob:
I succeeded to interrupt keyboard event.

But, SevoPediaMain.py
Code:
	def handleInput (self, inputClass):
		[COLOR="Red"]if (inputClass.getPythonFile() == SevoScreenEnums.PEDIA_LEADERS):[/COLOR]
			[COLOR="Blue"]return self.pediaLeader.handleInput(inputClass)[/COLOR]
		elif (inputClass.getFunctionName() == self.TOC_ID):
			self.showContents()
			return 1
Perhaps, red marked line works unlike intentional behavior.
Blue marked line is never reached, and each leader's gesture animation is not triggered by pressing num keys in Sevopedia leaders screen.

Anyway, It's a petty issue and I will resolve in my own.
Thanks!! :)

EDIT: This is my fixed code.
Spoiler :
Code:
	def handleInput (self, inputClass):
		[COLOR="Red"]if (self.mapScreenFunctions.get(self.iCategory) == self.pediaLeader):[/COLOR]
			return self.pediaLeader.handleInput(inputClass)
		elif (inputClass.getFunctionName() == self.TOC_ID):
			self.showContents()
			return 1
 
BTW, the message "Ragnar is the worst enemy of Churchill" means exactly what it says: Churchill hates Ragnar the most.

Ah, there are some game actions that trigger these alert messages during AI turns, so it is possible that something happened before your turn that changed the WE or Churchill twice.

So at a particular moment Churchill had no worst enemy, which was reported. Then, during the same end-of-turn sequence, something happened to cause Churchill to hate Ragnar, and this too was reported. OK. But I'd still be happier if instead of saying "Ragnar is the worst enemy of Churchill" it said "Churchill's worst enemy is Ragnar" or something similar, on the basis that the person feeling the hatred should, I think, be the subject of the sentence and the person hated should be the object. "John loves Mary" is clearer than "Mary is loved by John", for example: it's John's emotion that matters.
 
II assume this happens because the DLL is included in the asset-checking, and the two games have different DLL mechanisms.
For plain, simple non-modded games, the Mac and Windows versions are supposed to be able to exchange saves. Aspyr did some fancy footwork with checksums to make the Mac version play right ... but I wonder if they kept that in a working state when they produced the 3.19 upgrade.

BUG depends on BTS not loading its modules if the CustomAssets folder should be ignored. The problem is that BTS is loading BUG modules when it shouldn't. The only solution I can think of would be quite tedious to implement, and it may not even work.

First, I'd have to write a function that would detect if the CustomAssets folder should be loaded. The CA folder should be ignored if playing a MP game or if the mod has NoCustomAssets set to 1. Are there any other conditions?

The tedious part comes next: I'd need to rewrite any module that replaces an existing BTS module so that BUG's initialization would inject the changes into the original BTS module on-the-fly. In some cases BUG replaces a function in a module; other times it replaces an object with its own. Hopefully having access to the globals() for a module would be enough here.

BUG replaces a few modules in EntryPoints. The ones it replaces in Screens could be
done easily enough by having a separate BUG version as is done with the Military Advisor.

I think we could do a simple test to see if this is at all possible. Python allows it for sure; the doubt is BTS's interface with the interpreter. If it works it would be quite a bit of work to make this change. @AlanH - Would you have some time to help with this part if I can explain what needs to be done?
I'm happy to help with this. However, I'd welcome dr_s' point of view as a user, but this level of work sounds to me to be above and beyond the call of duty. Changing the CustomAssets folder name is not a big deal if you have to play a PBEM turn, and there can't be a lot of players who would be inconvenienced by it. If it's really a problem you could possibly have a different login, with another user folder containing no CustomAssets. Fast user switching could then get you from one config to the other.
 
I'm curious about the city count and the list of national wonders that have been built. Is there any way to access this information without the BUG mod (the city count in particular); if not, isn't knowing this stuff kind of cheating?
 
I'm curious about the city count and the list of national wonders that have been built. Is there any way to access this information without the BUG mod (the city count in particular); if not, isn't knowing this stuff kind of cheating?
The wonder list is available on the same screen as BUG shows it. We have just reformatted it. The city count is available by opening the diplo screen (Ctrl-Click on a leaders name at any time) and scrolling down to the list of cities. The city count changes if the AI will not talk to you - then you only get a tally of the cities on tiles that you can see (ie you must manually count them on the map).
 
I'm happy to help with this. However, I'd welcome dr_s' point of view as a user, but this level of work sounds to me to be above and beyond the call of duty. Changing the CustomAssets folder name is not a big deal if you have to play a PBEM turn, and there can't be a lot of players who would be inconvenienced by it. If it's really a problem you could possibly have a different login, with another user folder containing no CustomAssets. Fast user switching could then get you from one config to the other.

I agree that this sounds like it is beyond the call of duty. (Though I appreciate the suggestion, and I know y'all would probably like to be able to implement a real solution.) I posted because I thought maybe I was doing something wrong, or that I didn't understand the way things should work. It would be easy for me to write a little applescript to shuffle folders around for playing SP games or PBEM games, and that's probably what I'll do. So if you want to regard this as an edge case that isn't worth dealing with, that's more than fine.
 
But I'd still be happier if instead of saying "Ragnar is the worst enemy of Churchill" it said "Churchill's worst enemy is Ragnar" or something similar, on the basis that the person feeling the hatred should, I think, be the subject of the sentence and the person hated should be the object.

While I agree with your subject/object argument, the only way worst enemies affect the game is if you are trading with them: you'll get a diplomatic penalty. Plus, it allows me to report everyone that hates a single player in one sentence, for example, "Ragnar is the worst enemy of Churchill, Mansa Musa and Saladin." I had it the other way before, and I found it more cumbersome to use so I switched it.

I'm curious about the city count and the list of national wonders that have been built. Is there any way to access this information without the BUG mod (the city count in particular); if not, isn't knowing this stuff kind of cheating?

I think I've caught all the cases where you can't see a rival's city list, but if I missed any please point them out with a saved game. As for the national wonders, you can tediously scan the map and find which city contains them. If you cannot see the city on the map, it won't show it in the list. If it does, report it as a bug please.

It would be easy for me to write a little applescript to shuffle folders around for playing SP games or PBEM games.

I would bet that the Mac version also supports the /AltRoot command-line switch so you could have two "Beyond the Sword" data folders--one for normal games and the other for PBEMs. Then you would just have two desktop shortcuts or whatever you want to launch them.
 
(about the city count and national wonders)
Fair point about getting the number of cities from the diplomacy screen. In wars, I suspect that sometimes not all cities are listed even if the leader will speak - but I'm not even sure about that, and if you say you've tried to catch all the special cases then that's good enough for me! (If I notice anything wrong, I'll report it.)

About the national wonders, I haven't looked into it much, but I do know that in my current game it is telling me that Rome has built the Moa Statues, but not listing the city that they were built in (presumably because I haven't seen them) - it is also telling me that a few unknown civs have built them, and it also tells me the year in which they were built for each of them, including the unknown civs, Rome, and ones that I have actually seen. I'm not sure but I suspect that none of this information should be available. However, unlike the city count, this info isn't very strategically useful to me anyway - so I don't really care.
 
hey - do you have a save that you can upload re the National wonders?
 
I would bet that the Mac version also supports the /AltRoot command-line switch so you could have two "Beyond the Sword" data folders--one for normal games and the other for PBEMs. Then you would just have two desktop shortcuts or whatever you want to launch them.
I rather doubt this. The application launch architecture in Mac OS X is *very* different from that in Windows, and it is very unlikely that Aspyr would have ported across the command line options from Windows.
 
Back
Top Bottom