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

Game is freezing; not crashing

Discussion in 'Civ4 - Technical Support' started by khaneagles, Jun 22, 2020.

  1. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    Hello, I am a fan of the Civilization games; I try CIV 5 or 6 but don't like this games. So I am still playing CIV-4 Beyond the Sword.
    I create new mod for me (add units, civs, leaders etc.) but I don't change anything in python. When I played, the game is freezing; but not crashing. But music still continues and not crashes or turn backs to Windows. This always happens when the turn is on me (Not at the end of turn or AI plays) and in Renaissance or Medieval era. When I re-load the game I played 2-3 turns again but after the game is freezing again.
    I believe my computer (video card, ram or cpu etc.) is enough for playing CIV 4. Because many years I played this game with no problem. I thought that the problem is the game itself so I re-install game but still the freezing problem continues.
    I look forums in this site but I don't find any answers. I change resolution, play in window mode or change quality of the game (I play with the low quality) but every time the game is freezing after I play 2-3 turns after. I don't understand the cause of the problem. Can you anybody there to help me?

    P.S. Win7 64bit/Ati Radeon HD 4800 series/AMD 2.2 ghz cpu/8 gb ram
     
  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    Does the problem only occur with your mod? It's not inconceivable that an XML change could throw the game into an infinite loop – though I don't know any example of that happening. I have seen random freezes upon moving the camera in a mod, presumably caused somehow by a custom 3D model or animation.
     
  3. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    No I don't think the problem only occurs in my mod. Because, as you say, my changes in only XML files (add civilization, add units etc.) and I use 124x68 Huge Map not Gigantic Map. As you say when I moving the camera, the game is freezing. What do you think is the problem on my computer (video card, cpu or ram is not enough? If the problem is not on the computer, do you have any suggestions for a solution or how I can find the problem (custom 3d model or animation)?
     
  4. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    I don't really have experience with running extraordinarily large games. The (unmodified) BtS dimensions for WORLDSIZE_HUGE are 32x20 in the WorldInfo XML file, which gets taken times 4, so it's actually 124x80. I take it that your 124x68 is 31x17 in XML. I don't see how your hardware
    could possibly be insufficient for that map size even at maximal graphics settings. That doesn't mean the mod has to be responsible either, but, given that the mod is new and that the hardware used to work fine ...

    As for the freezes that I had once encountered, I had exchanged some brief messages with the mod's author about that; let me check ... I told him that (using a profiler) I had tracked down the infinite loop to a function named "Direct3DCreate9" in d3d9.dll. That information didn't really help matters. We concurred that it was likely an issue with the mod's graphics that we wouldn't bother to track down. He told me that enabling either single-unit graphics or frozen animations had solved the problem for him. (I always use frozen animations, so single-unit graphics seems like the likelier remedy; or both perhaps.)

    Maybe not worth the effort: You could check if your games also get stuck in Direct3DCreate9 by using a debug build of the CvGameCore DLL (to be placed in your mod's Assets folder – assuming that you don't already use a modified GameCore DLL) in windowed mode and an external profiler. I've used Very Sleepy; screenshot attached. It shows the currently executed function on the upper right if the Civ4BeyondSword process is selected on the left. The debug DLL might also report (unrelated probably, entirely harmless possibly) problems during XML loading by showing failed-assertion popups. Actually, if the loop is indeed in d3d9.dll, then there should be no need for the debug GameCore DLL; would help to have it though if the loop turns out to occur in the GameCore DLL.

    Or, to check if the problem also occurs without your mod, you could use the AI Auto Play mod or the built-in aiplay command on the Python console to advance the game into the Renaissance era, and then move the camera around. Since aiplay kills the human civ, you'd have to use Alt+Z to switch to another civ once aiplay has ended. (Or you could simply set Medieval or Renaissance as the start era, but perhaps there needs to be some more stuff on the map to trigger the error.)
     

    Attached Files:

  5. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    Ok I will try your suggestions and report after that. For a now thanks for your advices
     
  6. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    First of all I don't open the game with a debug build because I get "Assert Failed/File: CvInfos.cpp" and more failures. I remember that I use unofficial-patch-019-50civs.zip for many years; I play before unmodded Bts or https://forums.civfanatics.com/threads/earth-35-civs-next-war.363408/ mod without any problems.
    I control and find d3d9.dll files in my Windows and also my screenshot attached too.
    After your words I try to play with Window mode/Music off/Single Graphics Units/Animation Frozen and also Low Graphics Level but the game is freezing again.
    Freezing is not always the same turn. When playing my mod (I saved the game every turn) 2-3 or even 5 turns without problems. But when I move the camera 3-4 times the game is freezing. Should there be a problem with the mod, wouldn't it be always the same turn? Or am I wrong? Because of that I don't try AI Auto Play or aiplay.
    I think game graphics (due to the new units graphics I use) are not enough for my graphics card. But I am not sure if it is correct to buy a video card without knowing whether it is a very old game and whether it will work. Since I am not sure, I am worried that if I buy a video card for this and the problem persists. Sorry, so I persistently ask if the problem is caused by the video card or the game or the mode itself.
     

    Attached Files:

  7. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    OK, I don't have an debug build of that. So long as you're not playing a 50-civ scenario, the debug build of the original GameCore DLL should still be compatible with your non-DLL changes. If there are a lot of failed assertions, then there are probably some problems with your XML files, but those could be minor issues and I rather doubt that they're related to the freezing.
    Sounds like DirectX is in the right place then. Was the screenshot taken while Civ 4 was frozen? If so, it's strange that Civ4BeyondSword.exe has 0% CPU time.
    :(
    Hard to say, at least for me. The problem not occurring until the Medieval or Renaissance era could mean that memory usage needs to reach some threshold first. Or it could mean that the graphics of some particular late medieval unit (building? terrain improvement?) are causing the problem. Whatever the cause, it could be, for example, that the graphics engine ends up reading unallocated memory and enters an infinite loop only when that memory happens to contain some special value, say, a negative value, 0, a very high value ... Something like that might explain the randomness.
    Upgrading the hardware seems like a long shot to me. Unless it's defective, but I assume that there aren't problems with other games and that Civ 4 doesn't have performance problems either – apart from freezing entirely. Games on extremely large maps typically run into a memory allocation fault and crash (better hardware doesn't help with that either because 32-bit applications can only address a limited amount of memory). Are any of the mod's graphics files unusually large?

    The Tech Support forum is a bit of a ghost town, but then, the Unit Graphics forum (under Creation & Customization) also doesn't have much activity and I don't think random freezing upon camera movement is a widely known problem; so, don't know if it would help to ask there. There's also the Quick Modding Questions thread, but, yeah, it would be good to have some confidence that this is a modding issue before posting in the modding forums.
     
  8. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    No, I take screenshot when I open BTS. Not while I play the saved game; because when I play the game and want to Alt+tab the game is freezing too. :)

    If there is a problem what can I do for understand the reason of that problem?

    I am sorry but I don't know the mod's graphics files unusually large or not. How can I look to that? And I don't understand your answer for "if I had a better video card or better computer, would that still occur or not?". Because it is certain that my computer is old and now it is problematic for me to play new games. If a new computer will eliminate these problems, it will remind me that I have to adapt to the technology. :)
     
  9. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    The idea with the profiler is to check what the game is doing when it isn't responding. So the game freezes (for whatever reason), you minimize it (can't hurt anymore at that point), start Very Sleepy and ... well, how helpful that'll be is unclear, probably not very, but, since you've already installed Very Sleepy, it shouldn't be much effort either. [Or perhaps I misunderstand – are you saying that your whole system becomes unresponsive when the game freezes and therefore you can't Alt+Tab out?]

    Freezing upon Alt+Tab doesn't seem that uncommon. Here's a thread from the not all too distant past; no one offered a solution though other than playing in windowed mode (which is my preference anyway but your mileage may vary).
    https://forums.civfanatics.com/threads/civ-iv-alt-tab-switching-causes-game-freeze.452733/
    I'd check whether the problems – freezing upon camera movement or Alt+Tab or both – occur without the mod. The Alt+Tab thing, to me, makes it sound somewhat more likely that the graphics of some particular unit aren't responsible and that there could indeed be a hardware defect or installation or system/ driver compatibility issue. Insofar, it could be that the problem would no longer occur with a new computer – but I doubt that the greater hardware performance would be decisive. Your computer may be old, but it isn't 20 years old. The original system requirements are way lower than what you have and the dimensions of Huge maps were the same when the game was released.
    https://support.2k.com/hc/en-us/articles/201333333-Civilization-IV-PC-System-Requirements
    I guess, in theory, user-created graphics could make a significant difference, but that's a pretty wild guess.
    I suppose your art files are in Assets\Art. A typical size for a unit's .nif file seems to be 50-100 KB. More detailed models should result in larger files. But I really don't know what I'm talking about here. If you suspect that some graphics file might be buggy, then it could also help to check which units (or buildings?) are on the screen (or have perhaps just gone off-screen or are about to go on screen) when the game freezes.
     
    Last edited: Jun 29, 2020
  10. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    Hello again. First of all, I'm sorry I couldn't write because of busy days.

    I tried the below 3 times and when the game was frozen I added screenshots. (Freeze 1-2-3) I also added the version of the loaded game before freezing (while playing the loaded game). (Playing 1-2-3-4) I even added the in-game screenshot when the game was frozen. (Freeze-4)

    I looked at the .nif of all buildings and units. Some units / buildings have 1 mb .nif. But some of them have never been used because they are usually used for later ages. For those used in Medieval or Renaissance ages, there are 100 kb, 200 kb or maybe 500 kb.

    By the way, I wanted to download d3d9.dll and install it again in case it was caused by directx; but I can't get into the game right now. I think I made it worse when I wanted to fix it; so it will be necessary to install a new Windows. :)

    I don't know if my posts helped, but do you have any ideas after these files?
     

    Attached Files:

  11. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    :eek2: I hope I haven't contributed to this mess.

    Then I'd assume that the graphics in use aren't significantly more taxing for the hardware than the original graphics. However, the map has something like 60% land, so there may well be twice as many cities as on a Huge BtS map with Low sea level. A lot of population too and thus many residential building models. And 30 civs. I don't suppose that those all have their own art style; at least the German and English models don't look distinct. Anyway, a lot of stuff, but ... it shouldn't be too much.

    The models on screen all look familiar, except perhaps the rider near Oslo. But perhaps trying to spot the culprit is a naive approach. I don't know, I'd expect a broken model to trip up the game before it comes on screen. So perhaps this was a dumb idea by me. Though I feel that I got some other potentially interesting info from that screenshot (see above).

    initCvPythonExtensions being executed a lot while playing is probably normal, at least during the human turn. If I try it, I also see that function, alternating mostly with Sleep and Direct3DCreate9. Two of the freezes showing 0% load isn't what I expected. Let's see; if I minimze the (non-frozen) game in the background, I also get 0% CPU load or close to 0. I can't even find out what "Xcpt" stands for. :/ The third one looks like the freeze that I've encountered. That was with a mod and game settings that surely weren't overwhelming my hardware. So, inconclusive.

    I'm gathering that a test without the mod isn't all that easy to do. You'd have to set up a similarly large game ... Perhaps it would be easier to just move the Art\Units folder out of the mod and see if it still freezes. Not sure if it'll still load at all though without that folder. Of course, right now, you can't really test anything. :(
     
  12. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    Of course not. This was completely due to my stupidly changing the d3d9 file and then not fixing it. But I did this with a new Win installation; I even wanted to do it for a long time. So it was a positive contribution :lol:

    First of all, I don't know how I should thank you. Both taking time and answering and helping me solve my problem. :cool: Finally a problem was found. As you said, I deleted the items in the assets/art folder one by one; there was no problem when I finally deleted the nifs of the new buildings. I moved the camera on the map 20-30 times without any freezing. It has not had any problems so far and I hope not. :) Now which building is causing problems, I will try one by one, but again, thank you very much.
     
  13. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    That sounds promising. :thumbsup: Maybe some building that was recently completed in your save, by your civ or a nearby AI civ.
     
  14. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    The problem has been solved but I could not find the source. I tried all of them one by one, but it's okay. The Art/Structure/Buildings folder freezes when it is over 11-12 mb; but it does not freeze when it is under 11-12mb. I haven't figured out why yet, but at least I have the opportunity to play before the game freezes.
    I wonder if I made all buildings and even units in "fpk" format, I thought if the problem would be solved, but I could not find how to do this. I thought maybe doing "fpk" solves all the problems; but that's just the guess, of course.
     
  15. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    That sounds bizarre enough to be true. Good idea about packing the art; worth a try. PakBuild can be downloaded here:
    https://forums.civfanatics.com/threads/civ4-pakbuild.136023/
    I don't have a lot of experience with it. It should go something like "File" -> "New", select a folder with Art, click "New PAK file", "Add" files from the left to the right, check "Store full paths", "PAK" -> "Build". That should create Pak0.pfk under the "Output Folder" path, which can be renamed arbitrarily. May also want to "File" -> "Save as" to store a .FPK_layout file in case that you want to re-create the .fpk file at a later time.
    If you google for PakBuild in site:civfanatics.com, there are plenty of threads. Iirc very large .fpk files can lead to instability; but below 1-2 GB should be safe and one can always create multiple .fpks.
     
  16. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    Yes, when I searched the site, I found it; but "pak" didn't work. The sum of the Art / Buildings folder is 25 mb. When half is deleted and 11-12 mb remains, it can be played smoothly. While there was no problem with individual files, I still couldn't figure out the meaning. If I remove all the nif files, I guess the problem will be solved. I don't know if I'm really the only one with this problem, but at least the "thanks to you" problem has been solved. But how I solve "this nif problem" I really don't know. :cry:
     
  17. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    680
    Location:
    Germany
    You're welcome. I don't know if PakBuild scrutinizes the files somehow or if it should just pack anything ... (Is there an error message?) I guess I'd ask directly in the Creation & Customization forum about the file size issue and whether PakBuild should help.
     
  18. khaneagles

    khaneagles Chieftain

    Joined:
    May 18, 2007
    Messages:
    11
    No there's no error message; but PakBuild doesn't help me. I will look and maybe I solved problem too. Thanks much again.
     
    f1rpo likes this.

Share This Page