Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently making a MMORPG.

At the moment, I am working on the currency part of the game but I'm confused whether I should assign a unique serial number for every unit of the currency generated.

I'm hoping to use this system to trace any misuse of the virtual currency but is this a common practice and if not, would this be a good idea on operational and / or performance point of view?

share|improve this question
How often will it happen in your game that one player transfers about a million zorkmids to another? When that happens, will you have to update a million entities in your database? – Philipp Jun 25 '14 at 14:20
This is actually an interesting idea. BitCoin does something like this, for arbitrary amounts of currency. There might be a solution/possibility. – ashes999 Jun 25 '14 at 14:31
@ashes999 The guys at bitcoin stackexchange say that BitCoin also traces account balances and not individual units of currency. – Philipp Jun 25 '14 at 15:26
If money is completely fungible then one zorkmid is just like any other. – Joe Jun 25 '14 at 18:15
Not true Joe. Pure gold bullion is completely fungible, but is often serialised to prevent embezzlement. – Carl Smith Jun 25 '14 at 23:54
up vote 26 down vote accepted

It's unlikely to make sense.

When I get 100 Zorkmids from Player A and 100 Zorkmids from Player B, I have 200 Zorkmids.

When I then pay 50 Zorkmids to Player C, will C get them from the Zorkmids I got form A or those I got from B? Do I have control over this? Does it even matter? A Zorkmid is a Zorkmid.

It definitely doesn't matter for real-world banks and accountants which all trace the transaction history of accounts, not the transaction history of individual units of currency. It is still possible to identify misuse that way.

That being said, I could imagine a game which treats individual coins as inventory items, so when you trade with someone, you have to make sure you have spare-change. This would allow some interesting features, like marking, enchanting or counterfeiting coins. In that case it would make sense to trace each coin individually. But I can't think of any game which actually does that.

share|improve this answer
thanks for the answer:) – dK3 Jun 25 '14 at 14:29
I just remembered a game which actually traces each individual coin, but it isn't an online game: Dwarf Fortress. But just like so many of those things it simulates, it doesn't really use this to its full gameplay potential. – Philipp Jun 25 '14 at 15:30
I have to note that my real £10 note has HC40415464 written on it so there clearly is some advantage to having a unique ID and real world goverments do care – Richard Tingle Jun 25 '14 at 15:50
@RichardTingle, real notes have serial numbers to allow at least some possibility of tracking transactions and to make counterfeiting more difficult (if you print the same number on every note, somebody might notice). But in a game all currency transactions are tracked by a central authority and counterfeiting isn't possible. – cjm Jun 25 '14 at 16:32
This 'correct' answer is wrong. Real world banks go to great expense to track individual units of money. – Carl Smith Jun 25 '14 at 23:58

No, you shouldn't.

While you should build systems that can allow you to track currency transactions (especially if that currency is a real-money obfuscator), you don't need to track every individual unit of that currency. The thing you are interested in tracking is the aggregate movement of funds, particularly in large volumes (as this could be an indicator of potential external/unsanctioned real-money transactions). Tracking individual units of currency doesn't help with that (in fact it may hurt), and only complicates the upkeep of the relevant data by requiring you to generate lots of IDs and store relatively massive volumes of information in your database.

There is some value to this idea for real-money obfuscator currencies (that is, thing you buy with real-world money that are used to purchase in-game content, such as the gems in Guild Wars 2). In particular, this desire might arise in order to disambiguate between units of currency introduced into the economy for "free" versus those that were introduced via an actual real-world transaction. Generally you can only ultimately recognize revenue on the latter, so it's important to keep them distinct.

However, you can track the information you need simply by storing the numbers in aggregate (total units in, total units out, for both 'free' and 'paid' instances of the currency). This goes along with the general idea that you want to track these things in aggregate, generally a the transaction level and not the current level, as it both tracks the data you really need and makes it easier to trace large chunks of funds as they disperse throughout your system.

share|improve this answer

Author's note: This answer made with the assumption that you are not doing trading while off network and then syncing back to the servers.

You do not need to track individual serial numbers of currencies specifically because any transaction between individual players must happen through your servers. In other words, your servers are the authoritative source on account balances. Your servers will not ask the user how much money he has. The clients attached to the servers ask the server "How much money does my player have" via an api call. This places an assumption that players aren't doing trading while off network and then syncing back to the server(s) [Though that would be novel, I don't recommend it unless you'd like to spend a lot of time in theory].

In the example of government currency, the only authoritative source is the currency when not attached to the account [A man takes out $200, each bill is "signed" with a serial number that tags it so that others can determine if it's real(if they went through the hassle of doing so) to take it]. When the bill is taken into a bank, there are ways for determining whether serial numbers have been marked as out of circulation, etc]. But, your transactions are more similar to multiple users in a single branch transferring funds between accounts without ever seeing currency.

The main story to illustrate is just who is your authoritative source: I'll try to illustrate: A user wants to take out money from the atm. The user doesn't go to the branch and declare "I have $500, trust me, these are the serials". Instead he gives over the key [account number / key] and the branch /server can notify the user of his funds and allow him to take out currency while diminishing his balance. No matter what a user does to try to convince the bank "Really, I've got $500" unless the authoritative source (the server) verifies the balance, nothing will happen.


share|improve this answer

If you try to program a game simulation based on how the real world works then you are going to run into some big problems when it comes to how much information a computer can process.
Take for instance the following page which is an attempt to calculate how many atoms there are in a grain of sand.

I've seen lots of problems like this from studying chemistry and physics and the ridiculously high number that the person on this page came to is in the ball park of what I've seen various teachers and textbooks come up with. -> 78 000 000 000 000 000 000

Even if this is way off and you remove 6 of those zeroes then you will still have a number that is way too big for the average computer to handle at interactive rates. Especially when there are 1000's of these transactions taking place at any given time.

How could we possibly calculate and track the momentum, positions, velocity, instantaneous accelerations, field charges, etc, of every atom in every grain of sand on a beach if just one grain has 78 000 000 000 000 000 000 individual components. (Or even more if you consider the sub-atomic components.)

I once read an nVidia graphics programming document that stated something like the following.
Do what gives the best approximation of looks good because no one will really be able to tell if the simulation is not 100% accurate. Efficiency has to be taken into consideration.

The same applies for every type of game simulation even if it does not have to do with graphics. You should probably only do the bare minimum of what it takes to get things working. If you go all out here then you will bury the computer in complexity that it cannot handle.
You will also have to write and try and maintain code of this complexity.

You could give unique serial numbers to every unit of currency but you will use up all the computer's resources just on this one detail.

Maybe a better way to handle this is to give only 1 unique identifying for each transaction.

So player #1 pays player #2 $1000000.
If you give each dollar a unique identifier, many people's computers will start to have big problems, not to mention all the network traffic and the lag this will cause.

Or you can just create one value that represents the entire transaction.

uint transferFunds_Player1ToPlayer2 = 1000000;

Even a 20 year old pocket calculator can handle something like this.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.