[MUD-Dev2] [TECH] Implementing currency without implementing currency
William Leader
william at profitdevelopers.com
Thu Jul 13 10:49:48 CEST 2006
Hello All,
I've given my self a good challenge. K2WRPG is to the point were I
am ready to start adding code for economic activities. I suppose if I
wanted the easy way out, I could just strap a currency field/property to
the character record/object but then that would be too easy right? The
engine has been so far designed so that it has no concept of things like
Hit/Health Points, Experience points, skills, weapons, armor, classes,
races, etc. But a game can be created that has all of these things. So
my thinking is that if I can have an engine that doesn't know what Hit
Points are, why does the engine have to know about things like Money?
Just so that you understand the implementation that I have so far,
is that everything in the game world is an object, and all objects are
treated just about equally. Characters are objects. Mobiles are objects,
Weapons, Armor, Skills... they are all objects. All objects are owned by
another until you get to the system object. I've recently made a diagram
(http://www.k2wrpg.org/wiki/uploads/ScopeOverview.png) to help explain
this. So currently the basic economic system is just barter system.
characters can select items that they wish to trade with another player.
This is pretty easy for me to implement, since once the trade is agreed
upon, the objects just have the owners changed.
Now this is all well and good, but I can't expect any kind of real
economy to develop without currency. Mainly because I can't figure out a
way for NPC merchants to determine what is a fair trade. I figure that
for NPC Merchants to function they are going to have to know a price for
any given item, and be able to sell the item for a price, and buy the
item for a price. The question becomes how?
To make things even more difficult, I want the engine to be capable
of supporting multiple currencies. Now I know that A Tale in the Desert
has a system where any player can build a mint and start creating items
know as 'scrip' that can be used as money. But from what I understand
the code behind ATITD has no concept of money, so basically it becomes
another object that can be traded. Having never played it, I'm not sure
how it all works. Does ATITD even have computer controlled merchants?
Let me take another paragraph to collect my thoughts. I want
multiple currency support so if I break down and add a currency field to
the objects and database, then this won't be possible without having a
currency table that has a composite key of Currency Type+Character and
value indicating how much of that currency the character has. Thats not
quite so clean I feel like this would create a great deal of work to
get the code working. The other option is to create currency objects
using the existing object system. For this to work, NPC's will need to
be told what objects they will accept as currency (this is kind of easy
for me.)
So assuming that I have a mechanism for NPC's to know what they will
and won't accept as currency. The only remaining question is how to
count it. The code does not currently support stackable objects. If a
character has two of something, then there are two instances of the
object not a big deal since they are just another record in the
database. So right now If I wanted a character to have say, 100 gold
pieces than that becomes 100 records in the database. It also becomes
100 items in the players inventory to manage. Thats not so good.
Currency in this form demands stackable objects. I just don't see away
around it. In the past I have avoided stackable items for no other good
reason than that I have heard they are the source of most duping bugs.
Is there any truth to this or am I just being paranoid?
Has anyone got any ideas or suggestions for a currency system that is
not just a currency field in the database on the characters table? The
only idea that seems to meet my needs requires implementation of
stackable objects.
-Will
http://www.k2wrpg.org/
More information about the mud-dev2-archive
mailing list