branchrust_reboot/main/travelling_vendor/dynamic_vendor_pricingcancel
34 Commits over 30 Days - 0.05cph!
Clamp PriceUpdateFrequency
Decouple dynamic pricing entirely from in-game time, now operates off real time
Renamed IntervalHours to PriceUpdateFrequency, defaults to 5 hours (this will also ensure the new defaults roll out next month)
Add npcvendingmachine.addHours for testing now that env.addtime will no longer affect npc vending prices
Added NPCVendingMachine.UseRealTime toggle, will use the system clock instead of the in-game clock when adjusting prices
Recommend adjusting IntervalHours down dramatically when using this option so that prices don't take 5 real time days to adjust (setting this to 5 would match the current behaviour)
If changed at runtime resetDynamicPricing should be called afterwards to resync the pricing to the new clock
This would also have a side effect of making prices adjust while the server is offline - prices will be processed to make up for the missing time when a server is booted up again
Increased the default npc vending machine IntervalHours to 5 in-game days
This means that prices will adjust themselves every 5 in game days, used to be 4 times a day
This should result in more stable prices and smooth out the sharp drop off of prices a week into a monthly wipe
Improve csv exporter to export multiple item data streams at once
Calulate the running average as a double to properly capture averages for small sales amounts
Don't save the previous average with the save data, we can calculate it on the fly
Added a VendorPriceTester editor tool that can crunch analytics data to plot out the discount over time
Clamp npcvendingmachine.intervalHours between 1 and 120 hours
Lowered default maximum price and starting surcharge to 200% (so double the initial price)
Added total lifetime sales and intervals to printAllPriceChanges
Added npcvendingmachine.PriceIncreaseAmount/PriceDecreaseAmount convar to control how quickly the price moves up and down (by default increases 10% and decreases by 5%, used to be 5% both ways)
Fix items rounding down to 0 cost if they had a 50% discount and were only 1 scrap to begin with (RIP free pickles), the minimum cost of an item will always be 1 scrap
Consolidated all of the rounding and clamping to a single method in VendingMachine for easier management of issues like this
Round the price on the vending machine screen correctly
Some minor cleanup in the vending machine screen class
Update printAllPriceChanges to print out current and historical averages
Rework dynamic pricing system
-Track the number of items purchased in a given interval (IntervalHours convar, default 6)
-Track an average number items per interval for each sale
-At the end of an interval, update all prices. If the average has gone up in the prior interval increase the price by 5%, if it was lower or equal reduce the price by 5%
-Make the price start at 300%, so it will naturally tend down at first for a while before it normalises onto the price the market thinks it is worth
-Expose the MinimumPriceMultiplier, MaximumPriceMultiplier and StartingPriceMultiplier
This removes an array of objects per sale order and replaces it with 4 saved numbers, so this is a big simplification
Send price multiplier of sell orders in the data for rust+ (won't be visible for now)
Change default PriceDecreaseAmount to 5% (was 10)
Added npcvendingmachine.printAllPriceChanges, outputs a nicely formatted summary of all of the active price changes on the server (won't show items that don't have a discount/surcharge)
Revert playground to original state
Converted blueprintBaseDef from a field on every vending machine instance into an accessor that just accesses the cached version in ItemManager
Added npcvendingmachine.resetDyanmicPricing convar, resets the state of all discounts and surcharges from NPC vending machines (for testing)
Fixed map marker info not being properly updated when updating dynamic pricing
Formatting change on map vendor
Fixed dynamic pricing not being applied
Tooltip can now accept arguments for string substitution, similar to RustText
Added a tooltip to the discount/surcharge icons that lists the original purchase price
Using the addtime convar now immediately force updates all npc vending machines
Added a BypassDynamicPricing option to the NPCVendingMachine component, allows us to opt out specific vending machines
Added npcvendingmachine.DynamicPricingEnabled convar, disables the dynamic pricing across the whole server
Fixes, move the price multiplier UI element into it's own widget so we can just nest it into various vending UI's
Add price multiplier to vending UI when clicking on a store on the map
Implemented a dynamic NPC vending price system based on sales in a rolling window
-Prices are increased when an item is sold a certain amount of times in an in-game day (PriceIncreasePerSalesInterval and PriceIncreaseAmount control this behaviour, so if they were set to 3 and 0.1, for every 3 purchases of an item in a 24 hour window the price will increase 10%). The rolling window is configured via the IntervalHours convar and defaults to 24
-Prices are decreased if an item isn't sold for a certain amount of hours (PriceDecreaseInterval and PriceDecreaseAmount, so if they were set to 3 and 0.1, every three hours the price of the item will drop by 10%)
Currently clamped between a 50% discount and a 300% price increase
Currently only applies for purchases that are made using scrap as the currency
Updated the in-person vending machine UI with a UI indicator displaying the current discount/surcharge, the dozen other places we show vending machine prices still need updating
All time and discount values are currently using the examples provided above, they are just for testing and will be changed
Initial work on tracking the sales of each sell order in an NPC vending machine over a 24 hour period