[Important] Compatibility & Changes in 101.0

[Important] Compatibility & Changes in 101.0

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

[Important] Compatibility & Changes in 101.0

Post by hokomoko »

tl;dr Airbases and fuel engine implementations were removed. New Transporting (TM) was added.
Example gadget: viewtopic.php?f=23&t=34417

Glossary:
Legacy Transports - Any unit with transportCapacity > 0 and transportMass > 0 (unit.isTransport in lua)


Airbase Removal

The airbase code in the engine was a bad case of highly specific & buggy code and its maintenance wasn't worth keeping it.
Fuel code was slightly better, but still highly specific and not worth keeping.

Removed Tags:
  • minAirBasePower
  • maxFuel
  • refuelTime
SetUnitFuel, GetUnitFuel and COB setters/getters were deprecated

Since isAirbase is used with some AIs it was kept for now, it doesn't affect anything and it is only useful for marking a unit's role.


New Transporting

In order to make a lua reimplementation possible, the transport system was made more generic and new lua callouts were added.
The behaviour of Legacy Transports should stay the same, other than the fact that now every mobile unit can be a Legacy Transport (including builders).

The main change in New Transporting is that now every unit can have units attached (or detached) to it (form it) by using:
  • Spring.UnitAttach(transporterID, passengerID, pieceNum) - When used on Legacy Transports this will be equivalent to the script AttachUnit.
  • Spring.UnitDetach(passengerID), Spring.UnitDetachFromAir(passengerID)
  • Spring.SetUnitLoadingTransport(passengerID, transportID) - Turns off collisions between these two.
When units are attached/detached, the regular UnitLoaded and UnitUnloaded callins are called.

Units that were attached are still selectable and can still fire. You can make them unselectable/stun them as necessary.

A Legacy Transport isn't usable for New Transporting.

Air Units Landing

Another required capabilty was to force air units to land in a specific point. This is still being tweaked, but a new lua callout was added:
Spring.SetUnitLandGoal(unitID, x, y, z [, radius]) which tells the unit to land (even if it is in fly mode) in the supplied point (doesn't have to be on ground).
This callout can be called every frame to update the landing position if it needs to be changed (i.e. when landing on a carrier).

Example:
Image



All the above changes are already live in the latest dev version (100.0.1-150-g7bf559f)
Last edited by hokomoko on 12 Feb 2016, 18:37, edited 7 times in total.
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10368
Joined: 24 Jan 2006, 21:12

Re: [Important] Compatibility & Changes in 101.0

Post by PicassoCT »

Fueling is now handled by lua? Part of Spring base content?

Is it handled at all?
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

Not handled at all.
User avatar
Jools
XTA Developer
Posts: 2814
Joined: 23 Feb 2009, 16:29

Re: [Important] Compatibility & Changes in 101.0

Post by Jools »

hokomoko wrote: The main change in New Transporting is that now every unit can have units attached (or detached) to it (form it) by using:
  • Spring.UnitAttach(transporterID, transporteeID, piece) - When used on Legacy Transports this will be equivalent to the script AttachUnit.
  • Spring.UnitDetach(transporteeID), Spring.UnitDetachFromAir(transporteeID)
Is script AttachUnit still present or is it removed?
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

The script AttachUnit still exists and will only work with Legacy Transports (as was before).
User avatar
Silentwings
Moderator
Posts: 3686
Joined: 25 Oct 2008, 00:23

Re: [Important] Compatibility & Changes in 101.0

Post by Silentwings »

What is it that distinguishes a legacy transport from a new transport? A unitdef tag?
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

There is no "New Transport" as any unit can have other units attached to it by synced lua.
hokomoko wrote:Legacy Transports - Any unit with transportCapacity > 0 and transportMass > 0 (unit.isTransport in lua)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6235
Joined: 29 Apr 2005, 01:14

Re: [Important] Compatibility & Changes in 101.0

Post by FLOZi »

hokomoko wrote:now every unit can have units attached (or detached) to it (form it) by using:
  • Spring.UnitAttach(transporterID, transporteeID, piece)
I think I love you.


I also hate you for doing this now, when I have no time to do anything with it.
User avatar
Jools
XTA Developer
Posts: 2814
Joined: 23 Feb 2009, 16:29

Re: [Important] Compatibility & Changes in 101.0

Post by Jools »

Thanks for notifying, I'm sure the change will be for the better.

The only reason I was concerned with the internal script way was because I spent a lot of time calibrating it for the morph gadget, and it has such a mess of a code that I'd rather not touch it again :)
gajop
Moderator
Posts: 3044
Joined: 05 Aug 2009, 20:42

Re: [Important] Compatibility & Changes in 101.0

Post by gajop »

I think it would be reasonable to have the synced read equivalent of SetUnitLandPos, e.g. GetUnitLandPos and some way of knowing if the unit is currently trying to land -> does SetUnitLandPos cause a command to be issued?
Is this also the first time a synced ctrl callout would be used to issue unit orders? I don't think that incosistency is great if so. Should we be making custom commands that would be calling SetUnitLandPos?
Super Mario
Posts: 820
Joined: 21 Oct 2008, 02:54

Re: [Important] Compatibility & Changes in 101.0

Post by Super Mario »

That's great! What are you working on next?
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

gajop wrote:I think it would be reasonable to have the synced read equivalent of SetUnitLandPos, e.g. GetUnitLandPos and some way of knowing if the unit is currently trying to land -> does SetUnitLandPos cause a command to be issued?
SetUnitLandPos is a slightly improved SetUnitMoveGoal and doesn't issue a command, it should be used by custom commands which require the unit to land.

I'll put example code in the near future.
That's great! What are you working on next?
It's not done yet.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6235
Joined: 29 Apr 2005, 01:14

Re: [Important] Compatibility & Changes in 101.0

Post by FLOZi »

Men of War style equipment inventories.
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

A slight change:
SetUnitLandPos(unitID, px, py, pz) => SetUnitLandGoal(unitID, px, py, pz [, radius])
User avatar
Jools
XTA Developer
Posts: 2814
Joined: 23 Feb 2009, 16:29

Re: [Important] Compatibility & Changes in 101.0

Post by Jools »

What does the optional radius argument do? Specify the radius of the acceptable circle where it is allowed to land? It wills till try to land at the specified point?
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

Yup
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6235
Joined: 29 Apr 2005, 01:14

Re: [Important] Compatibility & Changes in 101.0

Post by FLOZi »

I also think this will make 'restricted' transports easier / cleaner to implement:

For example, a jeep that can carry exactly 4 soldiers and 1 anti tank weapon, and nothing else:

Image
hokomoko
Spring Developer
Posts: 592
Joined: 02 Jun 2014, 00:46

Re: [Important] Compatibility & Changes in 101.0

Post by hokomoko »

Correct.
Super Mario
Posts: 820
Joined: 21 Oct 2008, 02:54

Re: [Important] Compatibility & Changes in 101.0

Post by Super Mario »

Would be cool if you could "equip" weapons by picking them up from the ground. That way a clone of army men would be possible and I would play the ever lasting shit out of it.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6235
Joined: 29 Apr 2005, 01:14

Re: [Important] Compatibility & Changes in 101.0

Post by FLOZi »

Super Mario wrote:Would be cool if you could "equip" weapons by picking them up from the ground. That way a clone of army men would be possible and I would play the ever lasting shit out of it.
That is what I meant with
Men of War style equipment inventories.
8)
Post Reply

Return to “Engine”