Specification - phyrian/kam_remake GitHub Wiki
Feature proposal: Cross-Player Resource Transfer
Idea description
Making resource transfering possible between players by sending goods from Market with horses to other player's storehouse.
Requirements
- New Unit: PackHorse
- 2 set of Sprites (64 sprites each): Unpacked and Packed
- Unique task: Transfer
- New Task: Transfer
- Go out -> Go there -> Go in -> Deliver and go out -> Go back -> Go in
- Exceptional cases:
- Unit dies on the way
- Target building disappears on the way there
- Market disappears on the way back
- New Marketplace functionality: Transfer mode.
- Make it able to set storehouses as target
- Store horses - as workers?
- Send out one of the packhorses to Transfer if requirements are met
- Maybe provide view for those horses
- Find a way of feeding the horses
- Show target and indicate trading mode on UI
- Show workers on UI
The PackHorse Unit
The PackHorse is a Unit "trained" when a Horse is getting delivered at the Marketplace as a non-exchange resource. Training/Killing such unit should not affect Unit statistics. When Marketplace is destroyed any stored PackHorse units should be silently killed and counted as Horse resource lost.
This Unit should have 2 View states, indicating whether it has or has not got any Items. Packed state should be visible by drawing pouches/packages on it's sides and back. Unpacked state is just an ordinary horse with a blanket on its back - for player color marking.
The Transfer Task
Should be specific to the Unit PackHorse. It's a task, similar to delivery, where the commiting unit is transfering multiple pieces of the same waretype from a Marketplace to a Storehouse. Task cannot be cancelled.
Preconditions: From and To must be existing, Res must not be none, amount must be up to MAX_WARES_ON_HORSE(=12)
Needs road connection: No.
Stages: At the Market (Phase 0-1); On the way to the Target(Phase 2); At the Target(Phase 3-5); On the way backwards(Phase 6); Returning at the Market(Phase 7)
Phases:
- Starting at the market: At this state do the initial setup for the task. We might add last-minute checks before starting our task, but I do not recommend it. Currently we are just chillign here a bit. Resources are currently removed in the Market code.
- Leaving the market
- Walking towards the target
- Going in the target building
- Chilling inside after a long journey: Don't judge, you would be tired, too
- Unpacking and leaving: Adding our resources to the building, then leaving the house
- Walking the way back to the market
- Arriving at the market: Going inside
- Chilling inside after a long journey pt.2: Chilling a bit again before being ready for an other order.
Exceptional cases:
- PackHorse dies during the task: 1 resource of horse lost. Carried resources were already accounted in the Marketplace code.
- Target building disappears (Nil or Destroyed): skip ahead to return phase.
- Market building disappears: kill the horse, same as 1. case.
The Market - Transfer mode
PackHorses (up to MAX_WARES_IN_HOUSE(=5)) can either be stored or work at the Market. They are trained from delivered horses. When Idle they must be inside the building. On a successful AttemptExchange in transfer mode they will start the Transfer task. Feeding is still undecided.
Feature must not be confusing for the player:
- Allow selecting target with RMB on Storehouse in the world.
- Show trading mode: Storehouse icon + Player color flag on UI, and make it interactable: go to building on click.
- Possible restriction: Only allow selecting allied Storehouse.
Feature must not have unpleasant consiquences:
- Delivering a horse for exchange should not Train a PackHorse out of it.
Selecting a storehouse for target must behave the same as selecting a resource to trade for - same conditions, demands.