Detecting Amphibious Units

Detecting Amphibious Units

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
submarine
AI Developer
Posts: 834
Joined: 31 Jan 2005, 20:04

Detecting Amphibious Units

Post by submarine »

To figure out which ground units are amphibious AAI checks their maxwaterdepth. Until now I thought amphib ground units have a maxwaterdepth of 255. However I noticed that the Commanders in BA (using BA 6.41 atm) have a maxwaterdepth value of 35

Though there is a amphibious=1; statement in the ARMCOM.fbi, I failed to figure out what the corresponding variable in spring is called. Has this statement become obsolete? If yes, why are the Commanders amphibious?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Detecting Amphibious Units

Post by Kloot »

The amphibious tag has never been read by the engine, it simply
checks if maxWaterDepth is > 0 (combined with waterline, etc) to
determine amphibiousness. (maxWaterDepth 50 means "this unit
can live in any water that is at most 50 elmos deep")
Reth
AI Developer
Posts: 70
Joined: 15 Aug 2006, 14:05

Re: Detecting Amphibious Units

Post by Reth »

for mobile units unitdef->movedata should have a non-zero value, the unitdef->movedata->depth field seems to be more accurate than unitdef->maxWaterDepth
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Detecting Amphibious Units

Post by Evil4Zerggin »

IIRC unitDef->maxWaterDepth determines where a unit can be built (e.g. by engineers), and unitDef->movedata->depth determines where the unit can actually move. Same for minWaterDepth and maxSlope.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Detecting Amphibious Units

Post by AF »

There's a large class in NTai full of checks on the unitdef structure such as this. Including amphibious units floating units, underwater structures, submarines, and floating structures.
Post Reply

Return to “Engine”