Search Unity

Help Wanted Variable price (cost) transaction

Discussion in 'Game Foundation' started by Sukender_OB, Nov 18, 2020.

  1. Sukender_OB

    Sukender_OB

    Joined:
    Nov 14, 2019
    Posts:
    18
    Hi!

    I'm currently moving from an old inventory/rewards system (fully in-game, no IAP, soft currency) to Game Foundation (IAP, soft+hard currencies).

    However, in this system, some simple transactions (gold => item) have variable costs : item price depends on the amount in inventory (a ComputePrice() method reads the inventory). Hence each time you buy an item, its price increases. What would be the best approach implementing with GF, according to you?

    Thanks.
     
  2. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @Sukender_OB,

    Thanks for checking out Game Foundation! We don't currently have any way to change the price of a given transaction at runtime, like having it call a ComputePrice-type method. As a workaround I would suggest creating a different transaction for each price you want, and then determining at runtime which transaction you want to show (you can create one transaction with all the info for it you want and then click duplicate for each subsequent one you need to create, changing the name/key/cost quantity). I hope that helps!
     
  3. Sukender_OB

    Sukender_OB

    Joined:
    Nov 14, 2019
    Posts:
    18
    Thanks @erika_d . Unfortunately there is an unknown / infinite number of possible virtual transactions here. I saw your answer in a similar post ( https://forum.unity.com/threads/dyn...ncy-and-transaction-values-at-runtime.978192/ ) and I think there is a workaround to be created on my side. Maybe I'll hard-limit the variants, or change the game design, or perform some pseudo-transactions outside GFoundation then perform a dummy one (ex: "spend 1 gold, get a dummy item/coin") in a loop...

    Anyway, if virtual (non-IAP) transactions cannot be updated at runtime, maybe a kind of callback or formulae could be added as a "currency" in future releases? Well, just my two cents!

    Thanks again for your answer.
    Cheers,
     
    dasparadoxon and erika_d like this.
  4. dasparadoxon

    dasparadoxon

    Joined:
    Aug 16, 2014
    Posts:
    11
    This is another problem I have as well, since I am doing a small farm game combining my self-written InterAction Framweork with the excellent Game Foundation, so far so good, but I wanted to add a feature in one of the next iterations that the price for selling vegetables on the market depends on real world prices from real data feeds. (maybe the player could then follow real world markets and wait with selling e.g. :) )

    Thus the transaction prices would have to change in real time. Creating a LOT of different transaction for a lot of vegetables (more than 4 will come) would make this very confusing and may cause performance issues maybe.

    So a feature like "transaction change history" or something would be really, really helpfull, imho.
    afarmersbarn_screen12.jpg
     
    erika_d likes this.
  5. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @dasparadoxon,

    Thanks for adding your vote on transactions with more adjustable pricing, I've made a note about the additional interest in it, although I don't have any info about when we may be able to add a feature like that at this time. Really cool idea about tying the in game prices to real world though, and I can definitely see how creating transactions to cover every such case would be prohibitive.
     
    dasparadoxon likes this.
unityunity