jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

Global player balance #175

Open jpcsupplies opened 7 years ago

jpcsupplies commented 7 years ago

Look into the possibility of reading/writing a special file in the economy data folder. This file is managed by a 3rd party application which retrieves a given players bank balance from a website and populates that on the current server using one of those special files. It also needs to report changes back to a file that the tool then updates the web based balance with. Could probably use basic html post/get functionality combined with some sort of security token to prevent people tampering with the balances.

Data file format: steamid, balance

Would need security on both the local files and the data being sent to the website.

This would be an option feature. If it is enabled - then on connect the server would create a query file, the 3rd party app would then pull the players balance down from the website and that is created as the players balance. Likewise changes to player balance (buys/sells/trade zone transactions) would write to the export file to update the server balance.

If the webserver goes down the game still works ok, just transactions build up in the export file, and we never get balance updates back - so it runs off local data. Or something along those lines.

jpcsupplies commented 6 years ago

Other misc thoughts. Steam forces a player to play only one game/server at a time. So - Get player balance from global server on connect + Update player balance on global server on disconnect

Should work reasonably well theoretically. Only catch may be if player insta travels to another map and the get balance request completes on new server before the old server sends the update balance. Potentially causing money to be lost (or gained) depending what changes to their balance occured on the old server...

Seems I may have to think about this some more..