How is unit speed calculated?

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Post Reply
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

How is unit speed calculated?

Post by Shadow Wolf TJC »

I'm having trouble figuring out how exactly a unit's on-road and off-road speed is calculated. Obviously, the propulsion type determines the unit's highest possible speed, and engine power and weight play important parts in increasing and decreasing speed respectively, but what about that "Propulsion Terrain Multiplier"? In propulsiontype.txt, I see the number 80 next to the Wheeled, Half-Tracked, and Tracked propulsions, 100 next to the Hover and Legged propulsions, and 140 next to the VTOL Propulsion (which all seem to correspond to their respective speed percentage thingies in their respective guide entries).
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How is unit speed calculated?

Post by aubergine »

"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: How is unit speed calculated?

Post by Shadow Wolf TJC »

Yeah. I've taken a look at it, but I'm still puzzled about what that "Propulsion Terrain Multiplier" is supposed to represent, or where to look to find out more about it. I'm also wondering about how exactly propulsiontype.txt factors into this.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: How is unit speed calculated?

Post by Reg312 »

as i remember "Propulsion Terrain Multiplier" can increase or decrease engine power by some way..
it works only when unit cannot move with maximum speed, so it works like you have only 80% of engine power on specified terrain type.
i'll check code and say exactly how it works
(i'm afraid it was changed in 3.1, ask Cyp)
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: How is unit speed calculated?

Post by Reg312 »

propulsion_multiplier = speed multiplier different for each propulsion [propulsiontype.txt, column 3]
Wheeled,GROUND,80
Tracked,GROUND,80
Legged,GROUND,100
Hover,GROUND,100
Ski,GROUND,100
Lift,AIR,140
Propellor,GROUND,100
Half-Tracked,GROUND,80
Jump,AIR,200


bodyPower = [engine power from body.txt] * upgrade_modifier
Engine Upgrades (upgrade_modifier for each level of engine research):
105% - Fuel Injection Engine
110% - Fuel Injection Engine Mk2
115% - Fuel Injection Engine Mk3
120% - Turbo-Charged Engine
125% - Turbo-Charged Engine Mk2
130% - Turbo-Charged Engine Mk3
135% - Gas Turbine Engine
142% - Gas Turbine Engine Mk2
150% - Gas Turbine Engine Mk3


weight = [total weight of droid design] = weigh_turrets + weight_propulsion * weight_body + weight_body
weigh_turrets - sum weight of all turrets attached
weight_body - weight of body from body.txt
weight_propulsion - weight modifier for propulsion, eg. weight 50 for propulsion means 50% weight modifier
Propulsion weight modifiers:
Wheels +300%
Half-tracks +400%
Hover +200%
Tracks +650%
VTOL +50%
Cyborg Propulsion +50%


base_speed = propulsion_multiplier * bodyPower / weight
VTOL with medium body vtol_med_base_speed = base_speed * 0.75
VTOL with heavy body vtol_heavy_base_speed = base_speed * 0.25

if body engine (without upgrades!) have more power than total weight of droid, then we get
fastbody_base_speed = base_speed * 1.5
-------------------------------------------------------------------------------------

terrain_speed_factor = special multiplier for each terrain type in [terraintable.txt] different for each propulsion
(see decoded terrain table in bottom of post)
e.g. half-tracks have only 80% speed factor on green terrain.

speed = base_speed * terrain_speed_factor
max_speed = maximum speed for each propulsion defined in [propulsion.txt]
maximum speed for propulsion:
vtol 700
cyborg 400
hover 300
wheels 175
half-tracks 150 (in UI: 1.17)
tracks 125 (in UI: 0.98)


final_speed = minimum of (speed, max_speed)

super_final_speed = final_speed * level_speed_bodus
level_speed_bodus - Unit Experience Bonus, see here: http://guide.wz2100.net/experience

so, in result we calculated unit speed (super_final_speed)

may be i miss something? i dont know

Examples of speed calculation:
Example1:medium cannon/cobra/half-tracks
research level: T2 (115% for engine upgrade)
terrain: yellow brush (terrain for arizona maps)
cobra engine power: 15'000
propulsion_multiplier for half-tracks: 80%
bodyPower = 15'000 * 115% = 17'250
medium cannon weight = 5000
propulsion weight modifier = 400%
body weight = 2000
weight = 5000 + 2000*4 + 2000 = 15'000
base_speed = 80 * 17'250 / 15'000 = 92
fastbody_base_speed ?? enginePower_w/o_upgr>weight - false, so this design is not fast design and does not get 50% speed bonus
terrain_speed_factor = 100%

final_speed = 92

[update]
Note: speed shown in game UI is speed in another measure unit (tile per second??)
in UI 0.98 speed = 125
0.75 speed = 92 (from example above)

[update2]
Speed shown in unit design screen calculated for 1 specified terrain type:
Road - TER_ROAD
Off-Road - TER_SANDYBRUSH
Water - TER_WATER
Vtols Air Speed - TER_ROAD

Decoded terraintable.txt
TER_SAND Wheeled 100%
TER_SAND Tracked 100%
TER_SAND Legged 100%
TER_SAND Hover 150%
TER_SAND Lift 250%
TER_SAND Half-Tracked 100%
TER_SANDYBRUSH Wheeled 100%
TER_SANDYBRUSH Tracked 100%
TER_SANDYBRUSH Legged 100%
TER_SANDYBRUSH Hover 80%
TER_SANDYBRUSH Lift 250%
TER_SANDYBRUSH Half-Tracked 100%
TER_BAKEDEARTH Wheeled 80%
TER_BAKEDEARTH Tracked 100%
TER_BAKEDEARTH Legged 100%
TER_BAKEDEARTH Hover 150%
TER_BAKEDEARTH Lift 250%
TER_BAKEDEARTH Half-Tracked 100%
TER_GREENMUD Wheeled 80%
TER_GREENMUD Tracked 90%
TER_GREENMUD Legged 100%
TER_GREENMUD Hover 100%
TER_GREENMUD Lift 250%
TER_GREENMUD Half-Tracked 80%
TER_REDBRUSH Wheeled 100%
TER_REDBRUSH Tracked 100%
TER_REDBRUSH Legged 100%
TER_REDBRUSH Hover 80%
TER_REDBRUSH Lift 250%
TER_REDBRUSH Half-Tracked 100%
TER_PINKROCK Wheeled 80%
TER_PINKROCK Tracked 100%
TER_PINKROCK Legged 100%
TER_PINKROCK Hover 50%
TER_PINKROCK Lift 250%
TER_PINKROCK Half-Tracked 90%
TER_ROAD Wheeled 150%
TER_ROAD Tracked 120%
TER_ROAD Legged 100%
TER_ROAD Hover 150%
TER_ROAD Lift 250%
TER_ROAD Half-Tracked 135%
TER_WATER Wheeled 60%
TER_WATER Tracked 60%
TER_WATER Legged 60%
TER_WATER Hover 150%
TER_WATER Lift 250%
TER_WATER Half-Tracked 60%
TER_CLIFFFACE Wheeled 60%
TER_CLIFFFACE Tracked 60%
TER_CLIFFFACE Legged 60%
TER_CLIFFFACE Hover 80%
TER_CLIFFFACE Lift 250%
TER_CLIFFFACE Half-Tracked 60%
TER_RUBBLE Wheeled 80%
TER_RUBBLE Tracked 80%
TER_RUBBLE Legged 100%
TER_RUBBLE Hover 80%
TER_RUBBLE Lift 250%
TER_RUBBLE Half-Tracked 50%
TER_SHEETICE Wheeled 70%
TER_SHEETICE Tracked 90%
TER_SHEETICE Legged 100%
TER_SHEETICE Hover 150%
TER_SHEETICE Lift 250%
TER_SHEETICE Half-Tracked 80%
TER_SLUSH Wheeled 60%
TER_SLUSH Tracked 100%
TER_SLUSH Legged 75%
TER_SLUSH Hover 80%
TER_SLUSH Lift 250%
TER_SLUSH Half-Tracked 80%
Last edited by Reg312 on 29 Apr 2012, 09:36, edited 3 times in total.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: How is unit speed calculated?

Post by aubergine »

That's the best write-up ever of speed calcs - great work Reg312! AWESOME WIN!!!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: How is unit speed calculated?

Post by Reg312 »

thank you :)

i added note
in game UI speed shown in another units.
so, when you see 125 maximum speed for tracked propulsion in [propulsion.txt] this mean 0.98 max speed value shown in unit design UI
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: How is unit speed calculated?

Post by Shadow Wolf TJC »

Thanks for the info. That info of yours explains how speed is calculated a whole lot better than the vague stuff that's present in the guide. :D

That terraintable.txt stuff looks pretty interesting. With it, modders can choose to grant speed bonuses, or penalties, towards certain units that travel through certain terrain types. For example, they could grant wheeled, half-tracked, and tracked units, but not hovercraft or VTOLs, a speed bonus while on paved roads, and a speed penalty while on moist, slushy, or muddy terrain. Although, I personally feel that modders should use off-road speed, as opposed to on-road speed, as a standard when balancing their mods out, due to how common off-road terrain seems to be over paved roads.

By the way, what terrain types does the game use for displaying on-road, off-road, and water speeds on the design menu?
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: How is unit speed calculated?

Post by Reg312 »

in Design Screen

Road - TER_ROAD
Off-Road - TER_SANDYBRUSH
Water - TER_WATER
Vtols Air Speed - TER_ROAD
Reg312
Regular
Regular
Posts: 681
Joined: 25 Mar 2011, 18:36

Re: How is unit speed calculated?

Post by Reg312 »

i found some breaking things:
1) cyborgs speed does not affected by any engine upgrades
2) first trucks slower (seems first units does not affected by any upgrades or only by engine upgrades)
it can be noticed if you play with engine power and upgrades
User avatar
Shadow Wolf TJC
Regular
Regular
Posts: 1047
Joined: 16 Apr 2011, 05:12
Location: Raleigh, NC

Re: How is unit speed calculated?

Post by Shadow Wolf TJC »

Reg312 wrote:i found some breaking things:
1) cyborgs speed does not affected by any engine upgrades
2) first trucks slower (seems first units does not affected by any upgrades or only by engine upgrades)
it can be noticed if you play with engine power and upgrades
1. That's because engine upgrades seem to only affect vehicles, as seen in functions.txt
2. Well, trucks would most likely weigh less than their starting engine power anyways. Maybe that's why?

Anyways, thanks again for the information, though for my mod, I've been thinking about wanting to display the unit's base off-road speed on top (since moving off-road seems to be so common over moving on-road, that I feel that it ought to be THE standard in which to base most unit speeds off of when balancing), followed by its slowest off-road speed (since I'm thinking about creating easily-identifiable spots, most likely muddy/slushy/marshy areas, where most units, including Cyborgs, are slowed down as their tires/treads/feet/etc. start to sink into the ground), and finally, followed by water speed on the bottom. Sadly, I doubt that I'd be able to accomplish this due to it being possibly hard-coded in, so I may have to re-assign a few tile types (such as swapping TER_ROAD tiles with TER_SANDYBRUSH, TER_SANDYBRUSH tiles with TER_GREENMUD, and TER_GREENMUD tiles with TER_ROAD).
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Post Reply