Hovers can't be transported

Hovers can't be transported

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

User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Hovers can't be transported

Post by yuritch »

I'm currently experimenting with some "truly amphibious" units. That is, they behave like land units while on land (follow the slopes) and float on the water surface while in water (like hovers do). Using set MAX_SPEED I can decrease their speed in ampibious mode, so that works fine (most real world amphibious units are much slower in water then they are on land).
However, to be able to make them float, I had to give them the hover MoveType and CanHover=1 (and some script to follow the slope while on land, like the one in Nanoblobs Demon for ex.). From that time on the units cannot be loaded into a transport (load cursor just doesn't appear while targeting them). I tried various tags like Mass to no effect.
I then looked into Spring source and found something interesting (in TransportCAI.cpp, function CanTransport):

Code: Select all

if(unit->unitDef->canhover || unit->unitDef->floater || unit->unitDef->canfly)
return false;
That means any units with CanHover=1 (or CanFloat=1 or CanFly=1) just cannot be transported, engine doesn't allow to load them. Of course, they probably can be loaded using heavy scripting, but I'd like to avoid that solution.
So, does anyone have an idea what could be done?
BTW, there was another small glitch with those units. If set to leave tracks, they still do that while in the water. Tracks appearing on the sea bottom under a floating unit look strange. That's minor though.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

Make a patch, and change "return false" to "return true"?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

No, that'd make all hovers, planes and ships transportable regardless of the other values.
User avatar
kujeger
Posts: 91
Joined: 07 Oct 2004, 14:46

Post by kujeger »

Code: Select all

if(unit->unitDef->canhover || unit->unitDef->floater || unit->unitDef->canfly) 
return false;
to

Code: Select all

if(unit->unitDef->floater || unit->unitDef->canfly) 
return false;
if(unit->unitDef->canhover)
return true;
?


edit: Or maybe a new flag, "unitTransportable" ?
Last edited by kujeger on 19 Feb 2007, 12:28, edited 1 time in total.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

What can be an acceptable solution then? A new FBI tag (like CanAlwaysBeTransported=1 or OverrideTransportability=1)?
Or can the unit be made to behave like a hover without being CanHover=1? I had to make it hover because ordinary ground units cannot stay at the water surface. Of course, I can use scripting to raise unit's model to surface level if it is under water, but AFAIK the hitsphere will remain below water and that will cause more problems.
Edit (to previous poster):

Code: Select all

if(unit->unitDef->floater || unit->unitDef->canfly) 
return false; 
if(unit->unitDef->canhover) 
return true;
That will make ALL hovers in ALL mods transportable. That's a bit too much.
UnitTransportable is a bit unclear. If it defaults to 1, we still have the transportable ships problem. If it defaults to 0, we'll have "nothing is transportable" problem.
Saktoth
Zero-K Developer
Posts: 2665
Joined: 28 Nov 2006, 13:22

Post by Saktoth »

I see no reason why hovers in all mods shouldnt be transportable, IMO its an oversight and would be welcomed in most mods.

Making air and ships transportable is another kettle of fish, but i dont see why the engine should forbid them from being so entirely.
User avatar
kujeger
Posts: 91
Joined: 07 Oct 2004, 14:46

Post by kujeger »

yuritch wrote:UnitTransportable is a bit unclear. If it defaults to 1, we still have the transportable ships problem. If it defaults to 0, we'll have "nothing is transportable" problem.
Well, you can have the current On-Off hardcode translate to defaults. That way things will be the way they are now by default, but being overrideable.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

So we'll have both canbetransported and cantbetransported tags? :shock:

Personnaly I fail to see the reason why hovers and ships must be hardcoded to be untransportable.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

zwzsg wrote:So we'll have both canbetransported and cantbetransported tags? :shock:

Personnaly I fail to see the reason why hovers and ships must be hardcoded to be untransportable.
I 100% agree, it is a limitation added into Spring, not even one inherited from TA. And should be removed with haste.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

+1
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

+2
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

+3 to this..

and could some one also make hovers be able to follow terrain normally (no scripting required) or at least allow it to be toggalble ala the upright=1 tag, cause even the scripting in nanoblobz does not even come close to actual ground units..
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Fanger wrote:+3 to this..

and could some one also make hovers be able to follow terrain normally (no scripting required) or at least allow it to be toggalble ala the upright=1 tag, cause even the scripting in nanoblobz does not even come close to actual ground units..
I've made a patch which gives control of UPRIGHT via the script, and killed off hovers being upright by default. Using this method you can script a hover to be upright when on water and non-upright on land, or you can just use the upright=1; tag to keep current behaviour.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

THAT IS MADE OF WIN AND GOD!

and that is going in the next version of spring???

GOD I HOPE SO!
User avatar
Zoombie
Posts: 6149
Joined: 15 Mar 2005, 07:08

Post by Zoombie »

Nice job, Flozi.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Fanger wrote:THAT IS MADE OF WIN AND GOD!

and that is going in the next version of spring???

GOD I HOPE SO!
I need to submit it on mantis and have it checked over, but hopefully.

It's not perfect visually though, there is a bit of nastyness when the unit changes between, but with a better script (the one i used to test was really quite crude) it's probably not too bad.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

the possiblity is still great, and Im sure the scripting can be tweaked, but calling that is still awesome..
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I've made a patch which gives control of UPRIGHT via the script, and killed off hovers being upright by default. Using this method you can script a hover to be upright when on water and non-upright on land, or you can just use the upright=1; tag to keep current behaviour.
Yay! I can finally get rid of that hacky, nasty, cpu-intensive workaround code :-)
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

I KNOW ITS GREAT... i think flozi deserves a cookie for this..
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

+1 to Upright=0 hovers (and +10 to set UPRIGHT).
What about the non-transportable things? Will those be removed too?
Post Reply

Return to “Game Development”