An Idiots Guide to Editing the DLL

Thank you so much for doing this! This tutorial is desperately needed, because C++ is used in such a different way for Civ IV (as you yourself noted!). I look forward to your next lesson! :)
 
By the way, I will write all of these on-the-fly. So if anybody has some specific requests for what I should write the tutorials on which are still upcoming, feel free to request them. Most likely what you request will lead to far more interesting "Oh yeah! I have to do this too..." moments than the things which I grab, and potentially be useful somewhere in a mod (not sure how many people were just DYING for a promotion to get better results from goody huts with...)

EDIT: Added a new section to post #1 about commenting your code. I realized that while I advised the prospective modder to do so, I didn't exactly tell them HOW to do so, except for once in passing when I said that "//" starts a line comment.
 
Well, here's a request, but I don't know how hard this would be to code, so I'll understand if this doesn't get mentioned in your tutorial... :)

I'm working on a mod for Final Frontier, and I need a Promotion that is basically an "Ion Pulse." The promotion is a once-per-turn "spell" (like in FFH2) that disables a single unit for one (or two) turn(s). The tricky part is where stacks come into play; I don't want it to hit the whole stack! :) My preference would be for the player who fired the pulse to be able to choose which unit to hit. If that's truly impossible, I'd settle for the strongest unit.

Would this be a useful example of how to use SDK/C++? I really don't know-- I'll leave that up to you. :)
 
You could show us where BTS' Great General creation is hid. I'm sure a lot of people would like to tweak those numbers, if nothing else. There's also a lot of stuff about the specialists in general that's not a part of xml/python.

And I want to re-enable generals through combat. :P
 
I'll move over to a more base-line color and check out the default scheme for readability too in the future. Don't understand why people stick with the default layout here :p

Not sure if I completely understand how you want the Ion Pulse to function, but it would most likely not be something you would implement as a new XML Field. To allow the ability to be targetted you would want to utilize python, so it might be a good example for the "Creating a Python Callback" function. Though honestly if this is the only promotion which will ever do such a thing you are better off sticking to pure python for it. Not too easy of a function to generalize, and you don't want to hard-code in the DLL since it is a mild PITA to adjust things.


From what I see in the FfH base code, you can re-enable Great Generals from combat by just creating a unit (any unit) which offers a LeaderPromotion or LeaderExperience. In Fall Further I actually stopped this function from running at all, so THERE you would have to remove a block in the DLL (void CvPlayer::setCombatExperience(int iExperience)).
 
Wow this great. I have been praying for this info for ages. At the moment tho' i am busy making unit graphics but soon as i get tired of that i will be back to editing my mod and it is fast getting to the point where i will need to monkey about with the sdk to achieve my vision. Nice work!
 
Not sure if I completely understand how you want the Ion Pulse to function, but it would most likely not be something you would implement as a new XML Field. To allow the ability to be targetted you would want to utilize python, so it might be a good example for the "Creating a Python Callback" function. Though honestly if this is the only promotion which will ever do such a thing you are better off sticking to pure python for it. Not too easy of a function to generalize, and you don't want to hard-code in the DLL since it is a mild PITA to adjust things.

Well, what I'm going for is almost exactly like the spell "Blinding Light" from FFH2 with some important changes: the "spell" wouldn't hit all units in all adjacent plots, but would be targeted at one plot (similar to bombarding), and could only hit a single unit (chosen by the "casting" player). Man, now that I describe, it really sounds complex...

But does that make it a bit clearer what I'm after? If it's all in Python, then that's cool, but it would not be my only Promotion (I plan on adding quite a few others that might be similar to other FFH2 spells). Once again, though, I understand if you don't include this in your tutorial...but I can hope! :)
 
I think I mostly follow what you are seeking with it. And due to being targetted/triggered type of effects, the spells are almost all best as spells.

If you want them to act on each turn, then they gain some validity as candidates for an XML field in PromotionInfos, but even then you really want it to be something that you use on a lot of different promotions (can't think of many good examples), something INCREDIBLY simple/passive (like bBlitz), or something which will have numerical differences between different promotion (like iCombatBonus). Something which is a "do this thing each turn" hits a bit of a grey area (it could be a fairly simple thing, like March promotions "always heal"). However, the moment you talk about targetting and strategic choices, then it starts to sound more appropriate for python to handle.
 
Very nice job. I only read the fist post and basics of the dll, but very well writted and useful once I get into the dll after learning python. We needed an idiots guide.
 
Better actually PM a Mod or they might not see (to) it.;)

OMG ! Can I really ask for moderator status when I'll be blind ? (sthg that will happen eventually :cool:)

More seriously, I prefer to be confident and think moderators are reading the threads by themselves from time to time and not only upon user's report. I think that sticky thread doesn't have to be requested, petitioned or lobbyied. IMO polite suggestion is all about it.
 
Well, if you think lobbying will do no good... (I merely mentioned it, because there's countless threads out there, which can't possibly all be read by moderators - they'd have a full-time job doing that.)
 
I need basic info about python and SDK. I'm learning the xml part of modding and getting to a point of working the files okay by myself (through the help of many ppl in these forums).

I'm wondering when would I need python or SDK ? What is the modding point when someone has to migrate to python or SDK ? An example for each would be nice.

Thank you
 
@xienwolf

I just wanted to say that this is really a wonderful and most needed guide. I've read the intro and skimmed through some of the other posts and I really like the way you explain things so as to make it really easy for beginners who possibly have never wrote C++ code before. On the other hand the guide is so helpful even for those who know C++ very well. There is a difference between knowing the language and knowing how to get things done with a specific API.

I hope a moderator would notice the thread and sticky it but I doubt it will happen unless someone (maybe you) PMs one of them. I can judge from the fact that the thread for setting up the SDK with Visual Studio has been around for years without becoming a sticky up till now. Moderators have limited time and they would spend it in the most trafficked sub-forums (this is not really one of them of course).
 
Back
Top Bottom