jpcsupplies / Economy_mod

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

ENH LCDS -- use them to tie to (player) markets ? #71

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 8 years ago

Just had a thought - For the beta milestone Instead of using a register command for trade regions - how about we tie them to LCD panels? That way ships themself can be trade regions, and the region follows the ship?

It would still allow stations to trade, but they obviously don't move.

We would probably need a registration process still to enable the LCD to prevent random players making lcds with no money.

This could also allow us to use the "private text" field for players to configure what items they wish to list in their "shop" and pricing.

Behavior: once an LCD becomes registered for trade - fill the private text field with the list of items out of our default price table, along with price and sell flag. Items a player wishes to trade in they set to true,

eg. Item|buy price|sell price|offer for sale true/false|offer for purchase true/false|buy limit|sell limit Uranium ingot|9|10|false|false|0|0

Example to offer to buy a maximum of 1000 uranium ingot but dont sell any Uranium ingot|4|15|true|false|1000|0

To buy and sell iron ingots limited only by funds and stock- Iron ingot|1|2|true|true|-1|-1

We may need to use an alternate tag for trade LCDs tho like [trade] or something that way the merchant can build [Economy] LCDs to display his pricing.

The public text on a [trade] lcd would default to the items only that have "true" for buy or sell

We also need some way for them to add or deduct stock to the market from their inventory (or a crate?) and a way for them to add or remove funds from the market..

Thoughts ?

midspace commented 8 years ago

how about we tie them to LCD panels?

We could. I've set up 3 types of market zone types so far. It would still make more sense to have a Beacon as focus of the market. Mainly because there will probably be multiple LCD panels to display prices. Hard to fit all items onto 1 panel.

I would need some work to create a fourth type, EntityBox as it should follow the orientation of the cube, and not the World. And stations can now be placed at an angle.

    public enum MarketZoneType
    {
        /// <summary>
        /// A fixed sphere shaped region in space that does not move or change size.
        /// </summary>
        FixedSphere,

        /// <summary>
        /// A fixed box shaped region in space that does not move or change size.
        /// </summary>
        FixedBox,

        /// <summary>
        /// A sphere shaped region in space that is centered about an Entity. It does not change size.
        /// </summary>
        EntitySphere,
    }

fill the private text field with the list of items out of our default price table

I'd prefer if we don't use LCD panels for input on trade values. I don't think there is an event that is fired when the text is changed. That means, we have to poll for changes, which can lead to too much CPU usage.

jpcsupplies commented 8 years ago

No need to poll, we just write into the documentation to run a command like /update or something.. so long as we can access the data - it saves a lot of pain having to manually type /add every item a trader wants to buy. That allows us to offer more useful error replies like invalid option on blah.. instead; while polling would make that bad as it would spam up the chat.

The "follow" behavior gives one potential unintended Enhancement too... remember when we discussed spawning freighter/trader ships for background "ambience" and tie them into the NPC market restocking behavior (eg pirated ships means no stock is restocked that round)

Well if we use the "market follows ship" logic that opens up some interesting possibilities.. a: the NPC market can spawn traders to fly off into deep space on patrol routes (or at least pretend to, have it despawn and respawn near known registered player trader locations maybe) if you see an npc trader ship in deep space, you can fly near it and trade with it. Items it purchases can be added to the 0,0,0 market when it "returns" as such players themselves become the source of new stock

b: OR general freight ships could be traded with too - not necessarily related to the NPC market at all.. it just gives a useful purpose to ships other than looking pretty if we add our "Ambiance" function. Means there is the option to trade instead of pirate materials it is carrying.

c: the "ambiance" ships could be configured to purchase/sell specific common items (ice / uranium / iron etc maybe have a beacon advertise) if it detects them in a players market - and it is set to trade those in our ambiance setup (logic: if player sell price < NPC market sell price, buy random qty)

If we use a beacon the beacon could summarize what it has for sale in the text

jpcsupplies commented 8 years ago

Ok - research objective here is done - it appears this is possible. Ill move it out the milestone as an ENH for later.

jpcsupplies commented 8 years ago

Implemented as beacons, LCDs auto update.