SDK Community enhancement project

The Great Apple said:
IMO it should auto-wrap for both x and y co-ords. It's on my to-do list, but won't be done until I get home. If you want to fix it then be my guest.
'Scuse my mistakes. I was asking to see if this was something we want to insert into the community project, or whether it would incourage rampant laziness (or break functions that rely on returning -1, -1 -- don't see how that would be the case, but who knows).
 
If you're still accepting testers, please count me in. I'de like to see what you guys have done so far and see how everything works now :)
 
Padmewan said:
'Scuse my mistakes. I was asking to see if this was something we want to insert into the community project, or whether it would incourage rampant laziness (or break functions that rely on returning -1, -1 -- don't see how that would be the case, but who knows).
I wasn't getting at you - just stating facts :) I don't think it would encourage rampant laziness personally. Most of the times you get it you're scanning plots arount an area - it's very easy to forget X-Y wrapping.

EDIT: Just realised it might not have been clear that I was completely agreeing with the point you made.
 
If this has been brought up, brought up/discussed, or is simply silly please disregard. :D I asked TheLopez about coding this feature, but he suggested I bring it here. Enough preamble...

Right now we have aggressive or non-aggressive AI in the Custom Game setup. Can it be coded to give at least the 5 options that CivII had or maybe even 10 (or more)? I would think if you simply added (or subtracted) some numbers from the values in the Leaderhead XML file you could lessen or increase AI aggressiveness. Possible? Anyone willing to code it up?
 
The Great Apple said:
If anybody wants to help test, then check out the first post in this thread about joining the group.

What would the testing involve?
(Just wondering as I thought this was more a "metamod" than a mod)
 
We need people who are modders to make sure that the modding features we have implemented are easy to use, and work well, as well as people to try the new gamplay options we are implementing to make sure that they are working correctly.
 
Any update on this, was looking forward to what this had to offer, I hear the release is soon....
 
At the moment we're having a few issues with crashes. There was some confusion early on when we were merging the work that had been done so far, and something odd happened.

When it is fixed depends on how quickly we can find what is causing it.

Sorry for the delay!
 
Opps Double Post
 
I encountered a difficulty in my mod, and whereas Kael couldn't help me, he told me you may want to do something about into your "super-sdk mod"

I wanted a modification in CIV4ReligionInfo.xml to allow me to give negative value of commerce (gold/science or culture) in cities with religion X but either no state religion, either state religion Y.
I've done the following modification :
Code:
             <ReligionInfo>
			<Type>RELIGION_X</Type>
			...
			<GlobalReligionCommerces>
				<iGlobalReligionCommerce>[B]-1[/B]</iGlobalReligionCommerce> 
               			<iGlobalReligionCommerce>0</iGlobalReligionCommerce>
				<iGlobalReligionCommerce>0</iGlobalReligionCommerce>
			</GlobalReligionCommerces>
			...
			<StateReligionCommerces>
				<iStateReligionCommerce>0</iStateReligionCommerce>
				<iStateReligionCommerce>0</iStateReligionCommerce>
				<iStateReligionCommerce>1</iStateReligionCommerce>
			</StateReligionCommerces>
			...
		</ReligionInfo>

but it doesn't work.
the <iStateReligionCommerce> seems to work only if no state religion for player, or if religion X is state religion
the <iGlobalReligionCommerce> does not seems to modify anything in the game.
Furthermore, negative values don't seems to be accepted in <iGlobalReligionCommerce> modifier.

Kael found me the following code explaining the trick :
Kael said:
Code:
int CvCity::getReligionCommerceByReligion(CommerceTypes eIndex, ReligionTypes eReligion)
{
	int iCommerce;

	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_COMMERCE_TYPES, "eIndex expected to be < NUM_COMMERCE_TYPES");
	FAssertMsg(eReligion >= 0, "eReligion expected to be >= 0");
	FAssertMsg(eReligion < GC.getNumReligionInfos(), "GC.getNumReligionInfos expected to be >= 0");

	iCommerce = 0;

	if ((GET_PLAYER(getOwnerINLINE()).getStateReligion() == eReligion) || (GET_PLAYER(getOwnerINLINE()).getStateReligion() == NO_RELIGION))
	{
		if (isHasReligion(eReligion))
		{
			iCommerce += GC.getReligionInfo(eReligion).getStateReligionCommerce(eIndex);

			if (isHolyCity(eReligion))
			{
				iCommerce += GC.getReligionInfo(eReligion).getHolyCityCommerce(eIndex);
			}
		}
	}

	return iCommerce;
}

If I am reading this right it looks like the commerce result is only applied if the player has no state religion (then whatever commerce if given by the religions in the city are applied) or if the religion is the state religion.

I also see a lot of the following in the SDK:


Code:
	if (getReligionCommerce(eIndex) != iNewReligionCommerce)
	{
		m_aiReligionCommerce[eIndex] = iNewReligionCommerce;
		FAssert(getReligionCommerce(eIndex) >= 0);

		updateCommerce(eIndex);
	}

Which makes me think that the only values it may accept are 0 or higher (I had the same problems with buildings in FfH that weren't giving negative iCommerce values but I reported it to Firaxis with a code fix and they were good enough to check it into 1.61).
IMO, two way are possible :
modifying so that negative number are accepted in <iGlobalReligionCommerce>
AND allowing <iGlobalReligionCommerce> to be used for any non-state religion X (if <iGlobalReligionCommerce> is used somewhere else I hadn't found, it might not be a good idea)

or creating a <iCityReligionCommerce> ?? function allowing the same trick
as vanilla civ has no <iCityReligionCommerce> values, it shall not change the vanilla civ game, but may improve modability

As I do not know how to modify SDK, I leave you with the idea, and if you find smarter ways, it will even be better

---
so the real question is : "could you allow negative iCommerce values for religions?"
 
GlobalReligionCommerce apears to be the method used to control the affect of Shrines, it seems that the Shrines could be made to give something other then 1 gold per city with that religion, it could be 2 gold or 1 science or anything else.

PHP:
			if (GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce() != NO_RELIGION)
			{
				iCommerce += (GC.getReligionInfo((ReligionTypes)(GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce())).getGlobalReligionCommerce(eIndex) * GC.getGameINLINE().countReligionLevels((ReligionTypes)(GC.getBuildingInfo(eBuilding).getGlobalReligionCommerce())));
			}

Just to clarify your looking for a tag that would add commerce (and allow a negative value) to a City regardless of what the state religion is.
 
exactly :)

I'm looking for a xml tag linked to religion that would add commerce to cities, regardless of state religion, and without using buildings as triggers.

thx for your reply.
 
To the issue Calavente raised about negative global commerce...

I'm pretty sure you are misreading the SDK code. eIndex here is not the value, but the type of the commerce (gold=0, beaker=1, culture=2). I looked over the section of CvCity.cpp that you quote and I can't see anywhere that a negative value would be discarded.

How are you testing to see if the negative value comes through? I am very interested, as my mod relies on some negative values there too and I have naively been assuming it just works.

With regard to the other issue of CvCity::getReligionCommerceByReligion only dealing with state religion or no religion, there is another function that cycles through all religions and calls this function for each one...

void CvCity::updateReligionCommerce(CommerceTypes eIndex)
{
int iNewReligionCommerce;
int iI;

iNewReligionCommerce = 0;

for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
iNewReligionCommerce += getReligionCommerceByReligion(eIndex, ((ReligionTypes)iI));
}

if (getReligionCommerce(eIndex) != iNewReligionCommerce)
{
m_aiReligionCommerce[eIndex] = iNewReligionCommerce;
FAssert(getReligionCommerce(eIndex) >= 0);

updateCommerce(eIndex);
}
}

Regards,
Eusebius
 
I have some ideas I wanted to use on a mod (maybe) and I wanted to know if you already had any thought about it :

allow bollean tags for requirement; especially the AND /OR/NOT :
those applyable to
ex :
this - civics / technology / buildings / units- A
needs this - civics / technology / building / ressource /religion in city / state religion- X
AND this - civics / technology / building / ressource /religion in city / state religion- Y
OR this - civics / technology / building / ressource /religion in city / state religion- Z
but CANNOT be made if you already have this - civics / technology / building / ressource /religion in city / state religion-

it would be interesting to make a technology available to resaerch only if you have a given ressource (why researche horseback riding when you don't have any horses available, you won't even think about using it..) or make that an unit can be build if you have this techno or that building that come earlier/in another tech path.

other exemples
if you have elephant training groung you cannot have horses training grounds..
to have this oecumenic building you need this religion X and that religion Y

...Etc

some of those boolean already exists for some cases : units needing multiple OR ressources, tech needing multiple AND and OR techs..
but most of those tags do not exist I think..

If you already have them or if you can devellop them, I think it would be interesting for modding, especially for modding exclusive tech paths or speciallising cities.

thanks a lot
 
Calavente said:
I have some ideas I wanted to use on a mod (maybe) and I wanted to know if you already had any thought about it :

allow bollean tags for requirement; especially the AND /OR/NOT :
those applyable to
ex :
this - civics / technology / buildings / units- A
needs this - civics / technology / building / ressource /religion in city / state religion- X
AND this - civics / technology / building / ressource /religion in city / state religion- Y
OR this - civics / technology / building / ressource /religion in city / state religion- Z
but CANNOT be made if you already have this - civics / technology / building / ressource /religion in city / state religion-

it would be interesting to make a technology available to resaerch only if you have a given ressource (why researche horseback riding when you don't have any horses available, you won't even think about using it..) or make that an unit can be build if you have this techno or that building that come earlier/in another tech path.

other exemples
if you have elephant training groung you cannot have horses training grounds..
to have this oecumenic building you need this religion X and that religion Y

...Etc

some of those boolean already exists for some cases : units needing multiple OR ressources, tech needing multiple AND and OR techs..
but most of those tags do not exist I think..

If you already have them or if you can devellop them, I think it would be interesting for modding, especially for modding exclusive tech paths or speciallising cities.

thanks a lot

While it might be a neat idea to allowing this in XML, I wonder if as a less SDK-intensive solution you might be able to place your restrictions into the canResearch and cannotResearch function in CvGameUtils.
 
Top Bottom