Page 1 of 2

CruiseAlt not in unitdef.h

Posted: 31 Jul 2009, 22:59
by Caydr
I noticed just now that unitdef.h has no reference to the CruiseAlt tag, which determines the height at which airplanes prefer to fly.

I think it's safe to say that it's used by Spring though, iirc.

It is mentioned in unitdefhandler.cpp, but I've seen people say that if a tag isn't mentioned in unitdef.h, it's ignored.

So what's up? Besides unitdef.h and unitdefhandler.cpp, are there other files I should be checking to verify that a tag is actually read by the engine?

Re: CruiseAlt not in unitdef.h

Posted: 31 Jul 2009, 23:03
by Kloot

Code: Select all

ud.wantedHeight  = udTable.GetFloat("cruiseAlt", 0.0f);
The UnitDef variable names often do not match the names of the tags. That does not mean they (the tags) aren't used.

Re: CruiseAlt not in unitdef.h

Posted: 31 Jul 2009, 23:07
by Argh
CruiseAlt works. Just be aware that aircraft do not obey their Turnrate, but use other factors, which we've discussed at length elsewhere (i.e., use the Search and find it).

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 00:51
by Caydr
Is there a master list somewhere of what tags are obeyed and in what way? There's something like that on the wiki but I really doubt it's kept up-to-date. That kind of user-friendliness would start a riot.

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 01:25
by Argh
Is there a master list somewhere of what tags are obeyed and in what way?
Not really.

However, you can print out a unitDef via Lua and see all the current tags. See the Lua reference on how to go about this.

There aren't very many that aren't documented somewhere, if you have questions about a specific tag, ask.

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 08:21
by Forboding Angel
put maxaccel=0.3; on a fighter. Definately makes TA type planes a lot more interesting to watch/use.

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 19:33
by smoth
Shit works gundam uses it

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 21:05
by Tobi
Caydr wrote:Is there a master list somewhere of what tags are obeyed and in what way? There's something like that on the wiki but I really doubt it's kept up-to-date. That kind of user-friendliness would start a riot.
http://github.com/spring/spring/blob/ma ... andler.cpp

or

(this may of course be slightly inaccurate)
egrep -o 'udTable\.Get[A-Za-z]*\(.*\)' rts/Sim/Units/UnitDefHandler.cpp wrote: udTable.GetString("buildPic", "")
udTable.GetString("name", "")
udTable.GetString("filename", "")
udTable.GetString("description", ud.name)
udTable.GetString("decoyFor", "")
udTable.GetString("gaia", "")
udTable.GetBool("commander", false)
udTable.GetFloat("metalStorage", gameSetup->startMetal)
udTable.GetFloat("energyStorage", gameSetup->startEnergy)
udTable.GetFloat("metalStorage", 0.0f)
udTable.GetFloat("energyStorage", 0.0f)
udTable.GetFloat("extractsMetal", 0.0f)
udTable.GetFloat("windGenerator", 0.0f)
udTable.GetFloat("tidalGenerator", 0.0f)
udTable.GetFloat("metalUse", 0.0f)
udTable.GetFloat("energyUse", 0.0f)
udTable.GetFloat("metalMake", 0.0f)
udTable.GetFloat("makesMetal", 0.0f)
udTable.GetFloat("energyMake", 0.0f)
udTable.GetFloat("maxDamage", 0.0f)
udTable.GetFloat("autoHeal", 0.0f) * (16.0f / GAME_SPEED)
udTable.GetFloat("idleAutoHeal", 10.0f) * (16.0f / GAME_SPEED)
udTable.GetInt("idleTime", 600)
udTable.GetInt("buildAngle", 0)
udTable.GetFloat("buildCostMetal", 0.0f)
udTable.GetFloat("mass", 0.0f)
udTable.GetFloat("buildCostEnergy", 0.0f)
udTable.GetFloat("buildTime", 0.0f)
udTable.GetInt("cobID", -1)
udTable.GetFloat("sightDistance", 0.0f) * modInfo.losMul / (SQUARE_SIZE * (1 << modInfo.losMipLevel))
udTable.GetFloat("airSightDistance", -1.0f)
udTable.GetFloat("sightDistance", 0.0f) * modInfo.airLosMul * 1.5f / (SQUARE_SIZE * (1 << modInfo.airMipLevel))
udTable.GetBool("canSubmerge", false)
udTable.GetBool("canFly", false)
udTable.GetBool("canMove", false)
udTable.GetBool("reclaimable", true)
udTable.GetBool("capturable", true)
udTable.GetBool("repairable", true)
udTable.GetBool("canAttack", true)
udTable.GetBool("canFight", true)
udTable.GetBool("canPatrol", true)
udTable.GetBool("canGuard", true)
udTable.GetBool("canRepeat", true)
udTable.GetBool("builder", true)
udTable.GetBool("canRestore", ud.builder)
udTable.GetBool("canRepair", ud.builder)
udTable.GetBool("canReclaim", ud.builder)
udTable.GetBool("canAssist", ud.builder)
udTable.GetBool("canBeAssisted", true)
udTable.GetBool("canSelfRepair", false)
udTable.GetBool("fullHealthFactory", false)
udTable.GetBool("factoryHeadingTakeoff", true)
udTable.GetBool("upright", false)
udTable.GetBool("collide", true)
udTable.GetBool("onoffable", false)
udTable.GetFloat("maxSlope", 0.0f)
udTable.GetFloat("minWaterDepth", -10e6f)
udTable.GetFloat("maxWaterDepth", +10e6f)
udTable.GetFloat("minCollisionSpeed", 1.0f)
udTable.GetFloat("slideTolerance", 0.0f)
udTable.GetBool("pushResistant", false)
udTable.GetFloat("waterline", 0.0f)
udTable.GetBool("canSelfDestruct", true)
udTable.GetInt("selfDestructCountdown", 5)
udTable.GetFloat("maxVelocity", 0.0f)
udTable.GetFloat("maxReverseVelocity", 0.0f)
udTable.GetFloat("acceleration", 0.5f))
udTable.GetFloat("brakeRate", 3.0f * ud.maxAcc)) * (ud.canfly? 0.1f: 1.0f)
udTable.GetFloat("turnRate", 0.0f)
udTable.GetBool( "turnInPlace", true)
udTable.GetFloat("turnInPlaceDistance", 350.f)
udTable.GetFloat("turnInPlaceSpeedLimit", 15.f)
udTable.GetBool("noAutoFire", false)
udTable.GetBool("canFireControl", !noAutoFire)
udTable.GetInt("fireState", ud.canFireControl ? -1 : 2)
udTable.GetInt("moveState", (ud.canmove && ud.speed>0.0f) ? -1 : 1)
udTable.GetBool("buildRange3D", false)
udTable.GetFloat("buildDistance", 128.0f)
udTable.GetFloat("workerTime", 0.0f)
udTable.GetFloat("repairSpeed", ud.buildSpeed)
udTable.GetFloat("maxRepairSpeed", 1e20f)
udTable.GetFloat("reclaimSpeed", ud.buildSpeed)
udTable.GetFloat("resurrectSpeed", ud.buildSpeed)
udTable.GetFloat("captureSpeed", ud.buildSpeed)
udTable.GetFloat("terraformSpeed", ud.buildSpeed)
udTable.GetInt("flankingBonusMode", modInfo.flankingBonusModeDefault)
udTable.GetFloat("flankingBonusMax", 1.9f)
udTable.GetFloat("flankingBonusMin", 0.9)
udTable.GetFloat("flankingBonusMobilityAdd", 0.01f)
udTable.GetFloat("damageModifier", 1.0f)
udTable.GetInt("radarDistance", 0)
udTable.GetInt("sonarDistance", 0)
udTable.GetInt("radarDistanceJam", 0)
udTable.GetInt("sonarDistanceJam", 0)
udTable.GetBool("stealth", false)
udTable.GetBool("sonarStealth", false)
udTable.GetBool("isTargetingUpgrade", false)
udTable.GetBool("isFeature", false)
udTable.GetBool("canResurrect", false)
udTable.GetBool("canCapture", false)
udTable.GetBool("hideDamage", false)
udTable.GetBool("showPlayerName", false)
udTable.GetFloat("cloakCost", -1.0f)
udTable.GetFloat("cloakCostMoving", -1.0f)
udTable.GetBool("initCloaked", false)
udTable.GetFloat("minCloakDistance", 0.0f)
udTable.GetBool("decloakSpherical", true)
udTable.GetBool("decloakOnFire", true)
udTable.GetInt("highTrajectory", 0)
udTable.GetBool("kamikaze", false)
udTable.GetFloat("kamikazeDistance", -25.0f)
udTable.GetBool("showNanoFrame", true)
udTable.GetBool("showNanoSpray", true)
udTable.GetBool("canHover", false)
udTable.GetBool("floater", udTable.KeyExists("WaterLine"))
udTable.GetBool("builder", false)
udTable.GetBool("airStrafe", true)
udTable.GetBool("hoverAttack", false)
udTable.GetFloat("cruiseAlt", 0.0f)
udTable.GetFloat("airHoverFactor", -1.0f)
udTable.GetBool("bankingAllowed", true)
udTable.GetInt("transportSize", 0)
udTable.GetInt("minTransportSize", 0)
udTable.GetInt("transportCapacity", 0)
udTable.GetBool("isFirePlatform", false)
udTable.GetBool("isAirBase", false)
udTable.GetFloat("loadingRadius", 220.0f)
udTable.GetFloat("unloadSpread", 1.0f)
udTable.GetFloat("transportMass", 100000.0f)
udTable.GetFloat("minTransportMass", 0.0f)
udTable.GetBool("holdSteady", true)
udTable.GetBool("releaseHeld", false)
udTable.GetBool("cantBeTransported", false)
udTable.GetBool("transportByEnemy", true)
udTable.GetFloat("fallSpeed", 0.2)
udTable.GetFloat("unitFallSpeed", 0)
udTable.GetInt("transportUnloadMethod" , 0)
udTable.GetFloat("wingDrag", 0.07f)
udTable.GetFloat("wingAngle", 0.08f)
udTable.GetFloat("frontToSpeed", 0.1f)
udTable.GetFloat("speedToFront", 0.07f)
udTable.GetFloat("myGravity", 0.4f)
udTable.GetFloat("crashDrag",0.005f)
udTable.GetFloat("maxBank", 0.8f)
udTable.GetFloat("maxPitch", 0.45f)
udTable.GetFloat("turnRadius", 500.0f)
udTable.GetFloat("verticalSpeed", 3.0f)
udTable.GetFloat("maxAileron", 0.015f)
udTable.GetFloat("maxElevator", 0.01f)
udTable.GetFloat("maxRudder", 0.004f)
udTable.GetFloat("maxFuel", 0.0f)
udTable.GetFloat("refuelTime", 5.0f)
udTable.GetFloat("minAirBasePower", 0.0f)
udTable.GetInt("unitRestricted", MAX_UNITS)
udTable.GetString("category", "")
udTable.GetString("category", ""))
udTable.GetString("noChaseCategory", ""))
udTable.GetString("iconType", "default")
udTable.GetBool("canDGun", false)
udTable.GetString("TEDClass", "0")
udTable.GetBool("extractSquare", false)
udTable.GetFloat("maxAcc", 0.065f)
udTable.GetString("movementClass", ""))
udTable.GetString("objectName", "")
udTable.GetString("script", unitName + ".cob")
udTable.GetString("corpse", "")
udTable.GetString("explodeAs", "")
udTable.GetString("selfDestructAs", "")
udTable.GetFloat("power", (ud.metalCost + (ud.energyCost / 60.0f)))
udTable.GetBool("activateWhenBuilt", false)
udTable.GetInt("footprintX", 1)
udTable.GetInt("footprintZ", 1)
udTable.GetString("yardMap", "c"))
udTable.GetBool("leaveTracks", false)
udTable.GetFloat("trackWidth", 32.0f)
udTable.GetFloat("trackOffset", 0.0f)
udTable.GetFloat("trackStrength", 0.0f)
udTable.GetFloat("trackStretch", 1.0f)
udTable.GetString("trackType", "StdTank"))
udTable.GetBool("useBuildingGroundDecal", false)
udTable.GetInt("buildingGroundDecalSizeX", 4)
udTable.GetInt("buildingGroundDecalSizeY", 4)
udTable.GetFloat("buildingGroundDecalDecaySpeed", 0.1f)
udTable.GetString("buildingGroundDecalType", ""))
udTable.GetBool("canDropFlare", false)
udTable.GetFloat("flareReload", 5.0f)
udTable.GetFloat("flareDelay", 0.3f)
udTable.GetFloat("flareEfficiency", 0.5f)
udTable.GetInt("flareTime", 3)
udTable.GetInt("flareSalvoSize", 4)
udTable.GetInt("flareSalvoDelay", 0)
udTable.GetBool("smoothAnim", false)
udTable.GetBool("canLoopbackAttack", false)
udTable.GetBool("canCrash", true)
udTable.GetBool("levelGround", true)
udTable.GetBool("strafeToAttack", false)
udTable.GetString("collisionVolumeType", "")
udTable.GetInt("collisionVolumeTest", COLVOL_TEST_DISC)
udTable.GetBool("usePieceCollisionVolumes", false)
udTable.GetInt("seismicDistance", 0)
udTable.GetFloat("seismicSignature", -1.0f)
udTable.GetString("pieceTrailCEGTag", "")
udTable.GetInt("pieceTrailCEGRange", 1)

Re: CruiseAlt not in unitdef.h

Posted: 01 Aug 2009, 23:33
by Caydr
Tobi wrote:(this may of course be slightly inaccurate)

udTable.GetInt("buildAngle", 0)
orly...

Well there's some interesting stuff in there for sure. I take it the value on the left is the default?

Why is this one in there twice?
udTable.GetString("category", "")
udTable.GetString("category", ""))

Anyone know what this is?
udTable.GetFloat("power", (ud.metalCost + (ud.energyCost / 60.0f)))

I would search the forum but I have a feeling "power" would return too many results. I would guess it's what's displayed for the ingame "cost", except I thought that was modified by experience as well.

Re: CruiseAlt not in unitdef.h

Posted: 02 Aug 2009, 00:06
by FLOZi
You should know what power does, it cropped up in one of your earlier catch-up threads. It determines targetting priority.

Re: CruiseAlt not in unitdef.h

Posted: 02 Aug 2009, 00:35
by Caydr
oooicic

I notice that maneuverleashlength and immunetoparalyzer aren't listed, are they definitely not used?

Immunetoparalyzer is no big deal, you can set special damage for that, but maneuverleashlength as I understand it is kind of important.

Re: CruiseAlt not in unitdef.h

Posted: 02 Aug 2009, 01:32
by lurker
Also, a couple tags are interpreted for backwards compatibility by the lua def loaders.
Spring seems to be coded to use weapon ranges for that at the moment.

Re: CruiseAlt not in unitdef.h

Posted: 02 Aug 2009, 21:15
by Caydr
Is it possible to redefine Spring's formula for determining the "cost" and "power" of a unit on a mod level?

edit: better yet, is it possible to redefine all the above default values?

Re: CruiseAlt not in unitdef.h

Posted: 02 Aug 2009, 22:22
by lurker
As you can see, it loads power but not cost. I assume you understand those are defaults because you mention it explicitly, so why do you ask about setting? Anyway, if you want your own 'default' equation put it in the defs-loading lua.

Re: CruiseAlt not in unitdef.h

Posted: 03 Aug 2009, 02:19
by Caydr
Ok. I trust when I'm ready, all I need to do is hack open CA since they've probably been doing that since 2002.

Re: CruiseAlt not in unitdef.h

Posted: 03 Aug 2009, 02:23
by zwzsg
Caydr wrote:all I need to do is hack open CA
Sadly, "look into CA" has replaced every other kind of documentation, wiki or manual. :(

Re: CruiseAlt not in unitdef.h

Posted: 03 Aug 2009, 19:22
by Caydr
What happened to your animated fido?

Re: CruiseAlt not in unitdef.h

Posted: 04 Aug 2009, 06:36
by smoth
FLOZi wrote:You should know what power does, it cropped up in one of your earlier catch-up threads. It determines targetting priority.
caydr power is what you are looking for. However, power also does rely on other things like HP so you need to consider that stuff when applying the tag. I forget what those other things were, would someone be so kind and post that equation for caydr?

Re: CruiseAlt not in unitdef.h

Posted: 04 Aug 2009, 14:36
by AF
smoth wrote:caydr power is what you are looking for.
Image

Re: CruiseAlt not in unitdef.h

Posted: 05 Aug 2009, 21:22
by Caydr
Is attackrunlength ignored now as well/extrapolated from some other data?