[MUD-Dev2] [TECH] Implementing currency without implementing currency

Mike Rozak Mike at mxac.com.au
Fri Jul 14 11:49:03 CEST 2006


William Leader wrote:
> 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.

Step one: Impliment stackable objects (aka: collections).

>From there, this is what I did:

1) All objects have a value in inflation adjusted units. An IAU = the value 
of one hour of "typical" NPC labor. Thus, if a sword takes 100 NPC hours to 
make, it's value is 100 IAU. (You can assign a different meaning, but having 
a value independent of currency is good.)

2) Come up with a relational value between gold, silver, copper, etc. 1 gp = 
16 sp, etc.

3) Have a changable constant that converts from IAU's to gp (and thus sp, 
etc.) This can be changed to impliment inflation.

4) Write a funtion that goes from IAU to coins. Note: You'll need to have a 
limiting number of "types of coin" in the price, otherwise you'll get 
merchants selling items for "3 pp, 2 gp, 12 sp, 1 cp"... which would never 
happen. They'd probably round off to "3 pp, 3 gp".

5) Write a function that finds all the coins in the player's possession that 
they can get ahold of. (They can't get ahold of currency locked away in 
chest for which they have no key.)

6) Write a function to take currency away from players as appropriate, or 
give them currency.


Mike Rozak
http://www.mxac.com.au 




More information about the mud-dev2-archive mailing list