8/9/2014 - Bartering - Let's try that again :)

Your chance to hear me complain

8/9/2014 - Bartering - Let's try that again :)

PostPosted by Railboy » Sat Aug 09, 2014 9:04 pm

Bartering is finished! I'm really pleased to check this one off because it ties a lot of other systems together.

On some level most rpgs are about stuff. Finding it, hoarding it, using it, buying it, selling it, stealing it. The buying and the selling is important because it makes every item useful to every player. There are seashells in the game but I'm guessing only 1/100 people will be picking up seashells just to keep them, right? Most of you will sell them at the nearest curio shop.

bartering.jpg


Bartering is one of the handful of skills you start the game with. It's also the one place outside of the main quest where your character's reputation has a real effect on gameplay: prices.

Each item in the world has a base currency value. But your bartering skill combined with your reputation determines how much people are willing to pay for those items. Here's the math:

Code: Select all
int TotalValuePlayerGoods;
int TotalValueCharacterGoods;
float repPriceModifier = 0f;
float skillPriceModifier = 0f;
float goodsPriceModifier = 0f;

//recalculate the base value of goods in this barter session
int BaseValuePlayerGoods = RecalculateValueOfGoods (BarterParty.Player, BarterSession.PlayerGoods);
int BaseValueCharacterGoods = RecalculateValueOfGoods (BarterParty.Character, BarterSession.CharacterGoods);

//get the player's reputation with the current character (incorporates global reputation)
ReputationState rep = Profile.Get.CurrentGame.Character.Rep.GetReputation (BarteringCharacter.worlditem.FileName);
repPriceModifier = rep.NormalizedOffsetReputation;//this will be a value from -1 to 1
skillPriceModifier = BarterManager.State.NormalizedOffsetUsageLevel;//this will be a value from -1 to 1
goodsPriceModifier = (repPriceModifier + skillPriceModifier) / 2f;
if (BarterManager.HasBeenMastered) {
   //mastering the barter skill reduces all penalties to zero
   goodsPriceModifier = Mathf.Max (0, goodsPriceModifier);
}
goodsPriceModifier *= Globals.BarterMaximumPriceModifier;

//divide the final modifier by 2 to get its effects on both sets of goods
TotalValuePlayerGoods = BaseValuePlayerGoods + Mathf.FloorToInt (BaseValuePlayerGoods * (goodsPriceModifier / 2f));
TotalValueCharacterGoods = BaseValueCharacterGoods - Mathf.FloorToInt (BaseValueCharacterGoods * (goodsPriceModifier / 2f));


You won't see these hard numbers in-game (though they appear in the screenshot for debugging purposes) but you'll definitely notice when you buy an apple for 5 and can only sell it for 1. This is assuming they'll barter with you in the first place. If your reputation is bad enough they'll simply refuse, in which case you'll have to make a living by stealing. It's a downward spiral of criminal behavior...
Language is to the mind more than light is to the eye.
User avatar
Railboy
Developer
Developer
 
Posts: 1845
Joined: Mon Jul 15, 2013 10:46 pm
Location: Seattle, WA

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by Puntley » Sun Aug 10, 2014 2:14 am

It's looking great, can't wait to get my hands on it! Keep up the good work!
Puntley
Butterfly Painter
 
Posts: 2
Joined: Sat Aug 09, 2014 1:47 am

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by GIJhen » Sun Aug 10, 2014 6:06 am

must play this game for many hours... seriously tho looking great cant wait til it comes out.
GIJhen
Butterfly Painter
 
Posts: 2
Joined: Thu Jul 24, 2014 7:11 pm

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by postnjam » Sun Aug 10, 2014 10:14 am

Awesome, except for one thing....

Why the F**k would you try to sell your lantern? Are you asking to die?
User avatar
postnjam
Dungeon Crawler
 
Posts: 126
Joined: Thu Jul 18, 2013 8:36 pm
Location: Sawbridgeworth , UK

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by yarnevk » Sun Aug 10, 2014 2:16 pm

Railboy wrote:Bartering is finished! I'm really pleased to check this one off because it ties a It's a downward spiral of criminal behavior...


Unless of course one is a charming criminal, then you can kill/steal, blame it on those damn criminals and still get good prices. :cool: Please don't make it like Skryim, make sure the chickens cannot rat me out!
yarnevk
Pathmaker
 
Posts: 178
Joined: Tue Sep 17, 2013 2:48 pm

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by SignpostMarv » Mon Aug 11, 2014 7:41 pm

Will the batering algorithm be easily moddable ?
User avatar
SignpostMarv
Alchemist
Alchemist
 
Posts: 307
Joined: Thu Jul 18, 2013 2:28 pm

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by Railboy » Tue Aug 12, 2014 1:44 pm

SignpostMarv wrote:Will the batering algorithm be easily moddable ?


Goooood question actually. This is a borderline case where modding starts to get difficult.

'Barter' is an extension of the Skill class. It spawns the prefabricated GUI you see above and plugs into it. If you wanted to modify the values that plug into the barter equation you can do that in a text editor, but to actually modify how bartering is calculated or change how it's displayed in the GUI you'd have to write a new Barter class (or extend / override the old one). A serialized Skill object defines which class it should be deserialized into so you could change that to 'BarterAdvanced' or whatever you'd want to call it. This is where it gets tricky. You have to bring that new class into the game. Matthew Davey has worked out a way to do this but I frankly don't understand it well enough to talk about it off the top of my head. It works but it's like black magic to me.

That'll be a good subject for a future devlog, actually. I'll go pester him for details.
Language is to the mind more than light is to the eye.
User avatar
Railboy
Developer
Developer
 
Posts: 1845
Joined: Mon Jul 15, 2013 10:46 pm
Location: Seattle, WA

Re: 8/9/2014 - Bartering - Let's try that again :)

PostPosted by SignpostMarv » Tue Aug 12, 2014 4:47 pm

This question has absolutely nothing to do with wanting to have the price of in-game potatoes go up every year to coincide with the eventual release date of Frontiers :P
User avatar
SignpostMarv
Alchemist
Alchemist
 
Posts: 307
Joined: Thu Jul 18, 2013 2:28 pm


Return to Dev Logs

Who is online

Users browsing this forum: No registered users and 2 guests

cron