Log in

View Full Version : Game Mechanics: funny math


Akfar
10-05-2010, 11:26 AM
I am in oggok today making feild point arrowheads for skillups on gugruk and selling them to the vendor Zarg Knightbane. he gives 5c per arrowhead, thus 1g per stack.

I sell by the stack it says you receive 1 gold from Zarg Knightbane, but I actually recieved 9s 3c. If I sell them individually instead of by the stack I get a full 1g.

With that in mind I proceeded to sell stacks of water to see what happens.

Zarg Knightbane tells you "I'll give you 9 copper per water flask", which is true.

9c per flask X 20= 1g 8s,which the message said, but when you sell by the stack he gave me 1g 8s 6c

Proceeded to log on akfar in felwithe went to merchant Irontree.
"I will give you 1 silver per water flask"
"You recieve 2 gold from merchant irontree"
Yet what i recieved was 1g 9s 1c
Repeated with the same effect

I did notice a post in the search about being overcharged per stack but nothing about selling stacks either giving too much or too little.

Guess I do everything individually now

Aadill
10-05-2010, 11:38 AM
It's easier to say, "I will give you 1 silver per water flask" instead of "I will give you 9.55 copper per water flask."

It's rounding because otherwise you have bits and pieces of coin.

khazim
10-05-2010, 11:41 AM
^ I was noticing this last night, strangely enough, when making field point arrowheads. But I've seen it with Water flasks, empty bottles. I think it's rounding up to the nearest monetary increment when it tells you what you'll receive, hence why selling individually nets you more than as a stack.

Aadill
10-05-2010, 11:44 AM
Correct. The rounding is merely done because splitting the smallest monetary value is not allowed. It's like gasoline. $2.57 and 9/10 of a cent. No matter what the end result is, it's rounded, because you aren't going to be able to pay a fraction of a penny

Akfar
10-05-2010, 11:59 AM
Oh well, I can deal with it.

But with your gasoline analogy... gas is advertised as 2.569 thus fractions of pennies. The items in game are not.

But with what you are saying the server is offering me 4.65c per arrowhead by the stack, when anything below a whole copper number is not allowed. :confused:

Not a big deal i can use the controll button when i vendor.

Aadill
10-05-2010, 12:16 PM
Gasoline analogy: It is advertised as 2.569 but when you buy, say, 9 gallons of gas, it is $23.121. You pay $23.12 or $23.13 depending on the rounding method (closest to zero or next highest whole number).

The game is displaying whole number values only. You are receiving 4.65c per arrowhead but you're probably going to see 5c returned to you, as it is being rounded. In another instance you may see 4s but it's only giving you 3s 9c because it's possibly 3.93s. It's not funny math, it's just basic rounding.

Keep in mind that modifiers exist (CHA, faction) that are adjusting those values, as well. I don't know if it's a % modifier but it would explain the fractions of copper and silver. In the end, however, it's pocket change. Over the course of actively playing on this server for a year you *may* waste a few plat depending on the over/under rounding. If it does bother you, though, like you said, just use CTRL when you sell.

Akfar
10-05-2010, 01:57 PM
I understand that, but what I guess i'm getting at is, the client and server are calculating two different numbers.

On live same combine 4c per sale sold stack message said I recieved 8s and I recieved 8s.

if the client is rounding the number 4.65 or 5.34 to 5c why can't the server also do that so when it says you have recieved 1g you get 1g not 9s3c or 1g5c.

There has to be a way to make the server do the same calcualtion as the client. I dont care that its giving me 9s3c but it should say i'm getting 9s3c.

Maybe it does both calculations client side and its just the way it is.. you know how soe is..

Either way its not that big of a deal, and I did not need the mathmatics education. I had learned basic rounding 28 years ago.

This is a bug report forum, I reported a bug on selling that did not come up on forum search. Any way you slice it "you have received 1 gold from merchant X" does not equal 1gold 5copper or 9 silver 3 copper

khazim
10-05-2010, 03:19 PM
^ This. the base math of selling a stack is not "quoted Prices" * 20, rounded to nearest even money amount.

Basically, if selling a stack gives you 9 silver and 3 copper instead of 1 gold, the game should state upon sale "You receive 9 silver, 3 copper from Merchant", not "You receive 1 gold from Merchant."

Aadill
10-05-2010, 03:25 PM
Here's a question:

Did this start happening when the group code/money split was patched?

Aqua
10-05-2010, 08:34 PM
For the previous poster...no, this existed before the group changes patch.

I haven't gone through the code enough to know all the ins and outs but I found what seems to be the appropriate area in client_packet.cpp. These two lines seems to be the good ones (depending on the server's config):

price=(int)((item->Price*mp->quantity)*(RuleR(Merchant, BuyCostMod))*Client::CalcPriceMod(vendor,true)+0.5 ); // need to round up, because client does it automatically when displaying price

price=(int)((item->Price*mp->quantity)*(RuleR(Merchant, BuyCostMod))+0.5);

So I think this simplifies to something like this pseudocode:

TotalPrice = INT( price * quantity * Greediness * FactionMod + 0.5 )

Which rounds the price only after everything else. Could the solution be to do compute the single item price then multiple by the quantity like so?

TotalPrice = INT( (price * Greediness * PriceMod + 0.5)) * quantity