New Domain (Air) For Units?

Flak Fox

Radioactive Vulpine
Joined
Apr 10, 2004
Messages
260
Location
USA
Before anyone gets the wrong idea, I don't want to replace the current air domain in Civ V with the "old school" air style seen in Civ II and I. What I would like to do is create a second "air" domain for helicopter like units.

I find it kind of silly that the helicopter gunship "embarks" into water like any land unit does. I was wondering if anyone has experimented yet with creating a new domain that would essentially function as a hybrid land and sea domain?

The reason I ask, apart from the helicopter issue, is I would like to at some point add a rigid airship unit into the game (perhaps after nabbing the airship from Civ IV) that can hold special reconnaissance aircraft much like some airships did in the 30s and such. I'd like this unit to move like an aircraft carrier, but obviously over water and land.

This does obviously create some issues too that I wouldn't mind discussing, such as, which units already in game should be allowed to attack this new unit type and how would that work?

It's obviously an experimental idea but I think it'd be neat to play with.

Any thoughts?
 
I find it kind of silly that the helicopter gunship "embarks" into water like any land unit does.

How is that silly? Attack helicopters don't have the range to go across oceans, any more than tanks do. They get packed on a transport vessel or aircraft the same as tanks and such, so having them embark is perfectly fine. Sure, the Navy puts helicopters on its ships that have a good amount of range, but it's not the same thing.

The confusing part to me is that in Civ5, Helicopter Gunships have PROMOTION_HOVERING_UNIT which says that it removes some of the "impassible" terrain checks (mountains and coast, I think). If that did what I think it claimed, then the Gunship should have been able to go over a 1-hex water gap without embarking, but I haven't tested that in actual gameplay.
If it doesn't work then it's possible that it's being overridden by something in the source code that explicitly says "if water and you're a land unit then embark", and if that's true, I don't think you COULD declare a new domain since there'd be no way to get at that level of code.

The reason I ask, apart from the helicopter issue, is I would like to at some point add a rigid airship unit into the game (perhaps after nabbing the airship from Civ IV) that can hold special reconnaissance aircraft much like some airships did in the 30s and such. I'd like this unit to move like an aircraft carrier, but obviously over water and land.

That you can do, from what I can tell, and I think you don't need a new domain for it. From what I've seen going through the XML, the "Land" unit domain isn't explicitly tied to land hex types; it has the land types (other than mountain) flagged as "passable" and the others flagged as "impassible". It's a question of promotions; using that "hovering unit" promotion as a baseline, it should be possible to make a "flying_unit" promotion that lets you move over any terrain type.
In my Alpha Centauri mod I actually tried exactly this, making four antigrav units that could travel over any terrain (including oceans) at 1 MP per hex, and the highest-tech one was a carrier for fighters. But due to some technical issues I haven't been able to actually test to see if this worked.
 
I managed to get this to work in Civ4, I had airships that were DOMAIN_LAND but could move over sea as well. And it only took XML to get it to work. Unfortunately that mod has been lost in the midst of windows reinstalls.
 
How is that silly? Attack helicopters don't have the range to go across oceans, any more than tanks do. They get packed on a transport vessel or aircraft the same as tanks and such, so having them embark is perfectly fine. Sure, the Navy puts helicopters on its ships that have a good amount of range, but it's not the same thing.

The confusing part to me is that in Civ5, Helicopter Gunships have PROMOTION_HOVERING_UNIT which says that it removes some of the "impassible" terrain checks (mountains and coast, I think). If that did what I think it claimed, then the Gunship should have been able to go over a 1-hex water gap without embarking, but I haven't tested that in actual gameplay.
If it doesn't work then it's possible that it's being overridden by something in the source code that explicitly says "if water and you're a land unit then embark", and if that's true, I don't think you COULD declare a new domain since there'd be no way to get at that level of code.

Well, I think restricting the helicopter to a coastal tile would work just fine--and perhaps allow it to "load" onto a destroyer. It'd be some work and testing in game to get it to work right (testing out loading an explorer onto a galleon unit in my current mod ended up being a bit of a headache and I never did get it to work the way I wanted it to), but I still think a helicopter should be at least able to hover over coastal areas and lakes. It's just silly otherwise.

But I see what you mean about the hovering ability, I might have to give that a looking at and play with it a little bit.

That you can do, from what I can tell, and I think you don't need a new domain for it. From what I've seen going through the XML, the "Land" unit domain isn't explicitly tied to land hex types; it has the land types (other than mountain) flagged as "passable" and the others flagged as "impassible". It's a question of promotions; using that "hovering unit" promotion as a baseline, it should be possible to make a "flying_unit" promotion that lets you move over any terrain type.
In my Alpha Centauri mod I actually tried exactly this, making four antigrav units that could travel over any terrain (including oceans) at 1 MP per hex, and the highest-tech one was a carrier for fighters. But due to some technical issues I haven't been able to actually test to see if this worked.

Alpha Centauri mod, I approve :P But yes, as I said above I will probably try this out, only problem is I still lack a decent airship graphic to try this out on.

I managed to get this to work in Civ4, I had airships that were DOMAIN_LAND but could move over sea as well. And it only took XML to get it to work. Unfortunately that mod has been lost in the midst of windows reinstalls.

That is very unfortunate :(
 
we can't add new domain functionality. you can add new domains, but there's no way to tell what terrain will use it, and there's no way to tell what domain a unit will use
 
we can't add new domain functionality. you can add new domains, but there's no way to tell what terrain will use it, and there's no way to tell what domain a unit will use

Thanks for that bit of input. It seems the way around it would be via promotions and some experimenting :)
 
good point on promotions, that can maybe get somewhere. btw, you can tell what domain a unit will use, so its really just terrains (the most important). i wanted to get a new tile genre 'straights' that would of been treated the same by naval/land, to help the AI move off islands, which is when i saw it cant be done
 
good point on promotions, that can maybe get somewhere. btw, you can tell what domain a unit will use, so its really just terrains (the most important). i wanted to get a new tile genre 'straights' that would of been treated the same by naval/land, to help the AI move off islands, which is when i saw it cant be done

Yeah, that is quite unfortunate. Hopefully some of these issues can be addressed in future patches.
 
but I still think a helicopter should be at least able to hover over coastal areas and lakes. It's just silly otherwise.

Well, what I was saying was that with the way that "hovering unit" promotion's XML is worded, I think they're already supposed to be able to do exactly that. It'd add a nice dimension to the tactical game, for helicopters to be able to attack coastal cities from the water side or attack mountainside cities from over the mountains; I wanted to give that same ability to all of my grav units (with only the later ones able to cross oceans as well), so I have a vested interest in this working.

If that isn't working, then it's a bigger problem than just the helicopters. It's one thing for the developers to add unused XML stubs for later use, it's another when the existing schema don't do what they claim to. Not that this is the first instance of that in Civ5, of course, but it's still disappointing to see.

Alpha Centauri mod, I approve :P

For all of the people who approve and/or are interested in providing feedback, please read and comment in this thread (which is in this same forum, so it's not hard to find.) I'll warn you before you go to that thread though, what I've been building is NOT an attempt at a total conversion that stays true to the SMAC concepts. It's not even as close to the original SMAC design as the famous "Planetfall" mod for Civ4.
Instead, it's an extensive future-era mod (45 or 46 new techs) that uses the tech names, buildings, wonders, and a few of the units from SMAC to add more gameplay onto the end of the existing tech tree, meaning you're using it on Earth, with cities that have all of the core game's buildings and such already in place. This isn't everyone's cup of tea, I know, but it's something I'd wanted to do since back in Civ4. (I'd had in nearly working back then, then BTS came out and it all broke.)

Of course, Firaxis might announce tomorrow that the first expansion for Civ5 will be Alpha Centauri, sort of how Civ4 had Colonization at the end. If that happened, I'd be ecstatic.
 
I've been trying to do the exact same thing. Let me summarize what I've found out so far.

You can make an air unit move like a normal unit by changing its Immobile column from false to true. That's an easy fix.

Any unit with DOMAIN_AIR that ends its turn outside of a city is automatically teleported back to a city at the beginning of the next turn. They also ignore any movement points, you can move them out however far you can see, then back any number of tiles, but only twice. Very weird. But they appear to be able to fly over any terrain this way. So that's not very helpful in the end. :(
(My untested guess is that it can actually move within its Range--but I didn't have enough exposed in my map--and twice because it has two movement points by default even though I specified that I wanted it to be able to move 5 spaces.)

Since that failed, I've tried to mod from the direction of the helicopter gunship instead of from the direction of the air units. There are a few promotions I've combined into a new one, PROMOTION_FLYING_UNIT, that looks like this:

Spoiler :
Code:
<UnitPromotions>[INDENT]<Row>
[INDENT]<Type>PROMOTION_FLYING_UNIT</Type>
<Description>TXT_KEY_PROMOTION_FLYING_UNIT</Description>
<!-- update this after testing -->
<Help>TXT_KEY_PROMOTION_HOVERING_UNIT_HELP</Help>
<!-- update above after testing -->
<Sound>AS2D_IF_LEVELUP</Sound>
[B]<CanMoveAllTerrain>true</CanMoveAllTerrain>
<CanMoveImpassable>true</CanMoveImpassable>
<IgnoreTerrainCost>true</IgnoreTerrainCost>[/B]
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HOVERING_UNIT</PediaEntry>[/INDENT]</Row>[/INDENT]
</UnitPromotions>
It can fly over mountains and does not end its turn after crossing rivers, but still can't actually move out over the water. I was hoping the CanMoveAllTerrain option would allow it to move over, you know, all terrain, but it doesn't appear to work. I'm kind of baffled by that.

I also tried DOMAIN_SEA, but forgot that then you wouldn't be able to build the unit in any inland city. Bummer. :cringe:

Next thing is that I can't determine that there's a difference between WHEELED and BOAT for the MoveRate column. I didn't verify that AIR_REBASE would prevent it from moving normally, because I haven't seen this column play any role in how the unit moves around on the map.

Notice, though, that any air unit that moves like this won't have any direct-combat or ranged-combat animations, so, without providing animations, this is a defense-only option unless you can somehow enable missions to be within a Range of some number of spaces while simultaneously allowing it to move missionless (like calvary).

Incidentally, you can attach the following to an air unit to make it carry cargo. You just need to know what Special tag was assigned to the units you want it to carry. The following enables the unit to carry fighters, jet fighters, bombers, stealth bombers, and atomic bombs. You also need to give it a cargo promotion (like PROMOTION_CARGO_I).
<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>

So, how has your progress come along?

Thanks for reading,


JeffRockson
 
Next thing is that I can't determine that there's a difference between WHEELED and BOAT for the MoveRate column. I didn't verify that AIR_REBASE would prevent it from moving normally, because I haven't seen this column play any role in how the unit moves around on the map.

So I compared movement between two modified air units: one with MoveRate WHEELED and one with MoveRate AIR_REBASE. I found no difference between them. They behaved exactly the same way. Maybe I don't know what to look for, but that column seems unused. :confused:

Thanks for reading,


JeffRockson
 
I would also love to see a helicopter that can move over ocean and stationable on ships.

The problem I think, is really how they handle air units in this game. You can't even have an aircraft attack an enemy position and land at another airstrip on it's way back. I don''t understand why they didn't just use the Civ Rev air unit system in this case. The air unit has to land after X turns or it dies. Simple.

As such, I think the best route we can make without source code would be to make helicopters air units. They perform air strikes, and they automatically return to a ship or base for refueling after the mission is over.

Of course, for helicopters to be fully functional, they need forward deployed resupply points. AKA airfield improvements(Really Firaxis, where are they?).

Helicopters don't just hover all day long, they have to refuel every few hours so they aren't quite suited as land units aside from the lack of forward air resupply... They should be able to attack multiple times in a turn though, in their 4-6 hex strike range.


If someone can figure out a better system than that before source code is released, I will quite happily implement it though. :)
 
I find it kind of silly that the helicopter gunship "embarks" into water like any land unit does. I was wondering if anyone has experimented yet with creating a new domain that would essentially function as a hybrid land and sea domain?

The reason I ask, apart from the helicopter issue, is I would like to at some point add a rigid airship unit into the game (perhaps after nabbing the airship from Civ IV) that can hold special reconnaissance aircraft much like some airships did in the 30s and such. I'd like this unit to move like an aircraft carrier, but obviously over water and land.

This is not a RTS game IMO, im makign a Heli Mod. The reason of this is because in each turn pass many years, and like airplanes, they can't stay in air for years... maybe the helicopters would by in airdomain to...
 
I know it's been a long time since this was posted but in reference to what Acehart posted I think I have this handled based on this work above.

There are a few promotions I've combined into a new one, PROMOTION_FLYING_UNIT, that looks like this:

Spoiler :
Code:
<UnitPromotions>[INDENT]<Row>
[INDENT]<Type>PROMOTION_FLYING_UNIT</Type>
<Description>TXT_KEY_PROMOTION_FLYING_UNIT</Description>
<!-- update this after testing -->
<Help>TXT_KEY_PROMOTION_HOVERING_UNIT_HELP</Help>
<!-- update above after testing -->
<Sound>AS2D_IF_LEVELUP</Sound>
[B]<CanMoveAllTerrain>true</CanMoveAllTerrain>
<CanMoveImpassable>true</CanMoveImpassable>
<IgnoreTerrainCost>true</IgnoreTerrainCost>[/B]
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HOVERING_UNIT</PediaEntry>[/INDENT]</Row>[/INDENT]
</UnitPromotions>
It can fly over mountains and does not end its turn after crossing rivers, but still can't actually move out over the water. I was hoping the CanMoveAllTerrain option would allow it to move over, you know, all terrain, but it doesn't appear to work. I'm kind of baffled by that

This way of looking at the situation got me thinking about linking other promotions to get the job done and well I think it worked.

Spoiler :
Code:
	<!--Entries below this are intrinsic special Unit abilities, and never awarded for gaining XP/levels-->
		<Row>
			<Type>PROMOTION_FLYING_UNIT</Type>
			<Description>TXT_KEY_PROMOTION_FLYING_UNIT</Description>
			<!-- update this after testing -->
			<Help>TXT_KEY_PROMOTION_HOVERING_UNIT_HELP</Help>
			<!-- update above after testing -->
			<Sound>AS2D_IF_LEVELUP</Sound>
			<CanMoveAllTerrain>true</CanMoveAllTerrain>
			<CanMoveImpassable>true</CanMoveImpassable>
			<IgnoreTerrainCost>true</IgnoreTerrainCost>
			<AllowsEmbarkation>false</AllowsEmbarkation>
			<EmbarkedAllWater>true</EmbarkedAllWater>
			<PortraitIndex>58</PortraitIndex>
			<IconAtlas>ABILITY_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTES</PediaType>
			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HOVERING_UNIT</PediaEntry>
		</Row>

As you can see I added these fields in with the others:
<AllowsEmbarkation>false</AllowsEmbarkation>
<EmbarkedAllWater>true</EmbarkedAllWater>​

Leaving Allows Embarkation set to true did what you would expect. As soon as I hit the water I turned into a little boat and my units turn ended. When I switched it to false however it worked like a charm.

You might be thinking "why not just take it out all together then" and that might work, I honestly didn't try it without it. I figured setting it to false would be a safer way to ensure the unit just didn't trigger the embarktion animations.
 
The new domain already exists (in G&K/BNW) - it's called DOMAIN_HOVER. I managed to create flying units in my fantasy mod using this domain and similar promotions as the airships get in the Smoky Skies scenario.
 
Didn't know about that. So that domain handles all that stuff, going over mountains, deep ocean ect.? I'll be checking that out. You mention flying units? I was curious, do you know of a way to alter the position of a unit? As if to make it appear like it's actually hovering above ground? Flying units that look like they're walking around on the ground bother me.
 
It doesn't handle all the stuff, the units need special promotions to work properly. See the airships in Smoky Skies - basically you need CanMoveAllTerrain and FlatMovementCost. I combined these two in one promotion, and added some other effects - NoDefensiveBonus, NoCapture, Amphib and River (as it doesn't make sense to have penalties for attacking from the sea or across a river for a flying unit). Also I think the combat type used for these units shouldn't have the embarkation promotion allowed in UnitPromotions_UnitCombats. Note that these units can be attacked by ground or naval units in melee.

When browsing the DLL source code I noticed that DOMAIN_HOVER is handled in an interesting way - it works like land when the unit is on land, and like sea when the unit is on sea - see this function:

Code:
DomainTypes CvUnit::getDomainType() const
{
	VALIDATE_OBJECT
	DomainTypes eDomain = (DomainTypes) m_pUnitInfo->GetDomainType();
	// antonjs: Added for Smoky Skies Scenario. If unit is DOMAIN_HOVER, dynamically determine its domain by the type of terrain it is over
	if (eDomain == DOMAIN_HOVER)
	{
		CvPlot* pPlot = plot();
		CvAssertMsg(pPlot, "pPlot is unexpectedly NULL. Please send Anton your save file and version.");
		if (pPlot)
		{
			if (pPlot->isWater())
			{
				return DOMAIN_SEA;
			}
			else
			{
				return DOMAIN_LAND;
			}
		}
	}
	
	return eDomain;
}

As for the visuals, I just use the available unit graphics - some of the fantasy flying units look like standing on the ground when idle and fly only when moving, while others are floating above ground. I suppose you can make a unit appear higher by using the ZOffset column in ArtDefine_UnitMemberInfos table - this is what's used by the Smoky Skies airships.
 
Hey, PawelS, since we're all here and discussing this (sort of):

Would it be possible to make a worker 'walk on mountains' using this domain set-up? Or would the game simply not accept the additions of the FlatMovementCost and CanMoveAllTerrain to a promotion that is then added to a worker?

And would the worker go *poof* from damage if it spent too many turns on mountain tiles?

Idea is coming from a Civ UA where workers can walk on and add a special improvement to mountain tiles. There are a lot of other issues to deal with, of course, but there'd be no reason to proceed with this UA if it won't be possible to get the worker to walk over mountain tiles without being *poofed* out of the game.
 
@Lee yes it should allow them to walk onto/across mountains, the one shot promotion I posted would work. It would also allow them to move over ocean tiles as well tho. A better option might be to just add the standard hover promotion.

Spoiler :
Code:
		<Row>
			<Type>PROMOTION_HOVERING_UNIT</Type>
			<Description>TXT_KEY_PROMOTION_HOVERING_UNIT</Description>
			<Help>TXT_KEY_PROMOTION_HOVERING_UNIT_HELP</Help>
			<Sound>AS2D_IF_LEVELUP</Sound>
			<CanMoveImpassable>true</CanMoveImpassable>
			<PortraitIndex>58</PortraitIndex>
			<IconAtlas>ABILITY_ATLAS</IconAtlas>
			<PediaType>PEDIA_ATTRIBUTES</PediaType>
			<PediaEntry>TXT_KEY_PEDIA_PROMOTION_HOVERING_UNIT</PediaEntry>
		</Row>
They unfortunately would still take damage at the end of each turn. The answer to that if I'm not mistaken can be found here tho.

http://forums.civfanatics.com/showthread.php?t=492061

The groundwork seems to be laid out I don't know how much tweaking would be involved. Hope this helps.
 
Back
Top Bottom