Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: serenefox on August 08, 2014, 02:29:02 PM
-
Hi,
I have searched around for "playmaker" and "long/uint" but have found virtually nothing on it. Is this in playmaker? I am making a mobile game and I am trying to have an int container to hold my in game currency but if it gets to high of a number it resets. I think I need to use a "long" or "uint" but I can't find it in playmaker. These would also be useful for the leaderboards I am to setup. How would I go about doing this? Can a regular int in playmaker take care of it?
Thanks!
-
Hi,
uInt. You can safely use a regular Int, uInt only means it's a positive integer, and saves memory on sensitive and carefully crafted code, in our case, you'll never ever see the difference in 99.9999% of projects :) Simply implement in your code some logic that prevents your int to be negative, which really is about a convention in your code that you would maybe only add to that value, hence never get a chance to become negative, OR if in doubt, implement a logic to do a "max" on the value against 0, so that everytime it's foudn negative, it would be brought back to 0.
Long: that's a bit more tricky, but the margin is very big here, the only difference between an int and a long are its min and max values:
http://stackoverflow.com/questions/1918436/difference-between-long-and-int-in-c
so for any value inbetween -2,147,483,647 and 2,147,483,647 you are safe! which is pretty good if you want to count money in a game :) or any other usual values.
Bye,
Jean
-
Thanks for the quick reply.
I knew the difference of the sizes in the numbers, but I guess you are right for the "unit" I just just set it to not go below. Yet for the "long" I was hoping playmaker had an option for that, because I wanted to have a "total currency collected" leaderboard on iOS and I believe they can reach up to 9,223,372,036,854,775,807. I don't think players will get that high but I would rather have that option as I want to plan for the unexpected. Is there any way of doing this without a long if it is not possible in playmaker?
Maybe have a reserve (int)container that would start filling with values if it went over the max value on the previous container? Then add the two containers if for the leaderboards? I am not too much of a coder which is why I am asking if this will work but I think it might. Any opinions?
-
Hi,
a 20 figures number really doesn't make sense for any values in a leaderboard or for a gamer's data on a game...
If you must use LONG, then consider storing this in a script, and use a set of custom actions for this.
Bye,
Jean
-
How is the leaderboard figured? Are you rolling your own and managing it or pushing data upward? For instance using the Steamworks wrapper or something? I ask because if for instance Steam expects int's from a session and compiles them serverside then you wouldn't need to worry about this.
I don't think long int's are common (at least on the design side of things), so you'll have to write some custom actions to compound the value and convert it to a string if you really need it. There are threads on stack exchange and such for examples and ideas.
-
Lane, I am not to familiar with the terms but if I had to guess, I am pushing data upwards. I am just sending the numbers to apples Game Center and leaderboards by reporting the score after a level ends.
Thank you for your replies but if its going to be this complicated(for me at least) I will just use an int.