Are 80 attributes too many?
After finding rather serious bug in Lefty, I've decided to make all levels playable, like in Bubble Ball. (So you don't have to complete level 3 before playing level 33).
Two questions, though:
1) Can I save up to 80 attributes? Or is that to many? Is there a limit?
2) Should I remove my game from the App Store, until it's fixed? Is that possible? Suggestions, please!
Two questions, though:
1) Can I save up to 80 attributes? Or is that to many? Is there a limit?
2) Should I remove my game from the App Store, until it's fixed? Is that possible? Suggestions, please!
Comments
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
This would work well if you have multiple profiles and want to store one number in place for all profiles, or if you want to store an entire players inventory (of under 30) in one int.
If you have a Boolean attribute like 'owns gold sword', you can save all profiles info in one integer by decoding it into boolean numbers. Let's say profiles 1 and 3 own the sword, but profiles 0, 2, 4 and 5 don't. You could encode that information by having the user select a profile number, then adding that number to the power of two on top of the sword integer.
The integer for profiles 2 and 4 would be: 10
then you can decode this by breaking the 10 into binary:
P5) 32 = 0
P4) 16 = 0
P3) 8 = 1 <<
P2) 4 = 0
P1) 2 = 1 <<
P0) 1 = 0
2 + 8 = 10
If profile 2 obtains the sword, you add 2^Pnum (2 to the power of the player profile integer) to the sword integer, then resave the attrib. In this case, 10 + 4 = 14. 14 in binary means the 2, 3, and 4th digits are 1s, which corresponds to the 2, 3, 4th profiles.
When you go to decode it's a bit trickier. You have to use (MOD(2^(profileNumber+1)))-(MOD(2^(profileNumber))). If that equation is greater than 0, you know the player has gotten the item.
I know this sounds like extra work, but it doesn't take long to set up. You can store the equivalent of 30 (possibly more) Boolean attribs in there. So if you have thirty items in your game with 3 profiles, you can load them all in 3 integers instead of 90 booleans, which can be a pain to set up.
You also dont have to worry much about this slowing down your load time because the info can be decoded when you need it, and it's a simple equation, so it's quick.
Epic Math loads about 70 separate attribs when it boots up, and has about 210 overall. I think it works ok, but if you want to stagger it you could always load them behind a splash screen.
and 80 int is only 40K, so it should not be a problem
_________________________
http://www.thatgameforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
http://gamesalad.com/wiki/
http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./Home.html
http://www.gamesalad.es/
http://thatgameforum.com/threads/gs-videos.360/
my email: calvin9403@hotmail.com
my skype: calvin9403