Search Unity

Virtual goods into physycal goods.

Discussion in 'Game Design' started by Elvizcocho, Jan 30, 2018.

  1. Elvizcocho

    Elvizcocho

    Joined:
    Dec 24, 2017
    Posts:
    15
    Good day to all of you. I refer to unity forums after a long research I do on the web with no good results. Basically, I create a 2D game where the player earns "coins" (virtual goods) each time he passes or succeeds in a new game level. I want to be able that the player can change this "coins" (virtual goods) for real products that I'm selling in my webpage.

    When the player has enough "coins" to trade it for the physical good, what i want is he goes to my webpage and change this "coins" for the product he wants, then the "coins" reduce for the amount he trades in the game. Im using unity and I made a webpage with WordPress (IM TOTALLY NEW IN PROGRAMMING, JUST 2 MONDS WORKING IN IT) and i want that the player can acquire these products (physical goods) that are promotional brand products.

    How can i do this? applying the code to unity its a simple idea, I read some tutorials on how to buy in-app virtual goods, but this can be only used in the game. Also, there's no a plugin for WordPress that let me choose a new "coin" for buying or trade it into a product (physycal good). Im from spain and i hope to all unity community that you understand what i want to achieve, my English is no so well.

    Thanks for the support.
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    You probably want to check proper legal to make sure you're covered in case of problems with a transactions, refunds, etc. There are quite stringent laws around money laundering, gambling etc. that you'll want to make sure you're not stumbling over. Best to check that early and be sure of what you can/cannot do with this stuff.
     
    Deleted User and Kiwasi like this.
  3. Elvizcocho

    Elvizcocho

    Joined:
    Dec 24, 2017
    Posts:
    15
    thanks for the information, Im going to see all information and then reply againg to you!
     
  4. fetish

    fetish

    Joined:
    Aug 25, 2015
    Posts:
    73
    Giving players real life goods in exchange for in-game currency is essentially always legal (it's how every carney game is set up, every token you get form a skeeball machine, etc work), selling players that in-game currency for real cash is the legal tricky part.

    Legality regardless - the way this works is that the player's currency level is stored in a database which is both web-accessible and accessible in-game. When you "sell" the product online, you simply debit their in-game currency in the database by whatever the amount is. But the key is that there needs to be a way for your game to communicate to the web, and from there, your in-game currency is a resource just like anything else.
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Game client either talks directly to a database (not recommended), or talks to a game server which talks to the database (so that the game server can help prevent unauthorized manipulation of the database). The webserver also talks to this database. Virtual currency and orders for products are all stored and updated in this database.
     
  6. Elvizcocho

    Elvizcocho

    Joined:
    Dec 24, 2017
    Posts:
    15
    What about being able to buy coupon codes in game to use on the web site? and then use the cupon in woocomerce plugin on worldpress, nothing in the legaly information speaks about this!
     
  7. DominoM

    DominoM

    Joined:
    Nov 24, 2016
    Posts:
    460
    It's not the sort of project I'd recommend for someone with only 2 months programming experience. Tying it to real world goods could end up as a very expensive lesson in how players look for ways to abuse game systems.
     
    Deleted User and wccrawford like this.
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Sure you could do that. You still will need a database setup of some kind as I previously described.

    Also what @DominoM said. You're going to be making yourself a target for people who want free stuff by trying to manipulate your webserver or game client in ways you don't expect.
     
  9. Xype

    Xype

    Joined:
    Apr 10, 2017
    Posts:
    339
    You lovely devs are overthinking it! Use wordpress have them go there, do the transaction, set up the in game money much like a credit account, have wordpress/woocommerce take the order, check the account for available funds, complete the transaction and remove the money. Shouldnt take but ehhh 15-20 lines of code to set up that way.

    Trying to set up the transactions to be done from in game isn't difficult but I wouldn't recommend it to a 2 month old dev, theres a lot of security issues you would be programming from scratch easier to go from the outside in, also its less stress on your game server. It just gets a command to check money, then remove money thats it no extra stuff going on for it to handle.
     
  10. Elvizcocho

    Elvizcocho

    Joined:
    Dec 24, 2017
    Posts:
    15

    What I will implement is that the cupon can be used only 1 time per mond! so in case a users want to take advantage they cant do it, just once cupon = one transaction for real goods per mond as a roule. My question is, how does it work better? in a in-app or in-game transaction?
     
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,183
    Wordpress is stupidly popular to hack. You're far better off using a service that was designed for the task and has proven itself over months and years of use than trying to cobble together an unproven solution running on top of a platform never intended for it.

    Remember when that hack inevitably occurs any solutions you've built yourself will have to be troubleshooted and solved by you. This will cost you time and money that the service provider wouldn't have charged had they been hacked.
     
    Last edited: Feb 7, 2018
    Deleted User and Joe-Censored like this.
  12. zakdank

    zakdank

    Joined:
    Jan 25, 2011
    Posts:
    46
    I know this thread is a month old but this is how I would handle it.

    Inside the game I would have events (i.e. completing a level) that each have an id attached to them. This would be sent via www form to a php script alongside an accountid.

    The php script would then lookup the value of the event server-side in either the php script or an sql/other db table. So the variables posted would be for example '25' which would be worth say 100 coins. What I would also do is have a minimum time set for each event, that is a minimum humanly possible timeframe in which it is possible to complete said event. So completing a level should not be possible in 0.01 seconds. I would then have the current time compared against the last time the event occured and if its past the minimum time, update the wordpress database to increase the users 'coins' by the events value. You could use the official points and rewards addon for woocommerce (https://woocommerce.com/products/woocommerce-points-and-rewards/).

    By keeping value serverside, a player wont be able to change the clientside data to represent an absurb value (ie, clicking a button rewards 9999999999999 coins) and by comparing times, the player isnt able to spam the php file for unlimited coins. Obviously someone could still spam the php at the minimum timeframe intervals but thats where you could put a cap on the amount of coins earned per day. You would remove the value from the players remaining daily rewards and then have a task scheduler reset it in a bulk update at midnight each day.

    Edit: also want to say that while its an interesting concept, as others have mentioned, there are lots of potentials to exploit it. I wouldn't agree with the notion that wordpress is easy to hack, it is after all the most used CMS in the world. The majority of hacks are down to poor administration and use of poorly made 3rd party plugins and outdated software (php for example). It is a common (and incorrect) belief that its easy to hack because so many hackers target it, and why wouldnt they with 42% of online stores running woocommerce. I have ran online stores for years and have yet to see a successful attack (you WILL be hit with brute force attacks so I would recommend using cerberus wp security to help negate the attacks). You would need to keep your serverside secure and up to date.

    Not something I would attempt personally due to the amount of potential issues that could be costly but a very interesting concept indeed.
     
    Last edited: Mar 15, 2018