PDA

View Full Version : Marketplace : Bazaar replacement (WIP)


Bulle
04-10-2008, 06:36 PM
Since its introduction the Bazaar has always been an important part of EQ, and having little in the way of trading on EQEmu is sad. Last time I checked the status on the Bazaar was that some opcodes were missing, preventing a proper implementation at the moment.

To be honest I have never been a fan of the way the Bazaar works, although I like the purpose. As a consequence this replacement departs from the official Bazaar, so it may not appeal to people who would like EQEmu to really match EQ Live feature for feature.

The main gripe I have with the Bazaar is that you need to let your PC connected at all times in the game. That was a nice trick from Sony to artificially raise their amount of simultaneous players back then (anyone remembers their announcement when they broke 100.000 connected ?), but I for one would be glad to drop that altogether.

Here is how a Bazaar replacement could work :
- it is completely written as a web application (hear "e-commerce"), that does its work in the EQEmu server database with the existing tables and a few more.

- it works with the bank inventories of player characters, a so-called "warehouse" which is an off-line storage place, and a trading market

- players connect with their account (there is this password field that is under-used), and can then transfer items/coins from the bank of their characters to the warehouse, and vice-versa. The warehouse has no set limit on the items it can contain, great for those 25 Rusty Halberds you have collected over time.

- once items are in the warehouse the player can send them to the market for sale (apiece or as bundles), with a sale price. The items disappear from the warehouse and enter the market.

- players can search/browse for items for sale, possibly through EQBrowser, which would avoid re-developping a browsing application. A few additional fields in EQBrowser should fit the need

- players can buy items from the market, with the coins stored in their warehouse. Bought items go to their warehouse, and the money paid goes to the warehouse of the seller.

- sellers can withdraw ites from the market when they see fit, the items go back to their warehouse.

- something similar could be done to allow players to register as buyers : they choose which items whey want to buy (and how many), pick a price, deposit the money and other players can then fulfill the order. If some items for sale match the buying price a background daemon could do the transaction for both players.

Note that the warehouse would be account-wide, because I see no reason to do otherwise : players have access to a shared bank, multiple characters and multiple accounts to serve as mules, so they can already have virtually unlimited storage space and transfer items from one character to the other. No reason to complicate things uselessly.

Implementing this is not a huge work, though it will take a bit of time to write. There will be very few pages if I can delegate the browsing to EQBrowser. At the moment I have the first page, the one allowing transfers between the bank and the warehouse. I take special care in making the code robust, as such a tool would be the prime target for cheaters. Players will only be able to transfer items from/to their bank when they are offline to avoid database corruption, transfers and orders will be serialized for each player and item for trade (through DB locks), parameters read from the request are checked and ignored if not appropriate, and parameters in the database queries are properly escaped (for quotes, to avoid script injection). I will almost certainly add some logging about transactions.

It will be written in Java, to run on Tomcat. I know it is one more web server to setup, but I am really not good enough at PHP to write quality code with it, and the Marketplace requires robustness. The performance should not be a problem : a transfer of several items between the bank and the warehouse is typically instantaneous, even in Java.

If you have any opinion on this little project I would be happy to hear it. I hope I can make a version available in a bit.

circuitdragon
04-10-2008, 07:12 PM
It would be a bit of doing on the GMs part, but just as a though, its it harder to have NPCs for sale? By this I mean, players either buy or rent NPCs in the game. Each player can then trade items to this merchant, and set prices. This way all trading would be done in game, with or without clients online. Possible issues with this though would be lag if say, 300 "merchants" were being placed in the bazaar...but I've no real clue as to how much lag one standing NPC could generate. Just a thought though...but if thats going to have a lot of issues and or become far to complex, your idea sounds awesome just as well. :)

AndMetal
04-11-2008, 12:35 AM
I think this would be an excellent compromise for Bazaar functionality.

In my head, I personally think it would be best to incorporate in-game commands to move items you want to sell into a "bank" (read: a separate table in the DB, maybe called trader_items or something like that), then manipulate everything out of the game, through a web interface. For buyers, you could then send money to your trader account via an in-game command (kinda like a PayPal account) to buy items. Once you buy items, you could then either keep them in your bank until you remove them with another in-game command, or have it automatically put into the first available slot in your inventory or in-game bank.

The reason I think that would be the better way to do it is because characters' money is stored in the profile blob. It is only loaded from the database when loading into the server, so if someone is already logged in and you try to update it, they wouldn't actually lose any money for the transaction. And unless you use the built-in web server, you can't easily find out if someone's logged in or not (unless you use the telnet commands, which is kinda messy).

Luckily, the inventory stuff is all in tables in the database, so that's easy enough to manipulate directly via a web page (and is updated into the database real-time by the server).

Anyways, some stuff to think about...

ChaosSlayer
04-11-2008, 01:20 AM
I have not read original post in great detail, but thinking how eq2 market works, here general idea layout, how I see the principle.

1. A Db will recieve a new table called BAZAAR (or market)
2. All players will have access to special command like /bazaar (or /market) or posibly #market.
Inside that command players can: add item to the market listing with a price, or search for items offered.
#market add ITEMID PRICE (perhaps dragging icon link into comand line text box woudl work?)
#market REMOVE ITEMID (your own item only of course)
#market listitems (or search for by various options.)
#market BUY ITEMID

One player ADDS the item to the market it is REMOVED from players inventory or bank (or perhaps make a rule item MUST be on a corsor or soemthiogn liek FIRST inventory slot) and a new row is added to the MARKEt table

The MARKEt table will need to have following collumns:

listing_id, itemid, item_name, player_id (seller), price, quantety

When players buys an item, cash is removed from his person, item is removed from the market and put onto buyers cursor, and cash them is added to sellers bank

so in conclsuion - players inside the game can add, remove their own items to the market, and buy them.


The way I see - such structure works no diffirently than build in Gm comands.
No need to stand alone add-ons

Of course my understanding of EMU code only goes so deep, but this seems like simply enough general concept.

Oh yeah - server admin should be bale to restrict access to market for exmaple to specific zones.

AndMetal
04-11-2008, 01:52 AM
Chaos, I think you and I have the same idea, except mine would also incorporate web interaction, but most of the functionality is there for adding money, moving items, etc, so adding the commands shouldn't be too difficult (knock on wood).

ChaosSlayer
04-11-2008, 02:55 AM
(knock on wood).

:cool:

honestly I am a fan of Ec Tunnel style trading - speicaly with small player communities we have, but heck why not =)

PS. posibly coders can actualy use the real bazaar search window for this, since its allready there

Bulle
04-11-2008, 05:09 PM
Having quest NPCs to play the "auction guy" for you would not be easy. The main question is : how do you search for an item you want to buy ? If you have ever tried Shards of Dalaya, then you will understand the problem : you can only scan through what an entire server worth of people have for sale. Unless you spend one or two hours a day doing that, you just forget about it and never browse. So people have to advertise, and you are back to the OOC/SHOUT/CHANNEL drawing board, you have just simplified the transaction process, not the whole trading.

As I see it you need an out-of-game mechanism for browsing/buying (until the bazaar opcodes are fixed at the very least). Hence the "e-commerce" site idea. EQBrowser for browsing, one page for buying. The rest can be pretty much anything.

Once you have that in mind, you can view all the other ideas as alternate (and possibly the most popular) interaction methods with the marketplace when it comes to sending/receiving items. Remember that ensuring proper transaction security with in-game transfers can be tricky, it is all in real-time, and many things happen in-game, anytime.In addition, although I can easily commit code to an out-of-emulator tool, I cannot do the same for EQEmu...

When you think about it the plan is quite clear : make it an out-of-game tool fully, with proper locking mechanisms described for the new marketplace tables. Make it sturdy through testing. Then EQEmu developers/contributors can add in-game commands to interact properly with the database tables and add in-game interaction. As long as they follow a few basic rules the database commands to pass should not be hard to write. The tough parts are ensuring no-one can cheat the system, and making it user-friendly (not so easy when all you have is a cursor and a command-line !).

ChaosSlayer
04-11-2008, 06:37 PM
ability to search for items is allready in the code of EQEMu - gm command #itemsearch

all you need to chage is to use same script to search a diffirent table =) (the market table)
so you don't realy need MUCh in terms of interface - show list of items, add, remove, buy

and yes testing that there are no bugs is a whole separate story =)

PS no way to comand eq bazaar window to work for us?

Bulle
04-12-2008, 09:18 AM
You really want your players to use #itemsearch ? If not for the fact that GM commands are not widely available to players, searching with #itemsearch is quite crude, it searches on an ID or a portion of an item name.

One of the major barriers to an in-game trading facility is the incapability to make the Bazaar interface function properly in EQEmu. I am nothing of a hacker so I cannot reverse-engineer opcaodes and such. Given a specification of how they work, why not. But if we had that I guess the Bazaar would already be there.

Bulle
04-12-2008, 09:37 AM
I have setup a very alpha version of the warehouse on my server, the place where you can move items/coins between your bank and your warehouse. and I have created a few dummy accounts and characters in one of my databases for test purposes. In addition I have a script that can tell me if the total items in the system differs from what I have inserted at the beginning.

So if you want to have a look at the interface, try it out and possibly break it you are welcome. Let me just state the rules of the game : I do NOT welcome you to break into my server through illicit means (eh !) unrelated to this web application even if you are the best hacker in the world. I welcome you to connect to the provided URL and try to break the way the warehouse should work, through concurrent connections, double-clicking on the submit button, script injection (yes !) and such. Just do not abuse it if you find a weakness, and report it :)

You will notice that most links are not wired yet. Only the "Bank / Warehouse" transfer is active, and the two search boxes for convenience. You can log into the utility with the accounts : Bololo, Rololo, Tilolo, Bokiki, Rokiki, Tikiki, Bobidon, Robidon, Tibidon. The password is "x" for all. The inventories start empty, with a bunch of items in the warehouses. Most accounts have many characters. Those accounts/characters are not used by any running game-server so it is a "closed" aquarium. I can log into a character to check the bank but that's pretty much it.

I should warn you that once a no-drop item has been transferred to a character bank they are stuck there. So be careful with those trader's bags. Most items are droppable/non-lore though.

My bandwidth is not awesome (like 128 kB/s upload) so be patient. Also if someone else is having fun with the same account as you, you will end up with the troll guy eating your orders (it's the guy moving the stuff around). Best is to switch to another account then. Oh and I am tweaking my servers this week-end, so if it is down just wait it out. If it does not work at all though feel free to reply/PM me.

The Address : http://friton.dyndns.org:8080/eqemutils


Have fun, I am waiting for your reactions :)

ChaosSlayer
04-12-2008, 12:24 PM
You really want your players to use #itemsearch ? If not for the fact that GM commands are not widely available to players, searching with #itemsearch is quite crude, it searches on an ID or a portion of an item name.

One of the major barriers to an in-game trading facility is the incapability to make the Bazaar interface function properly in EQEmu. I am nothing of a hacker so I cannot reverse-engineer opcaodes and such. Given a specification of how they work, why not. But if we had that I guess the Bazaar would already be there.

i didn't say that =)
i said it coudl use same script, but it will apply it to market table.
If items table has over 50k entries, market table will prbaobly have 100-300 at most

Gonner
04-13-2008, 09:52 PM
Another option that could be possible is in the bazaar zone have the toggle inspect, inspect the players bag slots. Even if it looks similar to how the EC days of trading used to be (trade bag full of items and they looked at each item like that). Putting prices on things is something is going to be the hard part and not sure how to do that. But that could be an alternitive to try.

MNWatchdog
04-13-2008, 11:54 PM
Heres an idea on how to do this with less coding.

Allow people to spawn a merchant who has their name.

They add items to the merchant by targetted their merchant, grabbing a item on their cursor and issuing a command like #sell <sell price> The server takes the item off the guys cursor, puts it on the vendor at price listed.

The money gets put directly into that persons bank.

To remove items, their merchant sell to the owner at 0 cost.

This sounds like it would be a lot easier to code and work quite well.