jpcsupplies / Economy_mod

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

Logical Considerations - NPC merchant #33

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 9 years ago

if for whatever reason we dont simply create a bogus character in our bank file for the NPC merchant then we need a way to add or remove funds or stock to the global market and merchant funds

jpcsupplies commented 8 years ago

I think we need to establish some logical directions here - When we implement the first stage of the buy/sell system; we should allow a configurable option to set the market as: 1 limited supply mode - this requires that a "merchant" npc maintain cash and resource supply reserves. If he runs out of cash he wont buy anything. If he runs out of ores he wont sell it.

2 This may need to be suplimented with a "random number generator" to simulate random trades of small amounts of resources in order to keep at least a handful of each resource available, and to make sure the merchant has liquid assets to make purchases. This could simply work as a bogus entry in the bank file, that basically behaves like a player - but the server uses that account for any trades.

3 unlimited supply mode - this is basically the same as above except we ignore the checks for available money or supplies first on npc trades.

4 player to player mode - works identically as trading with the NPC merchant - except the player themself approves or declines the trade; and sets their price - (not automatically like the NPC which always follows the price table) and must to post an item for sale, or order to buy first. Otherwise follows same rules of cash or resource reserves as NPC, but always remains in limited supply mode.

5 ENH considerations - we could in a later version add a block or simply a "contract" which allows a player to set up their own NPC trader - Possible ways to work: 1: a block - ownership of block controls who manages that NPC 2: Faction - all factions could automatically get a NPC trader - that skips a few milestones and gives us elite trading right away but we need to limit it somehow, such as proximity to an owned block by that faction or a GPS location check might be easier. Maybe when a player makes a faction, they can use a command to set them as a trade federation. it could also be limited to trading to those with whom your own faction is either neutral or allied with... (allied sounds good actually, makes alliances actually useful and negates need somewhat for gps restriction) 3: when we implement the mission/contract system include a trade contracts system - which is basically like manual trades where you set what you want to buy and sell at what price, or when you trade with other players, but automatically completes the trade if the buyer or seller meets the item and price desired.

jpcsupplies commented 8 years ago

General logic - when trading with server market - as much as possible, try to use same logic as would be used trading with a player; so that when we start working on a player market we are not re-inventing the wheel.. ie, a gradual progression of features, instead of having to scrap old functions.

midspace commented 8 years ago

The only thing that is bugging me a little, is having an NPC Merchant. Both words, "NPC" and "Merchant" kind of imply we could have more than 1 operating. Is that the intention, to have more than 1? Or is there only 1 computer controlled entity which players can buy and sell with? Would it be more accurate to call it a "Merchant Bank" if there was only 1? They could then facilitate loans at an interest rate :grin:

Imagine the banks ships coming around to collect a debt? "We're here to repossess your ships! Stand down, and prepare to be evicted!" :laughing:

midspace commented 8 years ago

Okay, those ideas may not quite fit in with the Blue Mining Inc universe.

jpcsupplies commented 8 years ago

Haha.. well the UFP might do that or any hostile bankers i suppose. But yes, if you skim the ENH paragraph above, I was thinking down the line, more than one NPC, either as a representative of a particular game faction, or as an "agent" acting on behalf of the player so he doesnt have to stop.. mining or shooting at people to /approve a suggested trade to him if it is something he knows he wants.. or as a mission style "buying contract" for s single commoddity order which could be expanded into a sort of delivery escort mission in a later version of the mod. This allows the trade between different stations effect you had in games like Elite where different markets had different prices on the same goods, you just had to survive the trip there to sell at a profit..

So I was thinking in the alpha release was a milestone to allow players to buy and sell goods direct to server based on price table... but it occured to me, when we want to add in commodity trading between players, or a global offer/bid market to dictate price, we would either have to re-write the entire sell to server system, or throw it out..

What I was suggesting is when we code the short term "hack" allowing players to buy/sell against the server for the Alpha release milestone - we code it with player like behaviour to begin with in the back end, so when we upgrade the code to be a full server-wide market demand driven price/suppy; most of the work is already done, instead of becoming obsolete.

Alpha release - allow players to buy and sell goods against the server - the server is represented by a special entry in the bank account list - (allowing admins to /pay in more funds for example) and the same code should easily adapt later to being used as a computer controlled "agent" or "contract" or "faction banker"

For players who post buy bids, and sell offers; becuase the NPC logic uses the same "player" bank list logic as the NPC merchant.. then the same market logic would work against the player for the items they want to buy and sell too.. except players would deal with players not an npc.. and that player gets the income from the sales not the server npc ..

Beta release - ability for players to post buy and sell orders into a global market which would effect the commodity prices based on supply pricing and demand. etc..

I hope that I am making sense here... ill try to cut it down further to raw basics...

Basically for the alpha to keep things simple, we aim to allow players to sell carried ores to the server, which pays them their table price, or to buy them back depending on the qty in the table..
limited by the available funds of whatever we have representing the "server" and the amount of that item in the table.

But in a later milestone we want players to be able to trade with each other direct, or post buys and sells on a common marketplace stockmarket etc to give it a true free market feel.. but the later milestone may conflict with the earlier one... so basically when we make the initial buy/sell market.. it will to the end user basically be buy/sell to the server.. but at the backend, it is a stripped down bare bones version of the later milestone but you can only interact with a single trader representing the server at this point..

Does that explain it ? LOL

jpcsupplies commented 8 years ago

to clarify my earlier post too, configurable option for NPC (server) trades mode 1 - limited mode, merchant is only allowed to spend its balance, or sell goods it already has - may require "random" pretend trades periodically to replenish funds or exhausted goods supply over time. (this is how many 4x games work now) mode 2 - unlimited mode, merchant is allowed to buy and sell without any limit, ignoring its balance, and selling more than it already has; the only limit is buy and sell price and the players own available funds or supply.

There could also be a "strict" mode 1, where once it runs out, it stays that way until a player buys a good, or sells it more. (basically server is forced to follow same rules as players)

Mode 1 example: Player "Bill" buys up the entire 2million supply of silicon from the server. 5 minutes later a "random" pretend trade sells the server another 24 units of silicon. Player "Fred" sells 5 million iron ore to the server, at a cost of $9million, totally cleaning out the servers money supply. 5 minutes later a "random" pretend trader buys 34,212 iron ore from the server earning it $68434.. and every 5 minutes until the available supply of money is over 100,000 or a depleated resource is over 100 again. (or similarly appropriate values) Randoms should only be a small percentage of the total, and only occur when money is low, or a resource runs out - and it should target the most overloaded markets so that overall effect on supply is minimal but allows the server to keep buying.

Mode 2 Example: Bill buys 2 million silicon. Technically that is the entire supply but Bob can then buy 2 million too. Bob sells 10 million iron ore.. technically the server cant afford that, but bob gets paid anyway.

jpcsupplies commented 8 years ago

Moved to https://github.com/jpcsupplies/Economy_mod/wiki/Logic-Discussion-NPC-Merchants for reference