[SDK & Python] - Is there a difference? Also, any ideas about how to do this?

Bihal

Chieftain
Joined
Nov 30, 2007
Messages
3
Hey everyone,

First time poster, long time reader/player. I was wondering if there is a difference between the Python stuff and the SDK? I'm a C++ programmer by trade so I'm quite comfortable in Visual Studio with the SDK, but know very little about Python. I'm under the impression that the Python interface accesses the SDK. Is this true? (ie. There's no reason for me to use Python for anything if I'm using the SDK)

Secondly, I'm hoping to put in a useful foreign advisor, one that will let you know what the consequences or your choices in the Diplomacy screens will be. Not having much luck at the moment. Somehow saying "Hey, this choice will really piss off whatshisname." Anybody has any ideas which way to go with this, I'm all ears.

Bihal
 
Python has access to a variety of SDK functions that have been exposed to python, normally you'll see a comment indicate that a method is exposed to python. You can also search the various 'interface' cpp files, they'll contain all of the exposed functions.

Python should be pretty easy for you if you're comfortable with C++, it's the exact opposite :)

Well, ok, not really but enough to be annoying, like termination an if statement with a ':' but not terminating other statements at all. You should be able to get a good grasp of the syntax from looking at some existing scripts. I also recommend grabbing Open Komodo to use as your python IDE for the syntax checking and auto-complete. Most of my python errors were caused by messed up indentation and Open Komodo will point those out for you.

You can grab Open Komodo for free from Active State here: www.openkomodo.com

Most interface mods, like modified advisors, will require a lot of python editing so be prepared :)
 
okay, so you're telling me that I can do things in Python that I can't do through in C++ with the SDK?
 
okay, so you're telling me that I can do things in Python that I can't do through in C++ with the SDK?

Bingo. Python can be used for a number of different things in the game, but it's the user interface that is almost exclusively python. Anything involving changes to the UI will have to be done here unfortunately. I prefer C++, so I usually have to find someone more familiar with python to make these changes when I need them. Anything other than UI changes though should be done in the SDK IMO.
 
Okay.

So is it possible to change or add to an existing interface (like the diplomacy screen) or add one of your own?

Bill
 
Definately. For interface work you should only need SDK changes to write your own utility code to expose the data to python so the interface can display it if the game doesn't currently support displaying that data. You shouldn't need to add anything for most common changes though.
 
Okay.

So is it possible to change or add to an existing interface (like the diplomacy screen) or add one of your own?

Bill
Most interfaces yes. Adding one certainly. But some, like the diplomacy screen, is somewhere else (exe problably). There isn't that much you can do with the diplomacy screen unless you rewrite the whole thing yourself. Most of the things you can change is in CvDiplomacy.py.
 
Back
Top Bottom