1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Bug Reporting

Discussion in 'Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)' started by alerum68, Sep 2, 2007.

  1. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    The problem is in CvCity.cpp...

    Code:
    int CvCity::getFoodTurnsLeft() const
    {
    	int iFoodLeft;
    	int iTurnsLeft;
    
    	iFoodLeft = (growthThreshold() - getFood());
    
    	if (foodDifference() <= 0)
    	{
    		return iFoodLeft;
    	}
    
    	iTurnsLeft = (iFoodLeft / foodDifference());
    
    	if ((iTurnsLeft * foodDifference()) <  iFoodLeft)
    	{
    		iTurnsLeft++;
    	}
    
    	return std::max(1, iTurnsLeft);
    }
    They avoid dividing by zero by returning iFoodLeft early if foodDifference = 0.

    If we're to avoid sdk changes, I would make this suggestion for Civ4lerts.py:
    Code:
    class CityHappiness(AbstractCityTestAlert):
    	"""
    	Displays an event when a city goes from happy to angry or vice versa.
    	
    	Test: True if the city is unhappy.
    	"""
    	def __init__(self, eventManager):
    		AbstractCityTestAlert.__init__(self, eventManager)
    	
    	def init(self):
    		AbstractCityAlert.init(self)
    		self.kiTempHappy = gc.getDefineINT("TEMP_HAPPY")
    	
    	def _passesTest(self, city):
    		return city.angryPopulation(0) > 0
    
    	def _willPassTest(self, city):
    		if (city.getFoodTurnsLeft() == 1 and not city.isFoodProduction() and not city.AI_isEmphasize(5) [B][COLOR="Blue"]and city.foodDifference() > 0[/COLOR][/B]):
    			iExtra = 1
    		elif (city.getFoodTurnsLeft() == -1):
    			iExtra = -1
    		else:
    			iExtra = 0
    		iHappy = city.happyLevel()
    I think this should work.

    EDIT... As I was thinking about this, I wondered whether this function correctly shows a city will grow into unhappiness in this scenario:
    City has enough food stored from its previous growth (or pop reduction) such that it doesn't need to collect any food this turn and it will grow. e.g. City has 80/60 food stored and is losing food at a rate of -1 per turn. I believe this city would not show up with an alert.
     
  2. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,068
    Gender:
    Male
    Location:
    On Earth
    Superb mod and i soon realized it's certainly a must for specific gameplay enhancements. Excellent work -- so far.

    Dunno if this has been mentioned and quite frankly i don't have the patience to read through 100 pages worth of replies :D ...

    BAT4.1 for version 317 (since i can't update to 319, even with the genuine Firaxis file!) seems to have a flaw when clicking on Exit to Main menu in Options -- it simply crashes Civ altogether.
    The regenerate map button is also unavailable... see, i enjoy "reloading" a BC4000 saved map instead of having to reconfigured everything back for custom games.

    While i also have your attention (maybe?!), i'd like to recommend a few things... if you don't mind;

    -- Moddable or not, somebody has got to try this one day; 5 more columns upon selection of Leaders (drop boxes)... two for Traits, two for Techs, one for starting color! By choice, even for AIs.

    -- A prospector settler which has a tag row overlay of "development potential" figures as a supplement to the usual default cyan circle suggestion; say, 20 Food, 11 Hammers, 15 Coins, etc.

    -- Your installer could also offer check-marks to choose which features one wants to use.

    In the meantime, keep the great stuff updated and please fix the above "crash" & ask me for any precisions if you have to.
     
  3. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    You realise you're making suggestions for how to change gameplay in an unaltered gameplay mod?
     
  4. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I assume you mean BUG 4.1 since the latest BAT doesn't work with 3.17. If not, please tell us which version of BAT you have. I haven't seen this crash, but I don't have 3.17 anymore. Can anyone else confirm this? Crashes to desktop are usually not the result of Python changes but rather XML and DLL changes which BUG doesn't have except for a couple minor event fixes that are included in the Unofficial Patch.
     
  5. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Instead of looking at turns until growth, I think I'll just add foodDifference() to foodStorage() and compare it to foodThreshold(). All I need to know is if growth will occur this turn or not. Thanks for the report.
     
  6. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,068
    Gender:
    Male
    Location:
    On Earth
    AFAIK, it is BAT 1.2 (for 317) & i have to wonder if my Civ install isn't corrupted - somehow. So i made a complete fresh install of everything and the situation still occurs.
    Forgot to mention i'm on a VISTA-HP setup, all drivers updated. Smooth normal setup.
    There's also the fact that i previously had two different copies of CIV; the first being Vanilla which i soon upgraded to complete. As i said, the IS couldn't uninstall the Vanilla copy by itself and i suspect the registry may be corrupted as well; something to verify on my end.
    There's also the fact 319 auto-updating still won't work -- it tried contacting 2K last week and i have yet to get an answer.

    I'm aware gameplay stuff such as new leaders column options *may* be tough to code-in (even by modding standards) but it's one of those things i'd like to see done - by Firaxis or not!
    As for the settler prospecting feature, i doubt this can be considered gameplay stuff - since it could only be helpful to receive extra figures on city location potential right off the bat (pun unintended).
    Btw, BUG..BAT..BULL; will any of the next version be called the BEE? :lol:
     
  7. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    A number of Dune Wars players have reported this problem. I am afraid that many other downloaders ran into the problem and just gave up, without even reporting it.

    Is there a way to create this folder automatically instead of trying and failing to write files underneath Program Files? Is there any drawback to doing that?

    If it is not possible to do in the game itself, is it possible to create this directory in the installer?
     
  8. pdonettes

    pdonettes Chieftain

    Joined:
    Feb 11, 2008
    Messages:
    46
    @emperorfool I have it to post, it is HUGE though. how do I do that cool little spoiler thing so not everyone has to read it?
     
  9. alerum68

    alerum68 Priest of Hiroshima

    Joined:
    Jan 3, 2004
    Messages:
    2,519
    Location:
    San Francisco, California, United States
    don't know about in-game, but the problem with the installer is that it has to be run as Admin on Vista Machine. I think this is only an issue when installing in Program Files, but I could be wrong, and usually am. I think alot of these issues would go away if we returned to putting it in the MyDocs folder.
     
  10. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    One way is to run "zip" on the file, and then use the paper clip icon to attach it to your post.
     
  11. Willem

    Willem Deity

    Joined:
    Feb 12, 2002
    Messages:
    7,313
    Location:
    Canada
    I believe you just need to use the tags spoiler, /spoiler, with [] brackets just like using quotes. At least that's how it works on other forums I hang out on.
     
  12. Persontom

    Persontom Chieftain

    Joined:
    Oct 4, 2009
    Messages:
    4
    Location:
    Slovakia
    @emperorfool
    I tried /AltRoot command-line option + used CvAltRoot.py file and modified BugPath.py
    Nothing changed (still no interface)
    My PythonErr.log still looks like this:
    Spoiler :
    Traceback (most recent call last):

    File "CvAppInterface", line 63, in preGameStart

    File "BugEventManager", line 319, in fireEvent

    File "BugEventManager", line 329, in _dispatchEvent

    File "BugEventManager", line 380, in _handleInitBugEvent

    File "BugEventManager", line 531, in initBug

    File "BugInit", line 45, in init

    File "BugPath", line 319, in init

    File "BugPath", line 516, in initRootFolder

    File "BugPath", line 552, in setUserDir

    File "BugUtil", line 243, in info

    File "BugUtil", line 267, in log

    File "BugUtil", line 282, in logToFile

    UnicodeEncodeError: 'latin-1' codec can't encode character u'\u010f' in position 67: ordinal not in range(256)
    ERR: Python function preGameStart failed, module CvAppInterface
     
  13. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I've fixed the error with detecting when a city will grow this turn. This fixes the growth, happiness, and health Civ4lerts as well as the City Screen (now says "Growth!"). I also fixed a problem that happens if your extra food after growth puts you over the next threshold, but that should never happen in a normal game.
     
  14. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,319
    Location:
    Australia
    Two words: Quick speed. Unless you meant normal speed when you said normal game, I frequently can get a city that accumulates food faster than it can grow when playing Quick speed. Ok, this city will usually be the one I put the globe theatre in, making the growth into unhappiness alert a non issue anyway but it's definitely something that happens in a lot of my games.
     
  15. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I'm glad I tested and fixed that part then. There are other bugs in CvCity::getFoodTurnsLeft(). It doesn't work for negative food rate, nor does the city bar. If you have enough food to grow but a negative food rate, it turns red as if you are starving. I can't fix that last one, but at least I fixed BUG's display. I also need to apply the same fixes to BULL.
     
  16. Cybah

    Cybah Emperor

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    this should have something do to with your newest BUG (from svn):



    never seen before. It looks like he wants to become vassal but he became already vassal of saddam (1st place at scoreboard - hard to see).

    happened after deactivation of AI autoplay. could have something to do with it too.
     
  17. EmperorFool

    EmperorFool Deity

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I believe I've fixed the default and Autolog event handlers for peace offers. Please test the latest SVN with your saved game and report back.
     
  18. Cybah

    Cybah Emperor

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Don't have the saved game anymore but will observe any new game. Thanks.
     
  19. davidlallen

    davidlallen Deity

    Joined:
    Apr 28, 2008
    Messages:
    4,743
    Location:
    California
    This is now the #1 reported complaint by the thousand plus downloaders of Dune Wars. The same problem is reported for Windows 7 users. I have to find a way to solve it. I am sure that every mod which includes BUG as part of its install is having the same problem.

    How can I prevent BUG from writing ini files? Or is there some other possible code change you can suggest?
     
  20. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    @davidallen

    The fix EF has posted is specifically for BUG, I do not think it would work for mergers.

    Here is a thread on the subject:
    http://forums.civfanatics.com/showthread.php?t=340727

    Hopefully EF can shed some light on how to set it up, so we can move the ini files outside of the ProgramFiles directory, and have BUG read them from there. This is how BtS handles it's master ini file, so there is no reason I see BUG couldn't do the same. Just gotta figure out how to set this up.
     

Share This Page