twohoursonelife / OneLife

Two Hours One Life, building upon One Hour One Life. Join us on Discord to play.
https://twohoursonelife.com
Other
46 stars 39 forks source link

Written notes/stones etc are being overwritten by information from other notes #243

Closed TanyaPegasus closed 1 month ago

TanyaPegasus commented 1 month ago

Players are reporting that writing on notes, stone blocks with writing, graves etc are changing to show the writing of other players on the server (eg. a talking stone in the farm originally showing a crop name, now changes to shows the grave message of a player in another town).

Log message at server startup indicates that there are 16383 entries in meta.db, which is the maximum number of entries as indicated by comment on line 10 of objectMetadata.cpp https://github.com/twohoursonelife/OneLife/blob/2d0f3c328beb6ac4db547fe0ccab0868b879df5e/gameSource/objectMetadata.cpp#L10

maxMetaID is set when the server starts up by iterating over all records in meta.db and using the number of records as the ID https://github.com/twohoursonelife/OneLife/blob/62bbd28cf8c91328371d54774f96faf05abeffce/server/map.cpp#L2749-L2776

After this, getNewMetadataID is called, which sets the value to 1 if the number is higher than the max possible https://github.com/twohoursonelife/OneLife/blob/2d0f3c328beb6ac4db547fe0ccab0868b879df5e/gameSource/objectMetadata.cpp#L48-L57

This means that each time the server has been restarted since meta.db reached the maximum, the next ID would have once again been reset to 1, and this would explain the player reports.

Link to the bug reports on Discord https://discord.com/channels/423293333864054833/1270315820920340555

mtklass commented 1 month ago

Great find! It really feels like the best thing would be if object IDs and metadata IDs were each their own 32-bit integer. Seems like it would have some major ramifications though…

connorhsm commented 1 month ago

The ramifications of that would outweigh our use case. This is currently our longest lasting map of 13 months, following the prior one suffering to the DB files reaching the full signed 32 bit int maximum as per https://github.com/twohoursonelife/OneLife/pull/224

The reality is that at about a year, the map is reaching its limits.

We're going to consider options such as erasing the first 4K of total 16K notes to buy us some time.

connorhsm commented 1 month ago

Resolved as part of https://github.com/twohoursonelife/OneLife/pull/245

We have tooling to monitor the current max ID and have implemented reading and writing the next ID to a file, instead of the problematic method of searching where to pickup from at server start.