jpcsupplies / Economy_mod

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

Permanent death - account loss? #56

Open midspace opened 9 years ago

midspace commented 9 years ago

Should look at reseting the account balance on permanent death.

Should prevent missuse of players selling everything, dying, selling everything, dying, then buying expensive stuff with their ill gotten proceeds.

Though it may be acceptable to transfer your balance into your faction prior to death.

midspace commented 9 years ago

At this point, I am unsure how to detect when a player dies.

jpcsupplies commented 9 years ago

This would fall loosely under the umbrella of #6 (purge logic) and maybe even #36 (insurance contracts maybe?)

Maybe in a later release implement a "next of kin" command although that could be used for those with multiple steam accounts.. short term we could just default to blacklisting tools from selling? [edit or recommend admins disable tools on new connection option in server options with this mod forcing players to buy them from starting balance - that introduces entropy to any exploit attempt] {Edit - although that increase game difficulty lacking a supply of tools if they lose all their money}

Next of kin logic: variant - When they die, the game treats them like a new person being born, maybe just forfeit their balance - either by outright deletion; or some lost money database they have to pay a fee to access? In effect we assume they are their own next of kin, sign here to inherit your predecessors money... of course there is a small matter of the fee... later on we could even go so far as searching for the dead persons items and transfer ownership to them as part of the service offered by the fee? [edit to be really evil the fee could be more than starting balance forcing them to work to save up to get their stuff back]

I dunno, had any other thoughts?

The current pre-release just "loses" peoples balance on some hosts on restart anyway; people at this point are probably used to loosing their fortunes - maybe when we implement purge logic have it check for 1: owned blocks, and 2: faction if they own no blocks and have no faction, donate the money to the NPC (government seizes assetts) if they have no blocks but are in a faction, give the money to the leader (oh my we lost an employee... oh well time to clean out their desk, oh look his wallet..) if they have blocks but no faction - tricky... convert their money into an equivalent value of gold or something and leave it in any available cargo crates owned by them? if they have blocks and a faction, tricky.. are they the founder a leader or a member? should leaders be promoted to replace them.. should assets be divided between members

so many cans of worms here..

i think the next of kin, pay to inherit idea sounds easiest more fun to implement ?

jpcsupplies commented 9 years ago

Game is meant to "balance survives restart" and game crashes may accidentally trigger permanent death too.. which is even more worms in a can.. I say leave this issue open, as an ENH and worry about it after our next milestone?

If we dont have a way to detect death anyway point is moot.

midspace commented 9 years ago

At this point, I am unsure how to detect when a player dies.

It's not death really, it's the respawn that counts. They either respawn at a known Medical bay, ory the respawn anew. It might be tied to IMyIdentity. I was having trouble understanding why there is IMyPlayer, IMyCharacter, IMyIdentity, IMyNetworkClient. All of them represent different facets of the user in some way.

if they own no blocks and have no faction, donate the money to the NPC (government seizes assetts)

Initial account balance should come from somewhere. Although, it does sound good if we return all account balances back into a single pool.

should leaders be promoted to replace them.

No one can be promoted to founder. The API doesn't allow it.

i think the next of kin, pay to inherit idea sounds more fun to implement ?

Subject to inheritance Tax. The tax is collected back into the above pool.

Demolish50 commented 9 years ago

When someone permadeaths there is simply a new entry in sandbox.sbc. The new is given a new IdentityId under MyObjectBuilder_Identity. Why not create a new node in EconomyData for IdentityId and let balances tie to that vs steamid? I have not really thought this out, free flowing thoughts here.

midspace commented 9 years ago

Part of the problem is, if the MyIdentity.IdentityId changes, we don't know what the old MyIdentity.IdentityId was we don't necessarily know what the old Identity was. MyIdentity doesn't link directly to the SteamId. It's referenced through the MyPlayer. I'm not sure how reliable MyPlayer is. Does it change at all?

If we want to take this to a Global market, where players can move from server to server with their account, then MyIdentity is inadequate. It has to be the SteamId.

I feel there will be a conflict of purpose here. For the moment however, to detect a change in player whilst Permanent death is on, then a change in MyIdentity.IdentityId is the only way.

in MessageConnectionRequest.ProcessServer() Though I'm not sure an Identity will be established at this point.

if (EconomyConsts.NewAccountOnPermanentDeath &&  
    MyAPIGateway.Session.SessionSettings.PermanentDeath.HasValue && 
    MyAPIGateway.Session.SessionSettings.PermanentDeath.Value == true && 
    player.Identity.IdentityId != account.CurrentIdentityId)
{
    // TODO: reset account.
}
jpcsupplies commented 9 years ago

We could stick with steam ID, and for most of our stuff that would be fine. If we want to be adding support to hang off perminent death, it is probably a simple matter of also recording the identity id on this server, and on connect check both steam ID and identity id, if the identity id does not match the player associated with that steam id... send them our condolances on their death and offer to "process their inheritance" for a modest fee of course.

This approach has the advantage that owned blocks discovery is much simpler, as we now know what the old identity ID was prior to their death and we can transfer their "assets" not just their money.

The main downside here as implied above however, is if we want to go the direction of having a player bank balance available between different server worlds hosted on the same server, this logic would trigger the "death" routine every time they swapped worlds, as the internal world specific player id is likely unique to each world save.

This opens up yet another can of worms and extra work, as we may need to start recording every known ID against every world, etc etc.... pain so much pain.. That is a lot of data to record for a feature that most server admins will not even know is there, or will not be able to use due to the way most paid space engineers hosting works with jailed sessions.

midspace commented 9 years ago

and we can transfer their "assets" not just their money.

Only one problem. We cannot change the ownership of individual cubes inside of a ship. Only whole ships can be changed.

The specific API for single cubes is not available. I need to recheck to see if I can access it another way.

Demolish50 commented 9 years ago

As a server admin I just don't see very many admins using a global balance. I know I won't. Along that line and maybe I should mention this elsewhere, what is to prevent someone from starting their own server, using your mod and with a global balance system they could abuse the crap out of it.

jpcsupplies commented 9 years ago

Doesn't work that way. Here is the logic: You run your own physical windows server (or a remote desktop to a virtualized one) On the same server you run for example three maps at once. (in our case it was ramblers frontier war(pvp trade), Ramblers lawless void(pvp pve trade), and oort cloud (hardcore survival, mining, pve) It is possible for more than one game server to access the same file on the same machine. So the idea was configure it so all three worlds shared the bank balance somehow, either by direct file access or a special api talking between them (configure the server instance id on all 3)

This allows for example people to mine the crap out of oort cloud, and sell the ores. Then using a recently added function of the ModAPI they travel to a special location or press a button etc, and the Mod API connects them to one of the other two servers. Once there they can spend their money to build a base or a space ship or trade it on the stock market etc.

Another waaay into the future pie in the sky possibility was running a web server on this server too, and configure a CGI script to access the server folder with the balance file etc.. and allow players to run a virtual trading company on a website, and have events and balances in game reflected in the website for that player. SO for example. they load up a ship with mined ore, and dock it at a special station, then shift-tab to steam overlay and log into the webpage, they can then for example.. see their ship docked, unload the ore into the website stock market, and trade it for other ores, which in game then get loaded into his docked ship, and he shift-tabs back and flies on his way.

Other possibilities is "Used car dealerships" for space ships and space stations, which could also work in game or on a website, and can be despawned and spawned between the three servers..

We are a long way off that sort of thing.

But in the short term a shared bank balance when you have more than one world running is theoretically possible now. It is also remotely possible but i expect very difficult - using the server instance id to connect to a non-local server.. but i expect the game currently wont allow that - and it is probably better it never does without a major security overhaul.

Demolish50 commented 9 years ago

Thanks for clarifying, that makes sense now.

jpcsupplies commented 9 years ago

Moving issue #6 here -

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)