Path-of-Terraria / PathOfTerraria

GNU General Public License v3.0
1 stars 3 forks source link

[PROJECT] Drop System & Updates #486

Open CollinHerber opened 2 hours ago

CollinHerber commented 2 hours ago

Summary

The drop and item acquisition system is THE MOST important system of any ARPG and I'm hoping to simplify yet make it expandable to the best of my ability without going to deep too quick.

Here is a rough draft of my ideas for the drop system.

image

Drop Type (Red Section)

The drop type is split into each of our "Categories" of items within the game. Right now that is Currency, Maps, and Gear. As a starting point we can do something like 5% Map, 80% Gear, 15% Currency

This means that when the game decides to drop a PoT related item, it drops them with those percentages.

However these percentages can be manipulated by certain "events" or "areas" that you are in. For example Maps will could have an affix on them that is something like "50% Increased Chance of Map Drops"

image

These won't exclusively be manipulated by affix on maps, but there may be certain areas of maps themselves that have modifiers to the items dropped in them. Such as the EoW domain might drop more currency or something. Building in a way where it takes these areas into account will be important.

Determining Type / Tier (Green Section)

As apart of this new drop system we will need to have a weighting system to each of the gear types. This is where staticData.DropChance comes into place. Right now just about everything is set to 1f so everything drops about the same rate. However this will be adjusted so higher tier things drop less frequently, or some uniques are much more rare.

This system will have no ways of manipulating the set weighting systems at this time. I doubt we'll add anything that the player can do to sway these weights but we'll leave it possible as it is now for future implementation.

Determining Rarity (Pink Section)

Now that we have determined WHAT is going to drop, we need to choose the rarity. This is determining if the item will drop normal, magic, or rare. I think SpawnItemFromList is doing something like this from ApplyRarityModifier however it's only being applied from the command and I don't think there is any sources of "Rarity of Items" modifiers that we will want to introduce at some point. It's probably something we can revisit later when we get deeper but wanted to get this concept in writing so we have something to fall back on.

Conclusions

In reality the only portion we are needing now is the red section, which is determining what to drop. Right now it's just throw everything into a giant pool and pick something at random. We need to be a bit more precise in what is dropping otherwise as more items get added, map and currency drops become arbitrarily more rare

Reasonings

Needing to bring the drop system up to par with the mod

CollinHerber commented 2 hours ago

I think as apart of this effort, it would be a good idea to make a drop simulator so we don't need to spawn in a ton of items filling inventory to test things and we can visualize it in a better way to make making adjustments much easier in the future.

Threw together this simple graph

image

Basically just able to put in all the inputs and have a table of everything to view. Is a scrollable table like this possible?

GabeHasWon commented 1 hour ago

A scrollable table is easily possible, though I'm not exactly sure what this image is conveying. Would it be like, the top %'s and #'s are filled out, click the Go Button, and it'll list the drops by: Name | Count | NormalCount | MagicCount | RareCount | IsUnique or similar? So something like: Iron Bulwark | 20 | 15 | 4 | 1 | False? Repeat for every item of course.

As for the basic idea, this would streamline the really messy drop system we currently have a lot. The amount of files or things that do or do not happen if done in specific ways is untenable and should be absolutely changed.

A few questions:

  1. I assume all "Modify X drop rate" affixes or modifications would be, unless otherwise stated, per-player? Excluding map affixes for obvious reasons. If it is per-player, how would we determine what affix(es) apply to the loot? Last player who hit the NPC? Any player who hit the NPC?
  2. Would we want tMod-like hooks for all relevant things? Maybe excluding the above UI since it's debugging, but having hooks for modifying drop rates for all types, rarity rates, etc etc would be nice, especially for other mods to use and do whatever with if they wish. This may also simplify how we apply it in-house.
  3. For the red section drop rate normalization - is that strictly necessary? If we report the rates to the end user in release, it'd be necessary as reporting rates that are clearly over 100% doesn't make sense. If that's the case, ignore the rest of this numbered question. If not, internally we'd likely use a WeightedRandom which would function the same if we normalize the chances.