SDK request: Tech Yield & Commerce modifiers

Well people. First stage is now done-just thought I would let you guys know so that you realise that I am not just sitting on my butt ;) :p.

So, here are a couple of pics. Is this what you were looking for ArbitraryGuy?

Civilopedia_TechInfo1.JPG


and

Civilopedia_TechInfo2.JPG


Now all I need to do is make it DO something ;). On to CvTeam, CvPlayer and CvCity!!!

Aussie_Lurker.
 
Aussie_Lurker said:
Well people. First stage is now done-just thought I would let you guys know so that you realise that I am not just sitting on my butt ;) :p.

So, here are a couple of pics. Is this what you were looking for ArbitraryGuy?

<SNIP>

Now all I need to do is make it DO something ;). On to CvTeam, CvPlayer and CvCity!!!

Aussie_Lurker.

Wow! You definitely haven't been sitting on your butt :). That is exactly what I wanted! Looks great! Thank you, this will be a great contribution that many people (including myself) will surely use. :goodjob:

Dom Pedro II posted this request earlier:
Dom Pedro II said:
How about reducing maintenance costs too?

Do you think you could put that in as well (hope I'm not pushing your patience or acting needy ;))? If not, that's okay. Thank you so much!
 
hehe. Don't thank me yet AG. I still need to get it working in-game (i.e. it still doesn't have an impact on the actual yields and commerces). I did run into some problems, but I think I know where I am going wrong, so will hopefully be able to tackle this again later today. My real difficulty is that I have never had to deal with anything which is processed through CvTeam before. Once I figure that out I should be fine. Oh to be a modding genius like TheLopez ;).

Aussie_Lurker.
 
Aussie_Lurker said:
hehe. Don't thank me yet AG. I still need to get it working in-game (i.e. it still doesn't have an impact on the actual yields and commerces). I did run into some problems, but I think I know where I am going wrong, so will hopefully be able to tackle this again later today. My real difficulty is that I have never had to deal with anything which is processed through CvTeam before. Once I figure that out I should be fine. Oh to be a modding genius like TheLopez ;).

Aussie_Lurker.

When you get to compiling it, could you include your CivicsInfosPLUS mod in there as well? (I do not have the SDK compiler to combine them). Thanks. ;)
 
That shouldn't be too much trouble. You do know, though, that this is all in warlords don't you? Just thought I should warn you ahead of time...

Aussie_Lurker.
 
Aussie_Lurker said:
That shouldn't be too much trouble. You do know, though, that this is all in warlords don't you? Just thought I should warn you ahead of time...

Aussie_Lurker.

That'll just give me an excuse to get Warlords ;).
 
Hey there guys. Just a quick update:

So far I have CvInfos, CvGameTxtMgr, CyInfoInterface, CvTeam and CvPlayer all properly altered and compiled. I am, however, running into problems with CvCity.
I think this might stem from two key problems. The first is that I haven't figured out a way of passing on team info to individual players-either within CvTeam or in CvCity. I am hoping to get some advice on this soon, after which it should be easy enough to get this function to work properly.

Aussie_Lurker.
 
Hi guys. I have run up against an 'error' I have never seen before, and am not entirely sure how to deal with it. However, I think that if I work this out, I will have this thing NAILED!!!!

OK, on Impalers advice, I have added the following code under CvTeam::ProcessTechs

Code:
// <Tech Bonus Mod Start>
	CvPlayer* pPlayer;
	int iLoop;
	// <Tech Bonus Mod End>

Based on similar code I have in CvPlayer, I figured this was the way to loop through each of the players when processing techs.
Now, this didn't give me an error-just a warning! This is the warning:

Code:
CvTeam.cpp(4599) : warning C4101: 'iLoop' : unreferenced local variable
CvTeam.cpp(4598) : warning C4101: 'pPlayer' : unreferenced local variable

How do I make these variables referenced, does anyone know?

Aussie_Lurker.
 
Hi guys. Please ignore my previous message, I was being a complete IDIOT!!!! Anyway, I looked at a host of other code within CvTeam, especially those that used the for (iI = 0; iI < MAX_PLAYERS; iI++) function. It took a while to nut it out, but finally I was able to work up the following code:

Code:
for (iI = 0; iI < MAX_PLAYERS; iI++)
	{
		if (GET_PLAYER((PlayerTypes)iI).isAlive())
		{
			if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
			{
                for (int iY = 0; iY < NUM_COMMERCE_TYPES; iY++)
                {
                    GET_PLAYER((PlayerTypes)iI).changeCommerceRateModifier(((CommerceTypes)iY), (GC.getTechInfo(eTech).getCommerceModifier(iY) * iChange));
                }
			}
		}
	}

I also took a look at Impaler's TechSpecialistYieldModifierCode in CCCP, just to make sure I was on the right track. It all looked good so I went ahead and compiled it and Built the .dll
Short story is-it works PERFECTLY!!!!! It was beautiful to see the science counter jump from 9 beakers to 66 beakers when I gave my civ Scientific method, and to see the food jump to 22 when I gave it Refrigeration!!!!!!
So, it only took a weekend to add this new function-I must be getting better :p. Thanks to Impaler and DPII for ALL your help-you guys are the BEST!!!!

Now, next step is to copy/paste it into my civicsinfosplus files for AG. Give me another 24 hours or so and I should have the finished version for you!

Aussie_Lurker.
 
Actualy your thinking of "variable used with out Initialization" which is calling the value of a variable when it still has garbage in it (all variables are created with garbage in them if you dont specify something for them to be set to at the time their created)

So for example...

int i; Creates i and leaves it in its natural garbage state
int i = 0; Creates i and Initializes it to a value, note you can have a function their instead of the hard value.

Most people like to declare the variables of a function right at the top, Firaxis generaly likes to use a single variable for all the looping. Its generaly not Initialized because their going to set it when the loop starts. Infact it would be as waste of time to initialize it to anything because that value would just be thrown away later.

for (i =0; i < something; i++) so long as the variable is set to some meaningfull value before its used to do anything the Compiler will see that and say "OK thats Cool". If on the otherhand you had something like

int i;
somefuntion(i);

Then its going to scream bloody murder because theirs no way that can be anything but a bug, i could be any concivable number from 0 too 2^32 and its totaly unpredictable.

Aussie's error was actualy the opposite problem, he had a variable which was never called by any function. This isn't going to cause anything to go wrong in the program its just a waste of memory. Realisticaly the Compiler throws up the warning because you probably ment to use that variable someware and theirs a good chance you have a logic error because the wrong variable is being referenced someware.
 
Well, as promised AG, here is the combined Civics and Tech mod. Hope this finally gives you the incentive to grab Warlords ;) :p.

You can grab it from Here

Aussie_Lurker.
 
Aussie_Lurker said:
Well, as promised AG, here is the combined Civics and Tech mod. Hope this finally gives you the incentive to grab Warlords ;) :p.

You can grab it from Here

Aussie_Lurker.


Aussie,

I really hate being the bearer of bad news...


... but this mod has same problem that the CivicsInfoPlus mod has: all buildings are only taking one turn to complete, and all techs are only taking one turn to discover.

I unloaded the mod and played a few turns with vanilla Warlords, and a couple other modcomps just to see if it's not my system that's screwed up, and they're playing just fine. But when I load up the TechCivicsFusionMod or the CivicsInfoPlus mod, it goes right back to the one turn building/technology problem.

It's gotta be something in the code. :sad:
 
Well, I find that incredibly odd as I played almost a full game the other night using my Expanded Civics mod (which is based on the CivicsInfosPlus code) and I didn't run into that problem. In fact I was suprised at how smoothly the whole thing ran.
However, one thing came to mind. The problem might actually be in the XML files, NOT in my code. When testing my mods I usually use outrageously high settings in order to 'prove it works'. It might be possible that I forgot to remove one of these outrageous settings when I packaged the whole thing together (for which I apologise). I will be having a look at the files you sent me yesterday, GraveEatr, to see if I can find the problem.

Aussie_Lurker.
 
Actually, good point DPII. GraveEatr. Check the hammer and science output of the city or cities in which you are getting this problem. As I said above, the problem might be because I left the odd 500% Science or Hammer modifier in my XML file :mischief:. If your hammers and science are what you expect them to be, then as DPII said I cannot see how the problem is with my code-as it doesn't specifically touch these two functions. Also, does it ALWAYS happen, or just on certain era starts and/or certain civic choices? I do want to help to solve this problem, so any info you can give would be appreciated.

Aussie_Lurker.
 
Well, so far when I test a mod (or a mod that I add to my project for that matter) I just run a quick Custom Game. Then what ever it is that I added, I'll just the functionality of it.

In the case with your mods, I would start a Custom Game (set in Modern Times, Dual Map, fastest game speed... just so it loads faster). Then when I go to found my first city... all goes well, until I pick what my city is going to build next. That's when everything listed shows 1 turn to complete.

Same goes with the technologies. It happens no matter what civic options I choose, too. And it does always happen. :(


But I'll check out what the science/hammer output is in the city and get back with you. I really want to nip this in the butt, too.

Where in the XML files should I look for the 500% science/hammers that you put in for testing?
 
Hey Graveatr. I have discovered the cause of the problem, and I am really embarrassed (and not entirely sure how to solve it!).
Essentially Engineers and Mercants produce a ridiculously huge amount of hammers, commerce and science-just as I suspected earlier.
Now, the question which remains is WHY??? I think it might be connected to the code relating to Free Specialist Yields. I will have to look at it and see what I can do.

Aussie_Lurker.
 
Back
Top Bottom