Advertisement

In-Game Shopping System

Started by April 28, 2004 02:09 PM
1 comment, last by Webbster 20 years, 9 months ago
Hi all, I was just wondering what I should be looking into as to the development of a database shopping system for a turn based multiplayer game. What would I need to look into to develop an online ''market'' that allows players to buy and sell items online to other players. I was thinking that the market would need to be a database on the server, and I was also wondering if I should use a local database in the game directory that contains the details of each item, and the two would be linked. This is only a general question, I''m not in anyway thinking of implementing it (at least not right now ) but some input from people who may have experimented with this type of thing would be great! Thanks, Ad
It's a good idea to cache data on the client, so you don't have to send it across the network.

You probably want to have actual possession live on the server, else hacking the client would easily create arbitrary amounts of stuff.

You want the entire transaction to be in a single transaction in the database:

- remove money from player 1
- deposit money to player 2
- remove object from player 2
- deposit object to player 1

SQL transaction support is great for this.

You also want to design the user interface to not allow for cheating, i e, only allow users to ADD things to the transaction, never remove anything, to avoid bait-and-switch. Also, both users must press OK to make it go through, and if someone adds something after OK, then the OK is reversed for both players.


[edited by - hplus0603 on April 28, 2004 12:54:55 AM]
enum Bool { True, False, FileNotFound };
Advertisement
A method (to prevent cheating) is to remove the traded objects (items or monies) from both players and keep them in a special holding cell for the transaction. Players put the objects they wish to trade into this special (conceptual) area, and then "lock" the objects in. Once both players have "locked in" their selections, they must both verify that the locked in items are correct, and both press ok, the items are traded. If either player cancels the transaction at this stage, all objects go back to their original holders. Note, once items are locked in you can''t "unlock" to add or remove items, the transaction must be started over again.
This prevents people for instance removing an item just before the transaction completes before the other player notices/reacts (bait-and-switch??).
BTW, this kindof describes the user interface to use for these transactions, hplus describes the actual backend operation (and briefly the UI).
CYer, Blitz

This topic is closed to new replies.

Advertisement