Page 1 of 1

How does transportcapacity work?

Posted: 26 Apr 2013, 22:07
by Jools
I've run into some problems regarding the amount limitation of transports. From the wiki:
http://springrts.com/wiki/Units-UnitDefs#Transports wrote: int transportCapacity Default: 0
The total number of units that the transport can pick up, with each unit multiplied by it's footprintX size. If this tag is not present, then any AttachUnit and DropUnit call in the animation script will be ignored (See Animation-LuaCallouts#Other)
So according to this, the transportCapacity is simply the sum of footprintx, or xsize in lua-unitdef. However, in xta:

arm ornith: transportcapacity=8; (t2 transporter)
arm atlas: transportcapacity=1;
arm bear: transportcapacity=15; (hovercraft transport)

Yet, in reality, ornith can pick up 3 bulldogs (each bulldog has footprintx=3 => 9)

Ornith can also pick up 4 spiders (4*2), or 2 bulldogs and a spider (2*3+2=8).

Bear can pick up 5 bulldogs (5*3 = 15), so that checks.

But atlas can also pick up one spider, one bulldog etc, so here the tag doesn't compute: all these footprints exceed 1.

I read that this is complicated, but I would be happy if someone could clarify the formula.

The mass isnt the limiting factor in any of these cases. For reference:
Atlas wrote: transmaxunits=1;
transportcapacity=1;
transportmass=70001;
transportsize=3;
Bear wrote: transportcapacity=15;
transportmaxunits=16;
transportsize=3;
(mass not defined, default = 100 000)
Ornith wrote: transmaxunits=3;
transportcapacity=8;
transportmass=7000;
transportsize=3;

Re: How does transportcapacity work?

Posted: 26 Apr 2013, 22:24
by FLOZi
transportCapacity should just be total of units, the current logic is an ugly hangover from the days prior to transportMass et al.

back on topic;

https://github.com/spring/spring/blob/d ... t.cpp#L331

Code: Select all

transportCapacityUsed += tu.size;
Where
https://github.com/spring/spring/blob/d ... t.cpp#L328

Code: Select all

tu.size = unit->xsize / 2;
And
https://github.com/spring/spring/blob/d ... f.cpp#L612

Code: Select all

xsize = std::max(1 * SPRING_FOOTPRINT_SCALE, (udTable.GetInt("footprintX", 1) * SPRING_FOOTPRINT_SCALE));
Where:
https://github.com/spring/spring/blob/d ... ants.h#L21

Code: Select all

const int SPRING_FOOTPRINT_SCALE = 2;
So wiki is essentially correct in what it says, however;

https://github.com/spring/spring/blob/d ... t.cpp#L222

Code: Select all

if (transportCapacityUsed >= unitDef->transportCapacity)
		return false;
'Transport is full' logic is rather flawed; instead of checking 'is the next unit too big to fit?' it checks 'Am I already over-stuffed'?

Re: How does transportcapacity work?

Posted: 26 Apr 2013, 23:07
by Jools
Thanks, that explained it.