Sign In Register

How can we help you today?

Start a new topic
Answered

Deleting a player EVERYWHERE

Hi,

       I got an issue where I need to delete a player from the database.

Current issue is If i delete from the players list in No-SQL/manage section, still i can have references everywhere in leaderbaords and other places.


How can I make sure I can delete a player completely from the database? i mean games played by him, created, leaderboard entries and all.


I'm in preview mode. Any suggestions would be appreciated.


Thanks,

Ayyappa.


Best Answer

Hi Ayyappa,


Unfortunately there is no way to completely remove a user from the database.

As for leaderboards you could hide them using : hideOnLeaderboards.


Thanks,


Oisin.


Anyway this is possible, team?

Answer

Hi Ayyappa,


Unfortunately there is no way to completely remove a user from the database.

As for leaderboards you could hide them using : hideOnLeaderboards.


Thanks,


Oisin.

Hi, Following that, we have around 200 test accounts and I am sure there are many more to come. It is problematic therefore that we cannot completely remove a player account. What is the logic behind this?

Hi Ethan,


The best way to delete all test data (including test users) would be to have a Multi Stage setup in place for your game. You can read more about it here. With this in place you can simply copy a Snapshot into the next stage when ready. When you do this the copied Snapshot will contain your games Configuration but the runtime collection data will have been cleaned so you wont have to worry about removing each individual test user, test leaderboard entry etc...


Thanks,

Liam

I tried doing this, but the snapshot doesn't get rid of player data.


I created a brand new game and called it Game - Dev.


I then created a snapshot. I copied that snap shot to my other game. I then went to the manage page and did a search on players and all the test players are still there.


Please advise??

Hi Tony,


Apologies if the above explanation wasn't clear enough, if you copy a snapshot to another game, the runtime and system collections aren't copied along with the configuration (and whatever else you choose to copy), so if copying to a brand new game these collections will be blank, however if the target game has any data in runtime or system collections it will remain there. So copying from Game B to Game A as you are doing here will not effect these collections as the ones in the target game will remain untouched. Does that make sense ? 


Thanks,

Liam


So what you are saying is that this is a way to create a game and do a bunch of testing and then copy that configuration over to a clean game and then use the clean game as the new one without any data, right?


Again you are simply confirming that there is no way to remove test data no matter what.


I would encourage your team to make a way to have a testing environment that the data can be cleared out. Maybe you make it special so that it is very clear that data can be deleted.

Is there a way to completely delete a game? I don't want to end up with a bunch of games in my account that are garbage and yet I already have 3 now with test data in them.

I just verified that you can use the NoSQL interface to delete players. This is probably not recommended, but it does work.

Hi Tony,


You can drop certain collections in the NoSql explorers Drop tab.




You can delete game by clicking on the delete icon in the top right hand corner of the portal when in the overview tab.



You can delete players in NoSql but you are correct, it's not a supported method. If you have any further questions just let me know.


Thanks,

Liam

Thanks for the reply.


If I drop a collection like the player collection and then call an api from my game that needs it, does it get recreated?

Hi Tony,


Yes indeed it does. If you have any other questions just let me know.


Thanks,

Liam

Awesome. I am loving Game Sparks, BTW.


I looked at it about a year ago and it has some trouble with the WebGL in Unity. Now that stuff all works and everything is awesome. Great job!

Here's my "DELETE_PLAYER_DATA" event:

 

// ==========================================================
// Req
var reqData = Spark.getData();
var gsid = reqData.gsid;

// ==========================================================
// Collections
var pDataCol = Spark.runtimeCollection("customPlayerData");
var pStatsCol = Spark.runtimeCollection("playerStats");
var pListCol = Spark.runtimeCollection("playerList");
var pFriendsCol = Spark.runtimeCollection("playerFriends");

// ==========================================================
// Data objs : standard query
var pQuery = { "_id" : gsid };
var pData = pDataCol.findOne(pQuery);
var pStats = pStatsCol.findOne(pQuery);
var pList = pListCol.findOne(pQuery);

// ==========================================================
// Data objs : special queries
var fQuery = { "playerId" : gsid };
var pFriends = pFriendsCol.findOne(pQuery);

// We also need to remove from the OTHER side of the friends list
var otherFQuery = { "friendId" : gsid };
var otherPFriends = pFriendsCol.findOne(otherFQuery);

// ==========================================================
// remove, if data
var deleteArr = [];
if (pData)
{
    pDataCol.remove(pQuery);
    deleteArr.push("pData");
}
if (pStats)
{
    pStatsCol.remove(pQuery);
    deleteArr.push("pStats");
}
if (pList)
{
    pListCol.remove(pQuery);
    deleteArr.push("pList");
}
if (pFriends)
{
    pFriendsCol.remove(fQuery);
    pFriendsCol.remove(otherFQuery);
    deleteArr.push("pFriends");
}

// ==========================================================
// Finish up
Spark.setScriptData("info", "REMINDER: System data was not deleted!");
if (deleteArr.length > 0)
    Spark.setScriptData("removed", deleteArr);
else
    Spark.setScriptError("ERROR", "[DELETE_PLAYER] Player db's not found");

 


1 person likes this
Login to post a comment