BentoBoxWorld / Level

Add on for BentoBox to calculate island levels for BSkyBlock and AcidIsland. Please read the Wiki!
Eclipse Public License 2.0
24 stars 32 forks source link

Add an option for increasing point requirements per level with each level-up #274

Open Sapokee opened 1 year ago

Sapokee commented 1 year ago

Is your feature request related to a problem?

No, this is a result of me tampering with the levels system in hopes of integrating it into a MMO-style leveling system. I'd like to make the player's MMORPG level the island level, by connecting it to a plugin like MMOItems or something of the sort.

That way, players are incentivized to level up their island to unlock new weapons, tools, bosses, dungeons, quests, anything you can think of, instead of having to connect it to mcMMO and have give players no reason to place blocks on their islands.

You can already use the %Level_[gamemode]_island_level% placeholder for integration into the MMO plugin, but the constant level growth means that they can just get a butt ton of blocks and level up hellishly quickly, or even get blocks from other players, which gives them an early advantage, which takes away all the fun of going through the progression.

Describe the solution you'd like.

What I'm suggesting is that an option be added in the levelcost section. Here's how I think this could be implemented:

# Value of one island level. Default 100. Minimum value is 1.
levelcost: 100
next-levelcost: levelcost + (x*levelcost)/100

...where x is the percentage you wanna multiply the next levelcost by. That way, if level 2 requires 100 points, and you want level 3 to require 150 points, you could do this:

next-levelcost: levelcost + (50*levelcost)/100

...therefore making each level 50% harder to reach than the previous.

Obviously, this would make use of the equations used in the level-calc setting, so you could make the next level exponentially harder to get to, or just about any mathematical function you need for your purposes, not just a percentage. And if you want levels to be obtained at a constant rate, you just do this:

next-levelcost: levelcost

That way it's entirely togglable and would not inhibit any existing servers using this system, and hell, constant leveling could easily be the default, and anyone that is in this feature's use case can easily find it and implement it, should they need it.

Describe alternatives you've considered.

I have considered putting a limit on how many blocks of a certain type someone can place on their island, to make leveling harder the more blocks you place.

So at a certain point you've placed all the diamond, emerald, gold, lapis, redstone, iron (you get the idea) blocks that you are allowed to (within the predefined limits), and now you have to rely on blocks that are worth like a 10th of a level, but that would also mean that people who are in the endgame can just give the blocks they don't need away, or sell them (cause they can't place them, what the hell are they gonna do with them), thus getting them into the hands of newer players, which is the whole thing I was trying to avoid in the first place.

Certainly, this doesn't mean people won't sell their blocks, but at least this way there's a much smaller chance that they will, because every block matters, and people will have less of a reason to give their blocks away because it means they're gonna reach the next level slower.

Agreements

Other

A small auxiliary feature to this, maybe a "total points" placeholder to compliment it? So you can see how many total points you have so far.

So if level 0 -> level 1 = 100 points, and level 1 -> level 2 = 150 points, you could have a placeholder to indicate that a player at level 2 has 250 points total (plus whatever intermediary value they have, if they're not at level 3 yet but working their way towards it). That would be nice.

Thank you for reading!

tastybento commented 1 year ago

Aha. Yes, this can be done using the level-calc formula, if you know what formula you need. If we use your example of making each level 50% harder to reach than the previous level, then the approximate formula for that is:

level-calc: 2.4661 * log(blocks) - (2.4661 * log(level_cost) - 1)

where level_cost is the cost in blocks to get to level 1. e.g., if level 1 costs 100 blocks, the level 2 costs 150 blocks, level 3 costs 225, etc.

Here's the graph:

Screenshot 2023-01-16 at 9 57 23 PM

Note that that particular formula does start to asymptote around level 25, i.e., it becomes really hard to get to level 26 or 27 because so many blocks are required, so having that particular rule might not be that good an approach because eventually almost everyone will end up with the same level.

That said, although I added sin, tan, and sqrt to the formula parsing, I didn't have log, so I've added it now. You can download the snapshot here.

Anyway, although I understand what you're asking, the level-calc formula should actually be able to provide what you want so long as it supports the right formula. Having the next-levelcost is problematic from a programming standpoint because the level calculations would have to be done iteratively instead of by just applying a single formula to the blocks counted. I can't quite work out how to do that right now but I do know that the current method of having a formula for how you want levels increased does work for sure.

How can I work out a formula for levels?

The best way is to start with a formula and plot it to see if it makes sense, e.g., by using something like Excel. If you want to work out what formula you need from say a table of values, then Excel (or maybe some other spreadsheet) can do that too: make a graph of levels and how many blocks for each level and then plot a graph of the table (X Y Plot). Right click the graph to add a trend line, select the approximation, e.g., linear, log, exponential, etc. that best fits, and then select "Display equation on chart" to display the formula and substitute blocks for x. Here's some screenshots of what I did you find out the equation for increasing by 50% each time with a starting cost of 100 blocks.

Screenshot 2023-01-16 at 10 21 58 PM Screenshot 2023-01-16 at 10 22 20 PM

So, for that, it would be:

level-calc: 2.4661 * log(blocks) - 10.357

I hope that helps.

tastybento commented 1 year ago

I just merged in #264 that adds a total points placeholder.

BONNe commented 1 year ago

Tasty, can I add your comment in docs page?

tastybento commented 1 year ago

Yes, absolutely.

Sapokee commented 1 year ago

Thank you! I didn't think of the problem this way, I think using "blocks" as the word for "total points" was a little unintuitive for me and I didn't realize soon enough. This is great, I've also found your tutorial on graphing a function to be perfect, I've been able to recreate the 50% increase (for the record, it's y = 66.667 * e^(0.4055x) ). This can be closed at any point, thanks again for all the support.