Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D2K Original Starport #7055

Open
5 tasks
MunWolf opened this issue Dec 2, 2014 · 11 comments
Open
5 tasks

D2K Original Starport #7055

MunWolf opened this issue Dec 2, 2014 · 11 comments

Comments

@MunWolf
Copy link
Contributor

MunWolf commented Dec 2, 2014

This is a TODO for changing the starport in D2K so it functions like the one in the original game.

Extra:

@penev92
Copy link
Member

penev92 commented Dec 2, 2014

Don't forget fluctuating unit prices. After all, that is a market, not a factory.

@chrisforbes
Copy link
Member

The transport also arrived vertically.

@MunWolf
Copy link
Contributor Author

MunWolf commented Dec 2, 2014

There is a small problem with the UI implementation since D2K is still using the old UI

@xan2622
Copy link
Contributor

xan2622 commented Dec 2, 2014

yes sorry, I still haven't finished my new D2K UI (#6043). Well, it's finished but.. it's not testable yet.

@MunWolf
Copy link
Contributor Author

MunWolf commented Dec 2, 2014

NP will be working on the transport in the meantime.

@Micr0Bit
Copy link
Member

Micr0Bit commented Dec 5, 2014

not 100% sure , but i bet there is a max-limit ... of how many units you can order ... (while playing the original , ive noticed i cant order more then 5 or 6 units with 1 cargo) ... and theres also something like a "stock" for every unit ... so you cant just nonstop order the same unit again and again .... but this stock will refill after some time

pretty sure this "stock" is shared with all AI or Players ingame ... (sound logical)

this is an important balance factor ... along with the Fluctuating prices

@MunWolf
Copy link
Contributor Author

MunWolf commented Dec 5, 2014

This has already been added in #7056 there are Minimum and Maximum values in the yaml.

@penev92
Copy link
Member

penev92 commented Dec 16, 2014

The ticks on the first two tasks are a bit deceiving, since they have been sitting as open PRs for a while now. :/

@MunWolf
Copy link
Contributor Author

MunWolf commented Dec 16, 2014

FIne ill untick them and only tick once they have been merged.

@penev92
Copy link
Member

penev92 commented Feb 3, 2021

After a bunch of digging around and testing the original game (thanks to the GruntMods edition and the D2k+ tools), I believe I have the info we've been craving for so long - documented Starport behaviour:

  • Prices and availability:
    • Starport units are updated once every 60 seconds of in-game time, starting from the first game tick.
    • Each update can add exactly one item to each unit type. Each unit type has about a 10% chance to get a new item. (This means it may give you 1 unit of every type or it may not give you anything. Pure luck.)
    • Each update changes prices in a 75%-100% range of the original unit price. Discounts are calculated per unit type.
    • Stock and price updates are independent from each other and all prices change every 60 seconds regardless of anything.
    • Both stock amounts and prices are per-player. After a brief discussion on Discord it was decided that we'll keep unit prices the same between players and sync stock increments (but not decrease them when another player makes a purchase).
    • Stocks are limited to a maximum of 5 units per type. (not sure what the balance implications here are or why the limitation exists) (Edit: @pchote suggested on Discord that is incompatible with the above idea to sync stock increments between players. We need to decide whether to get rid of the limitation or to not sync stock increments.)
  • Order placement:
    • Selecting a unit in the Starport tab instantly takes the player's money for the full amount of the unit.
    • Selecting a unit to purchase freezes both price and availability updates until the unit is purchased or cancelled.
    • A single order is limited to 6 items.
    • New orders become available as soon as the CHOAM frigate is finished unloading.
  • Order cancellation, refunding and delivery:
    • Selecting units and then leaving the Starport tab cancels the order, refunding the player and playing the "Cancelled" voice line.
    • The frigate will try to deliver at the starport that is primary at the time of its spawning. If the primary Starport is lost, then the frigate reroutes to the new primary Starport.
    • Losing all your Starports before the frigate is in-world cancels the order for a full refund.
    • Losing all your Starports while the frigate is in-world (or even landing) cancels the order for a full refund.
    • Losing all your Starports while the frigate is in-world (or even landing), but quickly adding a new one reroutes the frigate to that (the frigate last scans for an available Starport right before deciding to leave the map).
    • The notification "T-minus 5" is played as the purchase is placed.
    • The notification "T-minus 1" is played as the frigate is spawned.
    • All "T-minus" notifications are played exactly 15 seconds apart, making the entire delivery exactly 60 seconds of in-game time. Number and cost of purchased units doesn't matter.
  • Frigate behaviour:
    • The CHOAM frigate spawns at the closest map edge cell to the primary Starport and flies directly to it.
    • The landing and take-off are vertical.
    • The exit path is on the same straight line that was used for entry, leaving on the opposite edge of the map.
    • If the targeted Starport is lost while the frigate is flying, it can circle around and reroute to another Starport if available.
    • The frigate decelerates as it approaches the Starport and accelerates after takeoff.

EDIT: @pchote pointed out I failed to mention production prerequisites. The Starport completely ignores those. This might need to be verified for specific missions where the player gets a Starport though!

@pchote
Copy link
Member

pchote commented Feb 13, 2021

I worked through a couple of prototypes, and have found that the best way forward will be to extract an IProductionQueue interface that decouples the strong ties between the production UI and ProductionQueue trait. Many of the base fields on ProductionQueue don't make sense or outright conflict with the starport (e.g. *Audio, InfiniteBuildLimit, QueueLimit), and this would also let us clean up some of the special-case hacks around building placement and open up new modding possibilities (e.g. multiple resource types or having multiple queues on the same tab).

Once this is done, the logic described above becomes simple: the starport trait keeps track of how many of each item is available and what it costs (which could be synced between players at this level if wanted) and exposed to the sidebar through the interface. The build/cancel orders are resolved to track an internal purchase list, and a new deliver order is used to trigger the ProductionAirdrop trait.

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

No branches or pull requests

8 participants