Quick Modding Questions Thread

See if there is any python stuff under def canBuild(self,argsList): in CvGameUtils
They is a small list there, but roads are not mentioned. Neither is MagTube (planetfall rename).

Spoiler :
PHP:
	def canBuild(self,argsList):
		iX, iY, iBuild, iPlayer = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pPlot = CyMap().plot(iX, iY)
#		iBuildFarm = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_FARM')
#		iBuildCondenser = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_CONDENSER')
		iBuildForest = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_FOREST')
		iBuildHybridForest = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_HYBRID_FOREST')
		iBuildXenofungus = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_XENOFUNGUS')
		iBuildSeaFungus = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_SEA_FUNGUS')
#		iBuildSeaWindmill = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_WINDMILL_SEA')
#		iShelf = gc.getInfoTypeForString('TERRAIN_SHELF')
		iBunker = gc.getInfoTypeForString('UNITCLASS_BUNKER')
		iFungalTower = gc.getInfoTypeForString('UNIT_FUNGAL_TOWER')
		iBuildBunker = CvUtil.findInfoTypeNum(gc.getBuildInfo,gc.getNumBuildInfos(),'BUILD_BUNKER')
		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_ECOLOGY')) != gc.getInfoTypeForString('CIVIC_HYBRID'):
			if (iBuild == iBuildHybridForest):
				return 0
		if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_ECOLOGY')) == gc.getInfoTypeForString('CIVIC_ENCLOSED_BIOSPHERE'):
			if (iBuild == iBuildForest):
				return 0
			if (iBuild == iBuildXenofungus):
				return 0
			if (iBuild == iBuildSeaFungus):
				return 0
... 
		return -1	# Returning -1 means ignore; 0 means Build cannot be performed; 1 or greater means it can

 
Based on what is in your canBuild, you appear to be using the Planetfall mod as your base.

In that mod there are some new tags in the terrain info including bRocky. In the Planetfall DLL, if the terrain is flagged as rocky via that tag you can't build a route on it as per CvPlot.cpp in CvPlot::canBuild. That is not the only thing that can stop you from building a route, but it is a good candidate:
Code:
	eRoute = ((RouteTypes)(GC.getBuildInfo(eBuild).getRoute()));

	if (eRoute != NO_ROUTE)
	{
		if (getRouteType() != NO_ROUTE)
		{
			if (GC.getRouteInfo(getRouteType()).getValue() >= GC.getRouteInfo(eRoute).getValue())
			{
				return false;
			}
		}

		// ************************
		// Added for Planetfall
		// ************************

		if (isPeak())
		{
			/*if (eImprovement != NO_IMPROVEMENT)
			{
				if (GC.getImprovementInfo(eImprovement).isActsAsCity())
				{
				}
				else
				{
					return false;
				}
			}
			else
			{*/
				return false;
			//}
		}
		[B]if (getTerrainType() != NO_TERRAIN && GC.getTerrainInfo(getTerrainType()).isRocky())
		{
			return false;
		}[/B]
		if (getFeatureType() != NO_FEATURE && GC.getFeatureInfo(getFeatureType()).getFloweringCounter100() > 0)
		{
			return false;
		}

		// ************************
		// End Added For Planetfall
		// ************************
 
I mean that, I've added the Alpha Channel, and the the spots that should be see-through have gray in them

what programs did you use.
Did you save as dds1 (try dds3 coz iirc it will always save alpha channel)
I also recommend using photoshop/DXTbmp as I had some problems with Gimp making strange colors when importing/exporting to editor.

Can you upload the dds?
 
Thanks for the help so far. Removed that code section, figured out how to build the DLL, but still missing something.

I've fixed the annoying graphics for Mag Tube, and a couple more issues. I can tell I want to play more, but after my last time I want Mag Tube to be more available. If I can figure this out, I know I'll got quite a few hours of out Planet fall.
 
Oh Modding Lords, I humbly seek the answer to a map generation question.

I would like to play the Hemispheres map without the arctic land always running into the poles. Like if there would be no land north of the purple line in the attached image. How do I change the map script to accomplish this?
 

Attachments

  • ice caps.jpg
    ice caps.jpg
    72.4 KB · Views: 55
Oh Modding Lords, I humbly seek the answer to a map generation question.

I would like to play the Hemispheres map without the arctic land always running into the poles. Like if there would be no land north of the purple line in the attached image. How do I change the map script to accomplish this?

I haven't tried it, but it might be enough to just add some lines to the end of the map script file (Hemispheres.py) to adjust the range of the globe that the map covers. It would look something like this:
Code:
def getTopLatitude():
	"Default is 90. 75 is past the Arctic Circle"
	return 85

def getBottomLatitude():
	"Default is -90. -75 is past the Antarctic Circle"
	return -85
Pick your return values as desired, my example sets both top and bottom to be 5 degrees lower than the default full globe which ought have the ice zones not start until a couple plots closer to the edge.
 
I haven't tried it, but it might be enough to just add some lines to the end of the map script file (Hemispheres.py) to adjust the range of the globe that the map covers. It would look something like this:
Code:
def getTopLatitude():
	"Default is 90. 75 is past the Arctic Circle"
	return 85

def getBottomLatitude():
	"Default is -90. -75 is past the Antarctic Circle"
	return -85
Pick your return values as desired, my example sets both top and bottom to be 5 degrees lower than the default full globe which ought have the ice zones not start until a couple plots closer to the edge.

Well I tried adding the code to Hemispheres.py and it had no effect. Changed around the return values to 75, -75 and 25, -25 and still didn't get anything different. Much appreciated so thanks for trying but it must be something else. Any other ideas?

Also, in the image there I'm using Hemispheres with low water levels and snaky continents, don't know if that makes a difference.
 
Well then it isn't using a generator that calls those...

I took a quick look at the generator it is using (in CvMapGeneratorUtil.py) and it can take some named parameters when being initialized,
so try changing line 510 from this:
Code:
	terraingen = TerrainGenerator()
to something like this:
Code:
	terraingen = TerrainGenerator(fSnowLatitude=0.8,fTundraLatitude=0.65)
This could do something along the lines of what you want. The default value for fSnowLatitude is 0.7 and for fTundraLatitude it is 0.6 (where 1.0 is the edge of the map).

I even tried it, and it did shift the ice a bit north. Setting snow to 0.85 and tundra to 0.7 even more so, but it still has some of the land ice terrain (with this 0.85 it was extending down about half as far). Based on where you drew your line, this even larger adjustment might be what you want, at least for the snow setting.
 
Where i can found Membership civic (from FFH2 ) as mod component
or something similar? Does anyone know?

Here is the picture?
 

Attachments

  • ffh2member.JPG
    ffh2member.JPG
    22.1 KB · Views: 50
A long time ago I was planning and making a RFC South and Southeast Asia mod which kinda did go to pot. So I decided to completely reboot it and start over with this base mod.
Can somebody give all things that I need and I need to learn to edit the DLL/SDK?
Also what is the difference between SDK and DLL?
Also what is the first thing that I should do to get this RFC project started?
Thanks!
 
Can somebody give all things that I need and I need to learn to edit the DLL/SDK?
Look at Asaf's A simple guide to compiling the DLL.
Everything you need is mentioned in there. It includes:

the right compiler and libraries (free from Microsoft)

the development environment (MS Visual C++ Express Edition, also free from Microsoft - note that this has its own more modern compiler but you do not use it, you have to call the other one so that the result is compatible with the Civ .exe file)

a makefile (used to control the compiling of the source code via the extra compiler, you can get one via the thread but the source code for the mod you are starting with will probably already include one)

the source code (BtS comes with its source code, but you need the source code for the mod you are basing your mod on and it will also save a bit of time if it comes with its own project file which is used by Visual C++ to remember settings and what files are part of the project - it will probably already be set up to use a makefile which is probably also already included to do the build)

it may also be helpful to have a program that can compare files, like WinMerge

and last, but not least, you need to have some knowledge of the C++ language.

Also what is the difference between SDK and DLL?
The way the terms are used around here, not much. You use the SDK to build the DLL, specifically the CvGameCoreDLL.dll file used by the game.

Also what is the first thing that I should do to get this RFC project started?
Thanks!
Decide most of what you are going to do. Really. At least in broad terms. (It can change later, but you need to start somewhere.)
What is going to be different?
You need to know this in order to determine how the changes are going to be done. What will be done via DLL modifications? What will be done via Python? What is just XML changes, deletions, and additions? Go through each thing you (currently) want to change and see how it is done in the base mod. Then, I'd start the "implementing of stuff on the list" with something relatively easy. Build up to the more complex stuff. Note that something you thought would be easy might turn out to not be so easy. That's life.

As for what to do first with regard to DLL modding, the first thing is to build a plain old unmodified BtS DLL and make sure it works (do it in its own folder, not the one you'll be using for your mod). Doing this requires you to do the basic setup of everything, so you can see how it is done in the easiest case. Then build an unmodified DLL for the mod you are starting from and make sure that works. You can do this in the folder you are using for your mod; it will serve as the base for what you are doing. Note that it is probably a bit easier to do your DLL building in a folder outside the Civ folder structure, which you may appreciate once you are ready to produce an installation for other people (you don't ship all of the object files and libraries and other junk that you end up with in your build folder and sub-folders - they take up a lot of space and are useless to most other people). Once you can do both of those things, have at it...
 
how do you add permanent alliances in A .WBS file?When I attempted to add teams it said you have been defeated when I added china us and russia to team=0.
 
how do you add permanent alliances in A .WBS file?When I attempted to add teams it said you have been defeated when I added china us and russia to team=0.

First, in the BeginGame section: Option=GAMEOPTION_PERMANENT_ALLIANCES

Then in the BeginPlayer section you can put for several Players: Team=0.

Note: for each additional player assigned to a Team, one other Team must remain without Player. In other words, for a normal 18Civs dll, you have 18 Teams defined in the WBS even if 18 Players are part of 17, 16, etc teams. Effectively, you will have 17, 16, etc teams in your game.
 
Can i add new FLAVOR type in game?

You have to define them in GlobalTypes.xml.

They are also defined in the dll (CvEnums.h) as they are used in formulas for the AI to better choose productions/research Techs.

However, I think that you don't necessarily need to define them in the dll.
 
You have to define them in GlobalTypes.xml.

They are also defined in the dll (CvEnums.h) as they are used in formulas for the AI to better choose productions/research Techs.

However, I think that you don't necessarily need to define them in the dll.

Dll, i am successfully make one before some weeks, and its work (that was just some test). For example if i am merged something before FLAVORS, i must compile my source files again with this new changes?

But in CvEnums.h i just found this:
PHP:
enum FlavorTypes						// Exposed to Python
{
	NO_FLAVOR = -1
};
this is about 693-696 lines.

Where is other FLAVORS? FLAVOR_MILITARY, ECONOMY etc..

And what do this NO_FLAVOR?

And this comment // Exposed to Python what mean this?
 
Zlatko, you're right, I took it from K-Mod:

Spoiler :
PHP:
enum FlavorTypes						// Exposed to Python
{
	NO_FLAVOR = -1,
	// K-Mod. These are the current flavors defined in GlobalTypes.xml
	FLAVOR_MILITARY,
	FLAVOR_RELIGION,
	FLAVOR_PRODUCTION,
	FLAVOR_GOLD,
	FLAVOR_SCIENCE,
	FLAVOR_CULTURE,
	FLAVOR_GROWTH,
	// K-Mod end
};

But as I said, it's not mandatory.

NO_FLAVOR: act as a default?

Exposed to Python: sorry, but I can't really answer you.
 
Back
Top Bottom