jpcsupplies / Economy_mod

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

ENH: PURGE LOGIC (WAS API ? STALE LIST?) #6

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 9 years ago

Enhancement list for Pre Alpha Release Potentially some sort of API to permit other mods interacting with this one - Eg, a mod for missions or bounties, or treasure hunting, or "jobs" etc that can add or subtract funds from a given players balance. (and perhaps later that can draw on materials in the global ~~market; eg 3d printer/factory sort of mods)

Stale list: making use of timestamps to move player balances for players not seen for a month or more to a "stalebalances" file ? But need a way to make this file not read unless a stale player rejoins somehow, otherwise it will double our read overhead instead of reduce it.. perhaps only trigger it on the "add default balance to new player" event? or better yet, never automatically trigger it at all, let stale players be added as a new player, but add some "find lost money" command so that (minus default balance) their old balance is transferred back only when a player uses that command.

Potential issues- This may allow negative balances tho- ie player with stale balance 1, joins, spends 50 of their new default balance, then runs the lost money command which then deducts the default balance (eg 100) from their current balance (-50) then adds their stale balance -49)

Stale might overwrite in certain scenarios - Tycoons may make say 1000, then not rejoin until balance is stale , they then rejoin, not use the find lost money command trade up to 2000, then leave and go stale again.. that 2000 once it goes stale should add to the existing stale balance not over write it..

Refer Re:Stale list below

jpcsupplies commented 9 years ago

Screaming Angels pointed out re API: Yes, its possible to have mods talk to one another. We'd have to write it was a server side mod explicitly, and have the clients send requests to the server to centralize all logic, so other mods can communicate with the Econ if need be. We can create our own API also.

midspace commented 9 years ago

We haven't dealt with Mod's talking to one another, but it is quite possible. A number of things have to occur. The Econ mod will have to utilize known interfaces for other mods to interact with. -> Designate an API. The API will have to be publicly accessible (here on GitHub). The API will have to be well documented and easy to use. Part of this will be following know methodologies like Service communication.

  1. A Request object that contains all relevant parameters and details for a request.
  2. An accepted method of serializing the object to send across the communication channel (Currently the Xml Serializer is the only method, but the xml text must be converted to a Byte array).
  3. A known location to send requests to.
  4. Accept and respond to Response objects in the same manner as above, which contain relevant details.
  5. Security. Currently Keen's Message API is open for any message object from any user, allowing any SteamId to be attached. That means messages can be spoofed. It's not advisable to allow communication under those circumstances. You should wait until Keen have updated the communication API with the netcode update.
jpcsupplies commented 9 years ago

There is always the command queue idea i was kicking around, have a textfile other mods can insert commands into, these commands get processed by this script. simple stuff like add x amount to player y, but the mod has a long way to go before I should even think about that in detail yet! :)

jpcsupplies commented 8 years ago

Re: Stale List - this is basically what our account created/last seen logic will in practice result in .. so this issue is indirectly a duplicate of issue #5 Also not as unnecessarily complex as the above ENH and gets the job done.

Perhaps I should be thinking purge logic instead now...
eg - if a player in a faction doesn't log in for X amount of time, and no longer owns any useful volume of items in game, transfer his balance to his faction somehow, minus the starting balance, cancel any current offers , and remove him from the bank file.

Only downside here is if they had less than starting balance left, it would probably reduce a factions balance slightly. But that seems fairest logic, as it prevents players using on/join logic to exploit free money from expiring bank accounts - as unlikely as that is - (a bot net, or spammer could)

jpcsupplies commented 8 years ago

Superceded by #56