Does anybody know computer code?

Discussion in 'Civ4 - General Discussions' started by jdurg, Nov 28, 2005.

  1. jdurg

    jdurg Warlord

    Joined:
    Nov 7, 2001
    Messages:
    151
    Location:
    Connecticut
    I went and installed the Python 2.4.2 shell on my computer, and it now allows me to see into the .py files in the Python directories in the main Civilization 4 directory. I can't believe how much of the code for this game is contained right in the installation folder! I'm currently looking through the python files for the wonder movies to see if I can find ANYTHING that would indicate why the movies are playing so poorly. I figure that if I can figure out what could be causing the problems, we might be able to discover a fix for it. :D
     
  2. Psyringe

    Psyringe Scout

    Joined:
    Dec 7, 2001
    Messages:
    3,394
    Location:
    Berlin, Germany
    The .py files are in plain text, you don't need to have Python installed to read (or change) them. :)

    I'm not sure whether the reason for the choppy movies can be found in the Python code. I think it's more likely a core issue, having to do with to many processes going on and not stopping while the movie plays. But I may be mistaken of course. I'm no programmer unfortunately.
     
  3. warpstorm

    warpstorm Yumbo? Yumbo!

    Joined:
    Dec 19, 2001
    Messages:
    7,688
    Location:
    Snack Food Capital of the World
    I think the movies are played by Bink which is not in the python.
     
  4. RedRoger

    RedRoger Chieftain

    Joined:
    Nov 6, 2005
    Messages:
    13
    I found that i had to update my drivers, and/or turn the graphics level down to properly run the wonder movies.
     
  5. Me_

    Me_ Chieftain

    Joined:
    Nov 24, 2005
    Messages:
    15
    Python is a glue language. It's usually used to hook together the core components, which are probably done in C++ or similar. The movies will run slow for one of two reasons:

    1. It's simply a graphics issue, something to do with your video card. This would be my guess.

    2. The game is doing a lot of background processing, like still running the AI while running the movie. This would be simply ********, but I have been generally unimpressed with the requirements of the game. For a non-graphical game, to have the minimum setting require a fairly new video card is silly; give me the Civ3 graphics engine over the Civ4 game and I'll be happy.

    Anyway, it's probably a graphics issue, meaning they are rendering the movies on the fly, another bonehead programming move, though it will reduce the size of the install (which is why most games have one install CD and one play CD with movies). Update your video card drivers, then either buy a new card or give up. Sorry.
     
  6. MNGhost

    MNGhost Chieftain

    Joined:
    Oct 27, 2005
    Messages:
    62
    Python is just a very powerful scripting language. I believe they use it for configuring the various rules used in the core game and scenarios. They leave it exposed to allow for modding. The Python code isn't going to include any parts of game binaries like the graphics engine or the movies (you wouldn't want to level such things to a scripting language anyway). There may be a way to alter the code to turn off the movies, or maybe switch which movies get played for which wonder (if one would ever want to do that), but you won't be able to alter the movies themselves.
     
  7. MNGhost

    MNGhost Chieftain

    Joined:
    Oct 27, 2005
    Messages:
    62
    I just got to thinking. There certainly is a lot of Python in there, which is all uncompiled code. That means the game would need to either compile or interpret the code on the fly. Could this be part of the reason for the inefficiencies we've all experienced in the game? That sure would be a lot of file reading and processing going on.
     
  8. screwtype

    screwtype Warlord

    Joined:
    Jul 23, 2004
    Messages:
    291
    Yeah, it could be. Right from the moment I started playing, the game "felt" strongly like it had been written in an interpreted language.

    But really, I don't know. If it's re-compiled every startup, it should run okay.
     
  9. calyth

    calyth /bin/sh of a man

    Joined:
    Nov 8, 2005
    Messages:
    436
    Scripting languages like Python usually allows for fairly fast developement - because many of them are in higher levels that doesn't require you to manage the annoying low level bits all the time. e.g. like creating array to a certain size, and if you blow through that size, you'll have to reallocate space, same for buffers, and stuff. With some scriptinglanguage, there are no differentiation between types (you don't have to say that the variable stores an integer, or a floating point number, or others). Also, usually scripting language tries to be programmer friendly - it is fairly easy to learn, and things are easy enough to read that even a non-programmer can kinda follow what is going on.
    Probably makes a decent languages to build mods without writing your own scripting language.
    But problem with most scripting language is that they don't paticularly compile the code into the machine code that your CPU understands. They usually do this on-demand. So the python interpreter (a program that is compiled to machine code) reads the script, and convert the script to machine code, and then that machine code gets executed (I'm sure I'm missing something here, or I might even be wrong). While compiled languages like C/C++ takes a program that reads the source file, and converts it into machine code that the CPU understands, and you're given this code to execute.

    There are advances that makes [semi-]interpreted languages run faster. I think my compiler prof said that the latest Java may figure that certain piece of code gets executed a lot, and it would optimize and compile that section into machine code.
     

Share This Page