New Types of Terrain?

drjest2000

Prince
Joined
Dec 8, 2001
Messages
332
Location
retired
I have added a VOLCANIC SOIL type for East Indies and Pacific Islands, and I want only "Jungle" and the "TreeLeafy" variety to appear on it. I had not thought about this until I was testing the new terrain in game and snowy pines grew on it, even though it was in an equatorial position on the map and situated on the coast.

I've also added some others that are more or less cosmetic at this point since I haven't graduated to adding new resources to the DLL.

attachment.php


I'm making no claim to have created the textures I'm using. I stole them without regret from mods for Civ4 and Civ4Col. I'm working toward making a "lava river" with a steam/smoke effect where it ends in water. I figure that will add some atmospheric detail for a south sea island scenario.

So back to the tree thing. When adding new types of terrain, is there a way to determine which variety of forest appears on the new terrain?
 

Attachments

  • NewTerrain_NewFeatures.png
    NewTerrain_NewFeatures.png
    157.1 KB · Views: 970
So back to the tree thing. When adding new types of terrain, is there a way to determine which variety of forest appears on the new terrain?
...\Assets\XML\Terrain\CIV4FeatureInfos.xml

Code:
  <FeatureInfo>
   <Type>FEATURE_JUNGLE</Type>
   <Description>TXT_KEY_FEATURE_JUNGLE</Description>
   <Civilopedia>TXT_KEY_FEATURE_JUNGLE_PEDIA</Civilopedia>
   <ArtDefineTag>ART_DEF_FEATURE_JUNGLE</ArtDefineTag>
(...)
   <TerrainBooleans>
    <TerrainBoolean>
     <TerrainType>TERRAIN_MARSH</TerrainType>
     <bTerrain>1</bTerrain>
    </TerrainBoolean>
(...)
 
Thanks, Commander Bello. I should have thought to look there >_<

Does the game differentiate between the cosmetic variety of the TreeLeafy, TreeEvergreen, and TreeSnowy? There seems to be no data in the ArtDef or FeatureInfo for FEATURE_FOREST to indicate which FeatureVariety appears at a given position on the map. I.e., no clear link between TreeSnowy FeatureVariety and TERRAIN_TUNDRA.

Is it perhaps related to the <LayerOrder>?
 
I looked through the Python files. In CvMapGeneratorUtil.py there are references to Jungle, Forest, and Light_Forest, but no clear indication that the FeatureVariety is used.

I looked at the FaireWeather map script and there are routines in it to differentiate between the varieties based on the theoretical climate temperature by position on the map (the script assigns/assumes the top and bottom of the map are near the poles and the center portion is at the equator).

The routine in FaireWeather.py starts at line 3452, with some values set at the beginning of the script at lines 95 and 112

At the head of the script, FaireWeather imports FeatureGenerator from CvMapGeneratorUtil.py, but seems to handle all the FeatureVariety distinctions inside the routine at line 3452. The formula uses the vitual temperature of the map position to determine the variety painted to the map.

The A_New_World map script also imports FeatureGenerator from CvMapGeneratorUtil.py. But there is no routine to differentiate between the FeatureVarieties, which explains the haphazard arrangement of features on the maps generated by A_New_World.

So my conclusion is that a FeatureVariety is randomly applied by the event of spawning a new forest and precise placement is only possible to control during map creation (either manually in WorldBuilder or by a map script with routines to differentiate them).

I think that is rather sloppy work.
 
Continuing on this topic, I am having a devil of a time finding all the instances where the terrain plays a role just in the XML files. So far I've found entries in CIV4ImprovementInfos.xml, CIV4BonusInfos.xml, CIV4FeatureInfos.xml, CIV4GameTextInfos_Objects_Original.xml, and CIV4CivilizationInfos.xml (although the entry for <FavoredTerrain> seems to be unused or ignored by the game)

I continued to be interested in this because I am wanting to make a boat for natives that will not go onto TERRAIN_OCEAN and as far as I have so far seen the game only differentiates between DOMAIN_LAND and DOMAIN_SEA, which I haven't located the def file for as yet. Any ideas?
 
I continued to be interested in this because I am wanting to make a boat for natives that will not go onto TERRAIN_OCEAN and as far as I have so far seen the game only differentiates between DOMAIN_LAND and DOMAIN_SEA, which I haven't located the def file for as yet. Any ideas?

Yep, this is this list of Domains...

NO_DOMAIN
DOMAIN_SEA
DOMAIN_LAND
DOMAIN_IMMOBILE
DOMAIN_AIR

DOMAIN_AIR isn't used so it could be converted but most of the work will have to be done in the DLL. You would set the Native Ship to only DOMAIN_AIR (or add a DOMAIN_COAST) then in the DLL set it up so that Native Ships can only move if the plot is Coastal.

And then you would probably have to set up AI so that when the natives get a ship they actually know what to do with it, such as explore the coasts or transport units to another coastal city.
 
Thanks for the list, Kailric. I wondered if they were the same as in Civ4, and it appears that indeed they are.

Since all units have a <TerrainImpassables/> tag, I figure that using the same method as in Civ4 (e.g.,
Code:
			<TerrainImpassables>
				<TerrainImpassable>
					<TerrainType>TERRAIN_OCEAN</TerrainType>
					<bTerrainImpassable>1</bTerrainImpassable>
				</TerrainImpassable>
			</TerrainImpassables>
would probably work the trick, so no new domain would be needed.

And then you would probably have to set up AI so that when the natives get a ship they actually know what to do with it, such as explore the coasts or transport units to another coastal city.
Yeah, I've given natives a boat before to see what they would do with it, they just run it around the map without purpose. It doesn't make much sense, there's a "gift" button in vanilla whenever your boat or wagon train appears inside a native village. Obviously, they planned on doing something with the natives other than making them developmentally challenged.

Maybe...

I am beginning to understand that nothing can be expected to work as expected in Civ4Col :crazyeye:
 
would probably work the trick, so no new domain would be needed.

Actually making DOMAIN_OCEAN impassable would prevent them from entering all ocean spaces sense there is no DOMAIN_COASTAL.

Oh yeah, the Native ships would just be set to exploring.

In my M:C mod I have been wanting to add in a new feature where early ships have a chance to go missing and then have a chance to be lost at sea if they strayed to far from the Coast. I could add this as a new DOMAIN_COASTAL perhaps and then if the ships venture into DOMAIN_OCEAN it could go missing. But adding in a new Domain type would be a lot of work actually. So, it may be easier to add in tag for "CoastalOnly" and "lostAtSeaChance".

Have you decided on any mod that you are going to base your mod on? I could add this feature to the NorthSoutWest mod then port it to the M:C, at some point :)
 
Have you decided on any mod that you are going to base your mod on? I could add this feature to the NorthSouthWest mod then port it to the M:C, at some point :)

I am leaning toward MedTech, but there are elements of 2071 that I like too. RaR is gorgeous, but too complicated for me to comprehend all the changes with my current understanding.

Basically the things that stand out as needed in the final product:

  • A tech tree that can ultimately be used to allow the natives to "catch up" to or start on the same level as the European player.
  • A black market screen where the player can trade goods when under an embargo by the King, this is more historically accurate than the total shutdown of trade that the vanilla game sets up. There was a thriving black market during colonial times. There are several reputable, sane historians who are of the opinion that Benjamin Franklin was a black market kingpin and this was the true source of his wealth. And the history of Rhode Island is pretty much the history of smuggling in colonial America;
  • The ability for the player to voluntarily abandon a colony without it being an esoteric ordeal;
  • The DLL has to support multiple new resources (i.e., Salt, Coffee, Tea, Spice, Opium, etc.) and a variety of superficial resource variations like clams, wheat, pumpkins, as beans as RESOURCE_FOOD; flax, silk, and hemp as RESOURCE_COTTON; gold, as RESOURCE_SILVER; copper, tin, lead, and zinc as RESOURCE_IRON, etc. Without going crazy or collapsing under the weight of the changes;
  • The ability to handle the addition of four new terrains (i.e., Volcanic Soil, High Desert, Peat Bog, Lava Field) and three new terrain features (Mixed Tree Forest, Savanna Forest, Cactus Scrub) without losing stability;
  • The ability to handle the addition of new units and native civs without suffering catastrophic memory leaks;
  • And (Hear me, O God) the ability to support playable natives with or without access to Europe.

The ideal DLL would be flexible enough to handle a variety of scenarios (e.g., Viking Age, Medieval Rus, East Indies, Golden Age of Piracy, Africa, South Pacific, Australia/New Zealand) - In other words, not be so Amero-centric.

Things I dream about are giving the ships 1 point of experience for every trip to/from Europe, civics, and "learning by doing".

Things I don't want are randomly spawned and roving lions and tigers and bears (oh my), I would prefer to concentrate on the human dangers, rather than waste turns with random animal spawns. Humans have a way of dealing with animal competition, it's usually termed "extinction of a species". So rather than add more complexity in that direction, I want to concentrate on the political threats.

And, finally, the end result should be at least worth the effort of creating it. Which means someone other than me should want to play it.

All that being said, I now confess that because I cannot understand some of the code I've been reading, I am feeling incredible thick right now. So you tell me, what is possible/practical and what is impossible/impractical. If you say it's all crazy talk, I'll listen. I'm just at the point where I am starting to think that I am crazy for trying. :crazyeye:
 
RaR is gorgeous, but too complicated for me to comprehend all the changes with my current understanding.

Well, the amount of changes (and improvements) in RaR is really huge.
(Some of it is really heavy / complicated DLL coding and some core features are extremely deeply woven into lots of different pieces of code.)

But from a player's perspective it is not that complicated to get used to all the new features after a while by simply playing.
(At least that is what our "fans" tell me.)

If you are really interested to adapt a single feature, simply ask about details. :thumbsup:
I could at least try to tell you where to look into or what the interesting code comments are that you need to search.
(But that does only make sense if you are up to DLL programming.)

So you tell me, what is possible/practical and what is impossible/impractical.

The only real limit is your motivation and skills. :thumbsup:
The possibilities in Civ4Col modding are incredible ...

Edit:
It is usually pretty easy to create a feature in terms of a functionality. (Which is what most mod comps do.)
The really tough work starts, when you need to teach that feature to AI without crashing other AI logic. (Which is what you need to do in a real mod.)
 
@Ray - I'm having a bad case of self-doubt after reading through the DLL_Sources of RaR. I don't know that I am up to that level of heavy-coding. And I am beginning to understand that it may will require completely reconstructing the code to achieve playable natives or to even elevate them to the same level of threat as that of an AI player in Civ4.

The parts I can understand, I understand well. The parts that I don't understand... well, they may as well be in Chinese.

I understand the problem of AI logic conflicts. Most of what I see in the vanilla code is not all that balanced. The way specialist units over focus on their specialization even if it means the settlement starves. That is not sane or reasonable as far as I can tell. Food should always have a higher priority that digging silver or picking cotton.

When I see AI players in late game with settlements with population of 2 or 3, it makes me wonder about the "unseen" part of the game code. What precisely are they doing in that settlement?

And the vanilla AI for automated transport is grossly inefficient. I know that others have worked toward fixing that and I don't want to repeat that work.

I guess, it all comes down to the fact that I am three years behind everyone else and it is beginning to leave me feeling like I "missed the boat".
 
I guess, it all comes down to the fact that I am three years behind everyone else and it is beginning to leave me feeling like I "missed the boat".

Well, doc, Civ4Col isn't going anywhere so you have plenty of time to catch up. Modding is a hobby, like building train models or collecting coins. You could start collecting coins today and you would never catch up with some of the greatest collections but does it matter if you are having fun? That's what matters the most. When I first started modding Civ4 a few years back I new nothing about C++ or Python. Today I am still a beginner if even that. But the basics of C++ isn't that hard to figure out just by following examples. There are several tutorials on the Civ4 forums that I used to get me started. I use code:blocks the most and for example- say you want to add a new yield called YIELD_FRENCH_FRIES (its late ok) then first search the entire code for references to a known yield that is similar in function to your french fries like YIELD_COTTON. Then simply use the examples you see with the cotton code and create similar code for your french fries. You can do this for new Commands and such. Anyway, making french fries is fun stuff and so is sleeping so I'm off to bed:crazyeye:.
 
@Kailric:

I fully agree. :)
Modding is really simply a hobby and not a competition.

@drjest2000:

Simply take it easy and go step by step. :thumbsup:
Modding itself can be really fun. It is not necessarily the results that count.

Most of us have started with little knowledge and simply gained experience and improved skills over the years.
Try learning from the examples you find and maybe try to find partners to cooperate with.

It is very unlikely though, that somebody else will create your "perfect mod" for you.
You will probably need to do most of the work by yourself even if you find people that support.

Of course it can be really frustrating sometimes if things get complicated.
But it can really be fulfilling to see your dreams of a game you really like to play come true.

Have fun modding. :)
 
Back
Top Bottom