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

Used pressure crystals: credit value scaling with explosion power #15933

Merged

Conversation

kbsmilk
Copy link
Contributor

@kbsmilk kbsmilk commented Sep 21, 2023

[GAME OBJECTS] [SCIENCE] [FEATURE]

About the PR

  • Pressure crystals, an item used to measure explosion power, can be sold via cargo crate. Their value is based on last measured explosion power, with this (subject to change) formula: credits = explosion_power ^ 1.1 * 100
  • A bounty system for pressure crystals. Try to match the requested measurement! Get closer, get richer.
  • A PDA program is added to Science PDAs. It tells the value of crystals previously sold, and also lists the bonus bounties.
  • Credit value diminishing returns. A sale impacts the market value of similar crystals. An identical crystal to a previous sale bottoms out at 0 credit value; however, less similar crystals smoothly scale to the normal value.
  • You can't stack multiple crystals on an epicenter to duplicate results.
  • You can stack simultaneous explosions to gain more power, but diminishingly. Each successive explosion is compared to the current measurement, and the lowest of the pair is square rooted, then summed.
  • Crystal resupply crates added to the QM console. You can already get more crystals with vendomat resupply cartridges, but a special crate is +convenience.
  • +Some code readability and grammar and kiloblast

Why's this needed?

Fun and purpose for toxin lab. They can contribute to the budget, but they have to go do field work and expend lab equipment. Also pressure crystals report real explosion power now, to compare results and do Science™
Can also deliberately test detonate artifact bombs, for reliably more credit value than selling it.

Developers please tweak and change all the balance values you want.

There are some defines at the top of shippingmarket.dm for balance tweaks.

Here's some reference credit values with the formula: explosion_power ^ 1.1 * 100 = credits

  • 5 (welding fuel pipe bomb): 587 credits
  • 12.5 (black powder pipe bomb assembly): 1609 credits
  • 87.89 (low end artifact bomb): 13,750 credits
  • 192.516 (350u black powder in a barrel): 32,577 credits
  • 194.45 (maxcap ttv estimate): 32,937 credits
  • 337.64 (low end devastating artifact bomb): 60,436 credits
  • 7000 (mega canister bomb estimate): 1,696,710 credits

Changelog

(u)Smilg
(*)Pressure crystals from Vendomats, when used, can now be sold for credits via Cargo. Work in Toxins today!
(+)New program for Scientist PDAs that shows you previously sold pressure crystals, and their bounties.

@github-actions github-actions bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 21, 2023
@keywordlabeler keywordlabeler bot added A-Game-Objects The point of this PR is to deal with a specific game object C-Feature A new feature or enhancements to existing features A-Science Deals with Artifacts, Telescience, or the department labels Sep 21, 2023
@CheffieGithub
Copy link
Contributor

CheffieGithub commented Sep 21, 2023

Damn a real use for toxins, maybe we need a proper explosives testing platform now. Is there anything stopping someone stacking 10 of these on a tile for one blast?

@kbsmilk
Copy link
Contributor Author

kbsmilk commented Sep 21, 2023

Damn a real use for toxins, maybe we need a proper explosives testing platform now. Is there anything stopping someone stacking 10 of these on a tile for one blast?

Yes. Stacking doesn't work (i hope). You CAN harvest the same explosion with multiple crystals by doing this: line them up one per turf, in a line leading away from the epicenter. But by nature, each further crystal receives much less explosive power. (fixing this is beyond my ability, but it's also not that bad)

Comment on lines +554 to +557
boutput( user, "The reader reads <b>[crystal.pressure]</b> kiloblast." )
else
boutput( user, "The reader reads a firm 0. It guilts you into trying to read an unexploded pressure crystal, and seems to have succeeded. You feel ashamed for being so compelled by a device that has nothing more than a slot and a number display.")
boutput( user, "The reader reads a firm 0. It guilts you into trying to read an unexploded pressure crystal, and seems to have \
succeeded. You feel ashamed for being so compelled by a device that has nothing more than a slot and a number display.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I know these didn't have them before but they probably should have style classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

planning to atomize the bulk of the pressure sensor stuff into another pr

Comment on lines 516 to 518
desc = "A pressure crystal. We're not really sure how it works, but it does. Place this near where the epicenter of a bomb would be, \
then detonate the bomb. Afterwards, place the crystal in a tester to determine the strength.<br>\
Spent pressure crystals can be sold to researchers on the shipping market, for a credit sum depending on the measured power."
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems... really verbose. Should some of this be moved over to a help message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh forgot about those, good point. It is done

@@ -529,9 +551,10 @@ TYPEINFO(/obj/item/device/transfer_valve/briefcase)
boutput( user, "<b>There's no crystal in this here device!</b>")
else
if(crystal.pressure)
boutput( user, "The reader reads <b>[crystal.pressure/25]</b> kilojoules." )
boutput( user, "The reader reads <b>[crystal.pressure]</b> kiloblast." )
Copy link
Contributor

Choose a reason for hiding this comment

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

What is a kiloblast?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A nonexistent unit (just like joules in _units.dm) :)
Anyway I looked into explosion power unit -> Joule conversion, but it is not worth it. So kiloblast is just 1:1 with an explosion's power value instead

@TobleroneSwordfish
Copy link
Contributor

This seems really neat, but the problem especially with TTVs is that if you can make one then you can make 20. A good solution to this might be giving diminishing returns for values close to previously shipped crystals, ie on selling a crystal, go through each previously shipped crystal and scale down the new profit value by the inverse of the distance between them.
Also in general I think the values are a little high, but that would be less of an issue with diminishing returns.

@TobleroneSwordfish
Copy link
Contributor

Alternative idea from dev chat: make it like requisitions where you get an order for a particular value of pressure crystal and are paid based on how close you get to it (and maybe also how high the value is?)

@kbsmilk
Copy link
Contributor Author

kbsmilk commented Sep 23, 2023

This seems really neat, but the problem especially with TTVs is that if you can make one then you can make 20. A good solution to this might be giving diminishing returns for values close to previously shipped crystals, ie on selling a crystal, go through each previously shipped crystal and scale down the new profit value by the inverse of the distance between them. Also in general I think the values are a little high, but that would be less of an issue with diminishing returns.

Only after making this PR did I learn that the valve is mechscannable. I'd been guessing the time economy on manufacturing, setting up the test area, etc. would be comparable to what Cargo can do in the same time. Then Emily's cargo update went in today, lol

I agree with diminishing returns on similar values. It's just gonna take me a while to puzzle through the math. Maybe I'll try something simpler like pregenerating a list of ranges w/ scaling multipliers, and fitting sold crystals into those

edit: hang on, this range list idea actually makes it super simple to make faux-requisitions, too... just increase the value of a few random ranges, and send a paper listing them to cargo, all on round start!

@github-actions github-actions bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 24, 2023
@kbsmilk
Copy link
Contributor Author

kbsmilk commented Sep 24, 2023

Scope creep has arrived on scene. Please check out the newly updated PR description

code/modules/economy/shippingmarket.dm Outdated Show resolved Hide resolved
code/modules/economy/shippingmarket.dm Outdated Show resolved Hide resolved
@@ -1,6 +1,13 @@
#define SUPPLY_OPEN_TIME 1 SECOND //Time it takes to open supply door in seconds.
#define SUPPLY_CLOSE_TIME 15 SECONDS //Time it takes to close supply door in seconds.

#define PRESSURE_CRYSTAL_VALUATION_FORMULA ** 1.1 * 400 /// The full explosion-power-to-credits conversion formula
#define PRESSURE_CRYSTAL_SALES_RANGE_LENGTH 5 /// The span size of each range for the pressure crystal sales list. Measured in explosion power
Copy link
Contributor

Choose a reason for hiding this comment

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

5 power either side is very hard to get right, it'd make more sense to scale it by proximity rather than have a sharp cutoff

proc/appraise_pressure_crystal(var/obj/item/pressure_crystal/pc, var/sell = 0)
if (pc.pressure <= 0)
return
var/index = "[ceil(pc.pressure / PRESSURE_CRYSTAL_SALES_RANGE_LENGTH)]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not really sure what this index system is supposed to be doing, but it's it doesn't seem like it's going to prevent slightly diluting the mix a few times to get different enough values to trick the system. I suggest making it gradually scale by proximity instead, so a lot of similar values will all dilute any more sales in the approximate area.

Shitty MSPaint drawing to illustrate:
image

Copy link
Contributor Author

@kbsmilk kbsmilk Sep 25, 2023

Choose a reason for hiding this comment

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

The index takes a measured pressure and converts it into an integer, which represents a range. e.g. pressure of 27.4 gets fit into the range of 25-30. Then if it gets sold, the index of the 25-30 range gets an entry in the sales list as a key, with its value as a multiplier (rand 0.3 to 0.6)
After that, credit value for pressures in that range receives that multiplier. Which stacks multiplicatively with further sales.

It's not perfect: has a hard cutoff, like you say. But I don't have the knowledge to make the system you're describing.

edit: I should mention, this does have an upside! Concrete ranges w/ values that are visible to players is pretty user-friendly.

@TobleroneSwordfish TobleroneSwordfish merged commit a45e689 into goonstation:master Sep 27, 2023
25 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 27, 2023
@Studenterhue Studenterhue added the E-Add-To-Wiki A PR that will require changes to the wiki label Oct 5, 2023
@TobleroneSwordfish TobleroneSwordfish removed the E-Add-To-Wiki A PR that will require changes to the wiki label Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Game-Objects The point of this PR is to deal with a specific game object A-Science Deals with Artifacts, Telescience, or the department C-Feature A new feature or enhancements to existing features size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants