Transports

Transports

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Transports

Post by SanadaUjiosan »

Ok, transports are not doing what I want them to do, so I'm going to list my problem, and give a hypothetical situation so you guys can explain how it really works.

I want my transport to carry several units, but it only picks up a few of them. The transportSize and transportMass are both set to 100,000, and these units I'm trying to pick up are really small.

So, hypothetical situation:

Transport wants to pick up 10 units. These units have a 2x2 footprint, and have a mass of 5 each.

So what would I set transportSize and transportMass to? I really don't understand exactly how those work, but I'm going to guess I'd set the Size to 4, and the Mass to 50.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Transports

Post by SinbadEV »

From http://springrts.com/wiki/Units:FBI

TransportCapacity
The number of units the transport can carry
If this tag is not present, then any attach-unit and drop-unit command in the script will be ignored.

Code: Select all

transportcapacity=5;
TransportMass
this is the maximum weight a tranporter can transport, default 100000

Code: Select all

transportmass=100000;
TransportSize
The size of units that the transport can pick up, based on the unit-to-be-loaded's FootPrintX and FootPrintZ.

Code: Select all

transportsize=3;
edit, so to directly answer your question:

Code: Select all

transportcapacity=10;
transportmass=50;
transportsize=4;
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Transports

Post by SanadaUjiosan »

So, it works the way I thought.

But my real transport still won't pick up more than 5 units. Like I said, it's set to capacity = 15, mass = 100,000 and size = 100,000. And these units I'm wanting to pick up have a 2x2 footprint and 32.5 mass. I don't understand.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Transports

Post by zwzsg »

In Spring, contrary to TA, transport capacity is not the number of units, but the sum of all footprints. At least so it was when I last tried, years ago.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Transports

Post by SinbadEV »

so 40? odd
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Transports

Post by SanadaUjiosan »

Is there like a hardcoded limit to how many units a transport can carry?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Transports

Post by FLOZi »

SanadaUjiosan wrote:Is there like a hardcoded limit to how many units a transport can carry?
No. Zwzsg is correct, looking at CTransportUnit::AttachUnit(CUnit* unit, int piece) in the source code

Code: Select all

	TransportedUnit tu;
	tu.unit=unit;
	tu.piece=piece;
	tu.size=unit->xsize/2;
	tu.mass=unit->mass;
	transportCapacityUsed+=tu.size;
	transportMassUsed+=tu.mass;
Ignore the division by 2, that's because the code that parses footprints doubles it.

So to answer you:
Transport wants to pick up 10 units. These units have a 2x2 footprint, and have a mass of 5 each.
transportsize = 2, -- footprintX of the transportees
transportcapacity = 20, -- number of transportees * their footprintX
transportmass = 50, -- number of transportees * their mass
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Transports

Post by SanadaUjiosan »

That did it. Thanks a lot for straightening that out Flozi.

Now that that is straightened out, I can't help but notice that figuring out how much you want your transport to be able to carry can get kind of complicated, especially if you're dealing with a lot of different footprint sizes.

Aka, I'm no math whiz.

Is there a tag I can put in the unit def that's sort of like "can't be transported", but is instead something like "Only 1 per transport"? What I'm shooting for is that I only want 1 of my "big unit" to be able to fit, but I'd like a good number of my smaller, more peon-like mechs to be able to fit. If there's not, that's fine. I'll just have to get clever and try my best to get what I want.

Thanks again though, this transport has been an enormous pain.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Transports

Post by FLOZi »

The easiest way to do that is to get clever with the unit masses. For example trucks and halftracks in S44 can carry 1 light infantry gun, as well as a bunch of infantry. (Although in the current dev versions it is done via a script hack.)

Anyway, essentially make your big unit half the transportmass of the transporter + 1, so it could only pick up 1, as well as a bunch of your peons, with have a much smaller transport mass.

As for transports being a royal pain - welcome to Spring. :mrgreen: Certainly transports are one of the worst things inherited from TA.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Transports

Post by SanadaUjiosan »

Playtest with friend revealed my transports are dumb. Super tired so I'm going to be terse. They were having trouble unloading.

Are land transports easier? I'm getting tired of this dumb air transport just not working.
Post Reply

Return to “Game Development”