The Great Setter project... for experienced C++ programmers

RogerBacon

King
Joined
Nov 16, 2003
Messages
649
When the SDK comes out it will only really be useful to experienced C++ programmers. What I would like for the experienced programmers on this forum to do is create a DLL that will enhanced the usefulness of Python by creating setter functions to match all of the getter functions we already have in Civ's Python. I would like it to be that someone using Python can alter any value that is defined in the XML with python statements. Currently we can get almost any value but can alter only a few.

This will be a big project and I'm not even sure if it will be possible (since I haven't seen the SDK yet) but I think it will really enhance the modability for those who can do a little Python but don't want to tackle C++. I hope this idea will be popular with the C++ programmers on this forum and we'll see a lot of people volunteer to help make it a reality.

Roger Bacon
 
Roger, do we know for sure that the SDK will be in C++ and not another language?
 
This would be a very daunting (and useful) mod. But I would worry about the performance impact of making all of these variables dynamic.

You may be better to do a few that you think would be of value to the community and then document the process so that mod makers can go set defines for the variables they expect to use.

Just my 2 cents.
 
TheLopez said:
Roger, do we know for sure that the SDK will be in C++ and not another language?

That's what I've read several times on this forum but that may have just been people speculating. If not C++, what else? C#? That would be even better but I don't think they are using C#.

Kael said:
This would be a very daunting (and useful) mod. But I would worry about the performance impact of making all of these variables dynamic.

I'm not sure how performance would be impacted. Memory would be (almost)the same because the game already reads all of the XML into memory. Processing power would only be used when actually executing the Python function to change a value. It's possible that I'm wrong but I don't see this as a big performance hit. Playing on a larger map would have a bigger performance impact.

Roger Bacon
 
RogerBacon said:
I'm not sure how performance would be impacted. Memory would be (almost)the same because the game already reads all of the XML into memory. Processing power would only be used when actually executing the Python function to change a value. It's possible that I'm wrong but I don't see this as a big performance hit. Playing on a larger map would have a bigger performance impact.

Roger Bacon

Yeah, but you wouldn't be changing the cached xml data. You would still want a default spearman to have the default settings. I assumed you wanted the ability to change something like bCanMoveImpassable on a particular instance of a unit dynamically.

So you could call pUnit.setCanMoveImpassable(True) from python.

Currenty there isn't any reason to store that data on a specific object, afterall its the same for all units of that type so the game would just read it from the unittype information. To do what you suggest all data for a unit (all that XML) would need to be stored on each unit so that it could be dynamically, and individually, modified. Thats the performance hit I was worried about. Higher memory requirements, slower loads and saves.

Course as you say, we will need to wait for the SDk to see for sure. And I do think this is a fantastic idea (I could put it to immediate use) so I do hope that a reasonable solution is found.
 
Kael said:
I assumed you wanted the ability to change something like bCanMoveImpassable on a particular instance of a unit dynamically.

So you could call pUnit.setCanMoveImpassable(True) from python..

No, actually, I wasn't thinking that grand. I was just thinking of modifying the values for classes, not instances of each (like units).

Actually, I already have a game where I change MIN_CITY_RANGE from 4 to 2 at one point in the game. Unfortunately, I have to do this by direct memory addressing (searching for the string "MIN_CITY_RANGE" and then modifying a byte 52 bytes before it). I would like to be able to do things like that directly in Python because it's cleaner and safer. That's the sort of stuff I was thinking about.

Roger Bacon
 
RogerBacon said:
No, actually, I wasn't thinking that grand. I was just thinking of modifying the values for classes, not instances of each (like units).

Actually, I already have a game where I change MIN_CITY_RANGE from 4 to 2 at one point in the game. Unfortunately, I have to do this by direct memory addressing (searching for the string "MIN_CITY_RANGE" and then modifying a byte 52 bytes before it). I would like to be able to do things like that directly in Python because it's cleaner and safer. That's the sort of stuff I was thinking about.

Roger Bacon

Ahhh.. gotcha. That shouldn't be as hard.
 
RogerBacon said:
... I would like it to be that someone using Python can alter any value that is defined in the XML with python statements. Currently we can get almost any value but can alter only a few.
...
Roger Bacon
What value would you like to modify first...??
Writing setter for all exhaustive list of values will be big project.
But setter project for most frequently used/most urgent values will not that hard.
Let's list up most wanted values to set or its getter function name in reply..
 
Back
Top Bottom