autobuy - a very simple approach to offline-trading

PRE: I assume the whisper-message generated by poe.trade contains all the info needed to identify the item to buy.
This message is easy to parse, but GGG could also define a better format like CHAR=chris, ITEMNAME=bla, ITEMTYPE=blub, ...
I bet the guys at poe.trade would gladly support it.

So if we had a command that takes that message as a parameter, we could do a fully automated trade. Like in:

/autobuy Hi, I would like to buy your ...

The currency would replace the item in the vendor's stash. The price would be taken from the vendor's tab (not from the message) to prevent manipulation.
The item would end up in the buyer's backpack/inventory.

The possible outcome of the transaction would be
- successful
- item not found (sold, moved or whatever)
- not enough currency (stupid buyer)
- not enough space in backpack (stupid buyer)
- not enough space for currency (ring for 50c)
- no space for currency, tab is read-only
- not successful for technical reasons

Certainly not the most elegant solution I can think of, but the one with the minimum implementation effort because >80% of the code needed should already be there.

Please note that this thread is meant to be about *how* it could be done, not about *if* we want offline trading. The latter has been discussed to death elsewhere.
www.ufoai.org (turn-based strategy, SciFi, OpenSource)
Last bumped on Apr 25, 2017, 9:28:31 AM
This thread has been automatically archived. Replies are disabled.
First, I'm not sure why you (seemingly) think that GGG cant program auto buyouts in if they wanted them (they dont, but like youve said thats another topic).


but if I play along with this mockup design, it has some big holes in it.

your major assumption that currency will go to the same tab, basically preserves price manipulations. nothing prevents a seller from putting a skyforth in the tab, filling up each space in tab with garbage or just super high prices, and putting b/o of 100 alts on skyforth. any request to instabuyout would give an error and yet the item would still be listed at extremely low price.

basically any implementation would have to force seller side to accept the currency on a transaction, otherwise you end up with same kind of situation you have now which many people have issue with (item listed, cannot buy). this requires a near infinite stacking tab with currency and/or hard limits on buyout prices. otherwise, people will find a way to circumvent it. poe has diverse currency, and standard tabs can only hold 12x12x <stack size> amount of currency

moreover, if we're talking about existing design, trading or item 'passing' is done only within instances currently. your design assumes cross-instance trading via probably some wrapped database calls. I think it's safe to say it's not exactly minimum implementation effort.

finally, the concept of putting item in stash automatically/replacing it with other item, even if the result is successful, might need a lot of work. currently items are passed strictly through player/inventory, so its not unfeasible to assume they are taken out without a lock (because player can only do one action at once and player directly accesses the tab, caching it). if async trading in that sense needs to be done, you have to account for items being removed/added without an instance and concurrently. this means tons of concurrent database calls which need to call concurrent updates with locks, which put a heavy strain on the database. maybe even resulting in deadlocks and rollbacks as a result.
"
grepman wrote:
First, I'm not sure why you (seemingly) think that GGG cant program auto buyouts in if they wanted them (they dont, but like youve said thats another topic).

I did not mean to imply that. However, even the best programmer can not always think of *all* possible solutions to a problem.
btw did GGG ever explicitly say they don't want offline trades ? Where ?


"
grepman wrote:
your major assumption that currency will go to the same tab, basically preserves price manipulations. nothing prevents a seller from putting a skyforth in the tab, filling up each space in tab with garbage or just super high prices, and putting b/o of 100 alts on skyforth. any request to instabuyout would give an error and yet the item would still be listed at extremely low price.

Misunderstanding here. I was only talking about the price the buyer pays (editing the whisper msg).
My little concept is not intended to solve *all* problems around trading eg. the price manipulation on poe.trade.
But if you want a solution for that too: just mark the item as 'technically unsellable' once we encounter such a situation. And yes, that would be a little new code.

"
grepman wrote:
basically any implementation would have to force seller side to accept the currency on a transaction, otherwise you end up with same kind of situation you have now which many people have issue with (item listed, cannot buy). this requires a near infinite stacking tab with currency and/or hard limits on buyout prices. otherwise, people will find a way to circumvent it. poe has diverse currency, and standard tabs can only hold 12x12x <stack size> amount of currency

Have to disagree here. I would already be happy if the transaction only works if both buyer and seller did everything right.

"
grepman wrote:
moreover, if we're talking about existing design, trading or item 'passing' is done only within instances currently. your design assumes cross-instance trading via probably some wrapped database calls. I think it's safe to say it's not exactly minimum implementation effort.

Cross-instance trading is only a problem if you want a trade *dialog* because the *GUI* is limited to the instance. The database/backend is the same for all instances. Thus a command that only does DB manipulations is no problem.

"
grepman wrote:
finally, the concept of putting item in stash automatically/replacing it with other item, even if the result is successful, might need a lot of work. currently items are passed strictly through player/inventory, so its not unfeasible to assume they are taken out without a lock (because player can only do one action at once and player directly accesses the tab, caching it). if async trading in that sense needs to be done, you have to account for items being removed/added without an instance and concurrently. this means tons of concurrent database calls which need to call concurrent updates with locks, which put a heavy strain on the database. maybe even resulting in deadlocks and rollbacks as a result.

You may be right here. Will have to think about that part a little more ;)

Anyway, thx for your constructive reply. We might create a working concept yet ...
www.ufoai.org (turn-based strategy, SciFi, OpenSource)
while the suggested implementation has some holes as Grepman pointed out, I would appreciate something like this as a concept.

I have 2 tabs of stuff I'd like to see gone in Standard.
when I'm online they sell reasonably fast, but I'm not online much recently.

GGG's reasoning for having online-only trade, is probably player retention: people who want to trade, will have to log in.
even if they don't actually play the game but just sit in town or hideout semi/full-AFK, it still looks good in the "active player population" statistics.
Alva: I'm sweating like a hog in heat
Shadow: That was fun
"
aDuke wrote:

btw did GGG ever explicitly say they don't want offline trades ? Where ?

They have said they don't want automatic buyouts. For example, this would be fine:
1) Seller lists item, logs out
2) Buyer places an offer on the item while seller is offline
3) Seller logs in, accepts the offer, the trade is done.

On the other hand, this they don't want:
1) Seller lists item, logs out
2) Buyer places an offer and instantly gets the item while the seller is offline.
"
almostdead wrote:
"
aDuke wrote:

btw did GGG ever explicitly say they don't want offline trades ? Where ?

They have said they don't want automatic buyouts. For example, this would be fine:
1) Seller lists item, logs out
2) Buyer places an offer on the item while seller is offline
3) Seller logs in, accepts the offer, the trade is done.

On the other hand, this they don't want:
1) Seller lists item, logs out
2) Buyer places an offer and instantly gets the item while the seller is offline.


That could explain a lot. Why they want to do cross-domain trades as stated in the dev faq some 10 months ago IIRC. (If we had true offline trading we wouldn't need cross-domain)

Two questions remain here:
- where and when did GGG say that ?
- did they also give a reasoning ?
The pita of current trading would be much more bearable for me if I only knew WTH they don't want offline trading ...
www.ufoai.org (turn-based strategy, SciFi, OpenSource)
"
aDuke wrote:
PRE: I assume the whisper-message generated by poe.trade contains all the info needed to identify the item to buy.
This message is easy to parse, but GGG could also define a better format like CHAR=chris, ITEMNAME=bla, ITEMTYPE=blub, ...
I bet the guys at poe.trade would gladly support it.

So if we had a command that takes that message as a parameter, we could do a fully automated trade. Like in:

/autobuy Hi, I would like to buy your ...

The currency would replace the item in the vendor's stash. The price would be taken from the vendor's tab (not from the message) to prevent manipulation.
The item would end up in the buyer's backpack/inventory.

The possible outcome of the transaction would be
- successful
- item not found (sold, moved or whatever)
- not enough currency (stupid buyer)
- not enough space in backpack (stupid buyer)
- not enough space for currency (ring for 50c)
- no space for currency, tab is read-only
- not successful for technical reasons

Certainly not the most elegant solution I can think of, but the one with the minimum implementation effort because >80% of the code needed should already be there.

Please note that this thread is meant to be about *how* it could be done, not about *if* we want offline trading. The latter has been discussed to death elsewhere.


totally opposed to off line trades if your not there you cant trade period as it is off line ppl waist on line ppls time if i have 20c and your not on line im not interested its called fast trades and fast currency if i had to wait for a cure for cancer we would all be dead
"
grepman wrote:

finally, the concept of putting item in stash automatically/replacing it with other item, even if the result is successful, might need a lot of work. currently items are passed strictly through player/inventory, so its not unfeasible to assume they are taken out without a lock (because player can only do one action at once and player directly accesses the tab, caching it). if async trading in that sense needs to be done, you have to account for items being removed/added without an instance and concurrently. this means tons of concurrent database calls which need to call concurrent updates with locks, which put a heavy strain on the database. maybe even resulting in deadlocks and rollbacks as a result.

You are damn right here. Concurrency is the main problem here.

We could easily prevent concurrent updates by the seller (moving/removing the item) by restricting offline trading to situations when the seller cannot reach a stash. That is, when he is offline, afk or in a map area (act1-4 or map). That would leave us with an 80% solution, but I still take it, considering the pain of current trading.

BUT ...
we would also need to handle concurrent *buyers* and that can't be done without a DB lock.
Fortunately we only need to lock the item, not the currency imho. Once one of the buyers has gotten his hand on the item, the remainder of the transcaction could be done without true locks, right ?

btw do we know which DB system GGG uses ?
www.ufoai.org (turn-based strategy, SciFi, OpenSource)
I wonder why I didn't think of this earlier .... GGG already *does have* an implementation for concurrent access to stash tabs: the guild stash !

So reusing that code should be merely some refactoring (if it was well written, that is).
www.ufoai.org (turn-based strategy, SciFi, OpenSource)
Last edited by aDuke#2361 on Apr 25, 2017, 9:29:18 AM

Report Forum Post

Report Account:

Report Type

Additional Info