Skip to content

Add basic transport load/unload#936

Open
ajhalme wants to merge 10 commits into
C7-Game:Developmentfrom
ajhalme:transport
Open

Add basic transport load/unload#936
ajhalme wants to merge 10 commits into
C7-Game:Developmentfrom
ajhalme:transport

Conversation

@ajhalme
Copy link
Copy Markdown
Contributor

@ajhalme ajhalme commented May 18, 2026

Add basic support for transport mechanic: loading and unloading units from a vehicle with transport capacity.

  • Add UI element to show transport contents
  • Extend C7 and unit actions with load/unload
  • Add engine message for load/unload
  • Load unit load status from Civ3 saves
  • Adjust MapUnit move(..) to allow load/unload
  • Adjust MapUnit move(..) so transports can move other units
  • Adjust tile unit display to prioritise transport over strongest defender, when out to sea
  • Adjust tile context menu to highlight transport-loaded units
  • Add load and unload buttons, with keyboard shortcuts (L/U)
  • Extend base ruleset with capacity (+patch missing/misplaced things)

Manual

Loading and Unloading
You can have a ship wait until it is loaded to capacity with units by clicking the Load order or pressing [L]. Boarding a
ship uses up all a unit’s movement points for the turn. If you attempt to move a naval unit into a land square that does not contain a port city, any passengers who have not already moved this turn are offered the option to disembark and make landfall. You can also order a ship to unload all its passengers by clicking the Unload order or pressing [L].

Demo

transport_basic

Copy link
Copy Markdown
Contributor

@stavrosfa stavrosfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff, I can imagine this being a slight pain to work out 😅

I have encountered some bugs and such, but i mostly think these can be attributed to the fact that anything can be loaded into anything with enough capacity. Should be ok once this is implemented.

Comment thread C7/UIElements/GameStatus/StatusUtils.cs Outdated
prototype.attack = prto.Attack;
prototype.defense = prto.Defense;
prototype.movement = prto.Movement;
prototype.capacity = prto.Capacity;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are missing a couple of Unit special actions.

Looking at the editor, each unit (PRTO) than can be loaded into something (not sure if this means an Army as well, but I am pretty sure it means a transport unit), has a "Special Action" called Load

Check the Infantry for example, it has the Load action

Image

In contrast, a Galley that can load, and subsequently unload units, has the Unload action

Image

The Galley doesn't have the Load because, it can't be loaded into something else.

These two actions are located here

public bool Load { get => Util.GetFlag(Flags3[4], 0); }

So that means, that we can directly check if a unit can be loaded into something that can load units, right now we can load anything, to a unit with enough capacity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 1151-1152 in ImportCiv3.ImportBicUnits() solve this, I think. I added them in, but then commented out as I figured I'd get the capacity and some cleanup in first in the base ruleset. I can take another look.

For the base ruleset, I think the unit promotion stuff isn't quite lined up perfectly, as when I save, I seem to get unitPrototype upgrade paths featuring unique units instead of the regular ones.


textures.transport_infobox = {
box = {
path = INTERFACE .. "box trans color.pcx",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two need to be imported somewhere around here

"Art/interface/box left color.png",

and we also need to add the equivalent texture for the standalone mode


[GlobalClass]
[Tool]
public partial class TransportInfoBox : Civ3TextureRect {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore this, but my ocd doesn't let me ignore that the box is missalighned compared to the LowerInfoBox. I know it's the same in the original, feel free to leave this as is 😄

A few actual comments on the box:

  1. We can click throught, although we shouldn't
  2. The textures in the original are about half the texture size of the InfoBox. Perhaps to accomodate for larger capacities? Should we stick to that?
  3. In the original, there is a box outline around (only) the transport unit? Again, should we be replicating that?
  4. We should be able to select a unit inside a transport to activate/wake, etc.. That also probably means, that these are not simple texture, rather texture buttons.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Adjusted box position a bit -- sadly the visually heavy next turn blinker makes the simple box looks out of place still
  • Removed the click-through, but need to revisit the texture button even capture
  • Resized units sprites, but each unit still goes into a 50x50 unit button -- unit sprites don't seem to share a common baseline, or I'm missing something
  • Added transport unit highlight box with Line2D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants