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

ArCargo: Adds the Galactic Materials Stock Market V1.2 (Free Market Edition) #78500

Merged
merged 30 commits into from Sep 30, 2023

Conversation

ArcaneMusic
Copy link
Contributor

About The Pull Request

This PR is a rerelease of #78164, with some bells and whistles. As such, most of the core functionality is the same, but with some tweaks to balance the gameplay and prevent bike levels of profit. I've tried to bold the new additions to make it easier to read for those coming back for the second pass.

image
This PR adds a new machine that can be bought called the Galactic Mineral Market (GMM). The Galactic Mineral Market (GMM) allows you to buy and sell minerals wholesale from the market machine. It goes something like this:

1. Getting the Machine:

The GMM can be bought as an un-assembled machine for 600 credits from cargo. It's a low cost, but its not mapped in standard, so if you're confident in your miners, you shouldn't necessarily need one for the department. Otherwise, it's available for other crewmembers to buy for cost.

The cargo pack comes will all supplies necessary to finish the machine. Tools not included.

2. Buying Low

Using the machine's UI, you can see all traded minerals and their associated prices. Buy prices are played straight, and can be bought for material price, times the quantity. The order is then instantly placed on the cargo shuttle, and will be deducted from the buyer's account on shuttle send. A single order can only have 10 different stacks of materials in it. So, that can be 100 sheets of iron and 1 of everything else, or 500 sheets of iron. After that you're blocked from buying more sheets until you've sent the order.

Cargo staff with standard cargo access may toggle the machine to order directly from the cargo budget. Otherwise, materials are only purchased from private accounts.

All purchases are treated as private and must be opened by the recipient like private orders.

3. Selling High

It's stocks time. To sell minerals on the market, simply insert any relevant metal stock into the machine. This produces a totally original and not-a-bounty-cube stock block, which can be sold on the cargo shuttle for cargo funds. Stock blocks can also be price-tagged as well following their standard process.

Stock blocks start out a bright pink and are worth the value of that material at that time, but over time their color will degrade. After a full 5 minutes, stock blocks will switch over to a purple hue, and their value will once again become liquid, subject to the current market value. This encourages players to be a bit more fast on their feet than before instead of just waiting forever for all of their investments to arrive at the perfect value, before the inevitable "rest of the game" tries to upend your investing.

Sold cargo stocks are subject at a 20% processing fee as part of the galactic mineral market.

4. Outside Factors

In-game events like the Crab-17 or the Market crash event will cause stocks to bottom out completely, and for the market to become unavailable until the market stabilizes. Thankfully, once the market has crashed, typically stocks will recovery and gain back some value, allowing for fast acting market movers to capitalize on rough markets.

Additionally, low value materials like iron and glass have an extra stipulation, as their value goes all the way down to 0 credits. In that case, you are unable to buy them at that value as a market protection. Be careful that you don't see a reset or crash when you're planning on selling your horde of iron and glass stocks!

Additionally, market events can occur during the round that can more sharply adjust a single stock's price and completely rebound it's trajectory. These events are always mentioned in the station announcement's economics report.

Other notes:

The market does not cover all minerals, partially for consistency purposes as well as for balance reasons. Plasma, being a unique material that only Nanotrasen has their hands on, is the sole exporter of plasma in the system, so it stands to reason that it's not on the market, and remains a solo export. Bananium, as it has a rare and expensive conversion rate, works the opposite way, and as such isn't listed on the market either, with the sole source being single cargo sales. All others just don't make much sense to include into the market at this second, so I left them out for now.

Alright now below I'm going to cover the math and shit so if that's not what you care about then please scroll past.

Warning: Arcane is about to talk about the math Alright. So this adds a new stock_market subsystem, which fires once every 20 seconds. I'm still fairly new to subsystem design so I'm probably going to need some feedback on cleaning this up to make it look nicer and run smoother.

So we have 4 associated lists, each attached to the relevant traded datum; this tracks prices, market trends, how long that trend is going to last in SS fires, and market quantity.

Prices fluctuate between 0.5x and 3x the material's single sheet value. This could be tweaked even farther in the future, but for now I'm keeping it at this nice clean margin. Prices fluctuate based on a gaussian normal distribution that is centered on different points based on their trend. Upward trending materials are centered in such a way that they'll almost certainly go upwards, but being that it's based on a random chance, not always. Vis versa, downward trends should tend to lose value at about the same rate. We also change our rounding based on this trend data, in order to prevent low price values like iron and glass from getting stuck in the same value or freefall drop over time just because of rounding down. Similarly, neutral trending materials will not change nearly as much, and will generally stay at around the same amount.

When buying or selling a material, the quantity of that material will change on the market. The magnitude of that change depends on how much of that material currently exists on the market. Buying a low quantity material like diamond for example will tangibly increase that material's cost, while buying stacks and stacks of iron and glass won't do much damage to the price of iron as there's usually around 500 full stacks on the market to start with. It's applied at a relative percentage of (qty_changed / new_total_on_market) * price of goods bought/sold at.

In addition to that, there are random "market events" that can occur randomly, which you might miss if you don't follow the newscaster economy news. These three events are fairly barebones now, but in general they have a 1% chance of happening per material, and can more dramatically increase, decrease, or fully reset the value of a material on the market back to it's standard value. This opens up for doing more with it in the future, but that's a later problem.

Why It's Good For The Game

This independently resolves some issues related to #78040, that being that lowpop stations, or shifts with few miners would have a new way to be able to still get some access to minerals in a given round. This also provides a unique minigame and alternative way to acquire money in a given shift, using minerals.

"But Arcane, I hear you ask. "Isn't this just the same thing you tried doing way back when and then reverted in #50537?
Well, fuck man, how you doing I haven't see you around in forever also no you're completely wrong and here's why

This PR is no longer contingent on the rest of ArcMining in it's current iteration. I have introduced some extra factors into the gameplay as well to try and curb the creation of bikes within gameplay. This also provides a massive benefit to round progression and gives the QM and the cargo members the ability to prevent round progress from stalling by buying round-critical resources.

Not to mention, as the GMM is not cargo required, more cargo integrated, it also functions as economy content for the rest of the crew.

Changelog

🆑
add: A new export has arrived in the imports section, the Galactic Materials Market! You can use this to buy and sell minerals for profit or cost, as well as stock your station when you don't have any miners.
add: Insert sheets of minerals into the Galactic Materials Market to convert them into a stock block, allowing you to lock in your price for 5 minutes. Wait too long and it'll be subject to market value again!
add: Minerals can be bought on the market either using the station's cargo budget by cargo crew, or privately by everyone else.
del: Any material stacks that can be bought and sold on the market before have been removed from the cargo catalog.
/:cl:

ArcaneMusic and others added 27 commits September 3, 2023 01:23
Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
@tgstation-server tgstation-server added Sprites A bikeshed full of soulless bikes. Feature Exposes new bugs in interesting ways Removal This was too fun, too fun! I'm turning this feature around UI We make the game less playable, but with round edges labels Sep 22, 2023
@Dawnseer
Copy link
Contributor

Can't wait to crash the ore market with no survivors

@github-actions
Copy link
Contributor

github-actions bot commented Sep 25, 2023

This pull request was test merged in 128 round(s).

Round list

terry

@Farquaar
Copy link
Contributor

@ZephyrTFA ZephyrTFA merged commit 9073290 into tgstation:master Sep 30, 2023
19 checks passed
comfyorange added a commit that referenced this pull request Sep 30, 2023
github-actions bot added a commit that referenced this pull request Sep 30, 2023
Jolly-66 pushed a commit to TaleStation/TaleStation that referenced this pull request Oct 2, 2023
…et V1.2 (Free Market Edition) (#7983)

Original PR: tgstation/tgstation#78500
-----

## About The Pull Request

**This PR is a rerelease of #78164, with some bells and whistles.** As
such, most of the core functionality is the same, but with some tweaks
to balance the gameplay and prevent bike levels of profit. I've tried to
bold the new additions to make it easier to read for those coming back
for the second pass.


![image](https://github.com/tgstation/tgstation/assets/41715314/ff9bf038-524d-44fc-81bb-c6ff97fef6dd)
This PR adds a new machine that can be bought called the **Galactic
Mineral Market** (GMM). The Galactic Mineral Market (GMM) allows you to
buy and sell minerals wholesale from the market machine. It goes
something like this:

### 1. Getting the Machine:
The GMM can be bought as an un-assembled machine for 600 credits from
cargo. It's a low cost, but its not mapped in standard, so if you're
confident in your miners, you shouldn't necessarily need one for the
department. Otherwise, it's available for other crewmembers to buy for
cost.

The cargo pack comes will all supplies necessary to finish the machine.
Tools not included.

### 2. Buying Low
Using the machine's UI, you can see all traded minerals and their
associated prices. Buy prices are played straight, and can be bought for
material price, times the quantity. The order is then instantly placed
on the cargo shuttle, and will be deducted from the buyer's account on
shuttle send. **A single order can only have 10 different stacks of
materials in it. So, that can be 100 sheets of iron and 1 of everything
else, or 500 sheets of iron. After that you're blocked from buying more
sheets until you've sent the order.**

Cargo staff with standard cargo access may toggle the machine to order
directly from the cargo budget. Otherwise, materials are only purchased
from private accounts.

All purchases are treated as private and must be opened by the recipient
like private orders.

### 3. Selling High

It's stocks time. To sell minerals on the market, simply insert any
relevant metal stock into the machine. This produces a totally original
and not-a-bounty-cube stock block, which can be sold on the cargo
shuttle for cargo funds. Stock blocks can also be price-tagged as well
following their standard process.

**Stock blocks start out a bright pink and are worth the value of that
material at that time, but over time their color will degrade. After a
full 5 minutes, stock blocks will switch over to a purple hue, and their
value will once again become liquid, subject to the current market
value. This encourages players to be a bit more fast on their feet than
before instead of just waiting forever for all of their investments to
arrive at the perfect value, before the inevitable "rest of the game"
tries to upend your investing.**

Sold cargo stocks are subject at a 20% processing fee as part of the
galactic mineral market.
### 4. Outside Factors

**In-game events like the Crab-17 or the Market crash event will cause
stocks to bottom out completely, and for the market to become
unavailable until the market stabilizes. Thankfully, once the market has
crashed, typically stocks will recovery and gain back some value,
allowing for fast acting market movers to capitalize on rough markets.**

**Additionally, low value materials like iron and glass have an extra
stipulation, as their value goes all the way down to 0 credits. In that
case, you are unable to buy them at that value as a market protection.
Be careful that you don't see a reset or crash when you're planning on
selling your horde of iron and glass stocks!**

Additionally, market events can occur during the round that can more
sharply adjust a single stock's price and completely rebound it's
trajectory. These events are always mentioned in the station
announcement's economics report.

### Other notes:
The market does not cover all minerals, partially for consistency
purposes as well as for balance reasons. Plasma, being a unique material
that only Nanotrasen has their hands on, is the sole exporter of plasma
in the system, so it stands to reason that it's not on the market, and
remains a solo export. Bananium, as it has a rare and expensive
conversion rate, works the opposite way, and as such isn't listed on the
market either, with the sole source being single cargo sales. All others
just don't make much sense to include into the market at this second, so
I left them out for now.

**Alright now below I'm going to cover the math and shit so if that's
not what you care about then please scroll past.**
<details>
  <summary>Warning: Arcane is about to talk about the math</summary>
Alright.
So this adds a new stock_market subsystem, which fires once every 20
seconds. I'm still fairly new to subsystem design so I'm probably going
to need some feedback on cleaning this up to make it look nicer and run
smoother.

So we have 4 associated lists, each attached to the relevant traded
datum; this tracks prices, market trends, how long that trend is going
to last in SS fires, and market quantity.

Prices fluctuate between 0.5x and 3x the material's single sheet value.
This could be tweaked even farther in the future, but for now I'm
keeping it at this nice clean margin. Prices fluctuate based on a
gaussian normal distribution that is centered on different points based
on their **trend**. Upward trending materials are centered in such a way
that they'll almost certainly go upwards, but being that it's based on a
random chance, not always. Vis versa, downward trends should tend to
lose value at about the same rate. We also change our rounding based on
this trend data, in order to prevent low price values like iron and
glass from getting stuck in the same value or freefall drop over time
just because of rounding down. Similarly, neutral trending materials
will not change nearly as much, and will generally stay at around the
same amount.

When buying or selling a material, the quantity of that material will
change on the market. The magnitude of that change depends on how much
of that material currently exists on the market. Buying a low quantity
material like diamond for example will tangibly increase that material's
cost, while buying stacks and stacks of iron and glass won't do much
damage to the price of iron as there's usually around 500 full stacks on
the market to start with. It's applied at a relative percentage of
(qty_changed / new_total_on_market) * price of goods bought/sold at.

In addition to that, there are random "market events" that can occur
randomly, which you might miss if you don't follow the newscaster
economy news. These three events are fairly barebones now, but in
general they have a 1% chance of happening per material, and can more
dramatically increase, decrease, or fully reset the value of a material
on the market back to it's standard value. This opens up for doing more
with it in the future, but that's a later problem.
</details>


## Why It's Good For The Game

This independently resolves some issues related to #78040, that being
that lowpop stations, or shifts with few miners would have a new way to
be able to still get some access to minerals in a given round. This also
provides a unique minigame and alternative way to acquire money in a
given shift, using minerals.

**"But Arcane,** I hear you ask. **"Isn't this just the same thing you
tried doing way back when and then reverted in #50537?**
Well, fuck man, how you doing I haven't see you around in forever also
no you're completely wrong and here's why

**This PR is no longer contingent on the rest of ArcMining in it's
current iteration.** I have introduced some extra factors into the
gameplay as well to try and curb the creation of bikes within gameplay.
This also provides a massive benefit to round progression and gives the
QM and the cargo members the ability to prevent round progress from
stalling by buying round-critical resources.

Not to mention, as the GMM is not cargo required, more cargo integrated,
it also functions as economy content for the rest of the crew.

## Changelog
:cl:
add: A new export has arrived in the imports section, the Galactic
Materials Market! You can use this to buy and sell minerals for profit
or cost, as well as stock your station when you don't have any miners.
add: Insert sheets of minerals into the Galactic Materials Market to
convert them into a stock block, allowing you to lock in your price for
5 minutes. Wait too long and it'll be subject to market value again!
add: Minerals can be bought on the market either using the station's
cargo budget by cargo crew, or privately by everyone else.
del: Any material stacks that can be bought and sold on the market
before have been removed from the cargo catalog.
/:cl:

---------

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Exposes new bugs in interesting ways Removal This was too fun, too fun! I'm turning this feature around Sprites A bikeshed full of soulless bikes. UI We make the game less playable, but with round edges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants