Sign In Register

How can we help you today?

Start a new topic
Answered

Events

Good Morning,


I am trying to wrap my head around this concept and need a little help. I am not understanding the difference between events and virtual goods. 


This is what i'm trying to accomplish and need to be pointed in the right direction so i am not working around in circles. In my game i'm going to have unlockable characters, clothes, items, gold, crystals, and etc. What is the best way to achieve this? Create a virtual good for each character, piece of clothing and such? Each of my characters have a unique ID. What i would like to do is when a player logs into the game all their data is loaded such as what characters they have unlocked, their username, gold ammount, crystals and such. I display most of this information onto the start screen of my game.I was going to create an even for load data and save data, but i don't see an option for boolean under the data type to say whether the character is unclocked of not. Should i just make this a string value with a default value as locked? If i do this what is the purpose behind creating the virtual goods if everything is loaded and unloaded from events?


A push in the right direction would be greatly appreciated.


Thanks, 

Joshua Hebert


Best Answer

Hi Joshua,


An easy way to think of it is this way.


You can use Virtual Goods out of the box for setting up Items, Unlockables etc... Using BuyVirtualGoodsRequest, those items will now be associated with the Player profile. By using AccountDetailisRequest you can then retrieve all the items and currency for that specific player without having the need too write LogEvents. You can also use ListVirtualGoodsRequest to get a list of all available Virtual Goods.


LogEvents are used for when you want more control over the above process. For example, maybe when you login you want to retrieve ONLY the items for this player, but also associated Item Information that's not returned by the regular AccountDetailsRequest. For this you would need to write Cloud Code for the event to get the Item information, and also lookup the game config or other database collections to build a JSON response that your client could then use more effectively.


Does that make sense?


-Pádraig


Answer

Hi Joshua,


An easy way to think of it is this way.


You can use Virtual Goods out of the box for setting up Items, Unlockables etc... Using BuyVirtualGoodsRequest, those items will now be associated with the Player profile. By using AccountDetailisRequest you can then retrieve all the items and currency for that specific player without having the need too write LogEvents. You can also use ListVirtualGoodsRequest to get a list of all available Virtual Goods.


LogEvents are used for when you want more control over the above process. For example, maybe when you login you want to retrieve ONLY the items for this player, but also associated Item Information that's not returned by the regular AccountDetailsRequest. For this you would need to write Cloud Code for the event to get the Item information, and also lookup the game config or other database collections to build a JSON response that your client could then use more effectively.


Does that make sense?


-Pádraig

yes it does. Where can i find more documentation on BuyVirtualGoodsRequest, ListVirutalGoodsRequest, and AccountDetailsRequest, so i can see how to code it into unity?



Hi Joshua,


Documentation for each request is as follows:


BuyVirtualGoodsRequestListVirutalGoodsRequestAccountDetailsRequest.


-Pádraig

It's all in the documentation. I'd take a gander through the entire thing before you start working with GameSparks, then play around with different stuff. It helped put thing in the back of my mind when I first started, otherwise you won't know what GS is capable of.

That works for me! Thanks for the help! 


1. If i wanted to hold the character level would that be an event property?


2. How do i delete players from the backend? I created a bunch of test players and i dont see an option to delete them?


Thanks,

I'm not sure how to delete either so I've just been doing it via NoSQL
For me I have a debug event inputing the player ID, and use cloud code to delete him:


 

var playerId = Spark.getData().id;

if (!playerId || playerId === '#')
    playerId = Spark.getPlayer().getPlayerId();

var player = Spark.loadPlayer(playerId);

if (!player) {
    Spark.setScriptError("playerNotFound", {playerId: playerId});
    Spark.exit();
}

player.deletePlayer();

 

 

Login to post a comment