The-Frozen-North / tfn-module

A persistent world set around Neverwinter and the Wailing Death, with content from HotU and NWN2
https://github.com/b5635/the-frozen-north/wiki
GNU Affero General Public License v3.0
31 stars 23 forks source link

Treasure map update, stats database migration and performance tweaks #789

Closed Logg-y closed 11 months ago

Logg-y commented 11 months ago

I don't truly know if this is ready to merge. In any case, the /server/database needs processing with the python script before restarting the server after merging this, and taking a full backup of both this and the servervault (for the sake of the maps changes) on the offchance that something blows up would be sensible. It seems to work okay on my end, though testing the map data transference is a little hard.

(I am happy to run the script and do this, it'd just be nice to have more eyes on the sqlite madness before merging!)

The DB caching with multiple PCs logged in is untested, because I can't really test it. It looks to work fine for one player though.

... and as usual, update notes:

Treasure map changes:

Treasure maps are now made up of two parameters. The CR (which governs loot level) and difficulty (which governs zoomed-in level). Before now, maps had only a CR, and both loot level AND zoomed-in level were tied together.

Existing maps are migrated to this new system based on their CR values and assigned a difficulty reflective of their zoomed-in-ness. Most maps will likely change their zoomed-in level slightly, but the displayed location should not have changed.

Both of these things affect loot quality. Looting a map is guaranteed to give you loot like you killed a boss in the area where you got the map, and then a bit more lesser loot. High difficulty maps are more likely to give you more boss-level rolls (which have much better odds of giving you better items).

Maps obtained from common loot (specifically this excludes Andriel and maps that generate inside map rewards containers) are now quite likely to have a solution somewhere in the areas around where you obtained them. This is not a guarantee, and there is still a reasonable chance that they might send you a long way away.

Andriel's maps always pick locations completely at random, and are now biased very heavily towards high difficulty (zoomed-in), whereas the regular drops are not. The intent is that Andriel is for those who enjoy the maps and are prepared to spend gold to get more of them - and this audience is probably better able to deal with the more difficult maps.

CR for treasure map loot is no longer increased by 50%.

Reduced the item to pure gold conversion rate from 100% to 80%.

Increased the value (and Andriel cost) of treasure maps.

Added a new flat chance to add another treasure map to the loot from existing treasure maps.

Player stats:

Optimised the player stats database writes. While the live server seemed to be fast enough to handle this okay, my local computer is not :(

Fixed the issue that caused the player stats for "Attacks of Opportunity Missed" and "Attacks of Opportunity Missed By" to merge into a single count.

b5635 commented 11 months ago

Looks good overall!

I really like the cdkeyvars library that was added, I think that will be quite helpful in recording data versus using campaign functions. In the future it may be helpful to add in some helpers that can do away with writing raw SQL statements, maybe something like COUNT and etc.

The big takeaway is that this should make the player statistics much more performant, so thank you :)

We can backup everything before it goes live in case there are any issues