Sign in to follow this  
  • entries
    78
  • comments
    74
  • views
    72085

Playtesting

Sign in to follow this  

249 views

I'm so glad that I've taken more time working on this iteration of iHero. Playtesting this week revealed a flaw that can keep you trapped in a specific city without any help of leaving unless you use your Reward Points. An easy fix, but could have been very bad in production.

Now my only problem is avoiding feature creep. I have way too many things that I want to do with iHero but only a limited amount of time. So I'm going to re-submit it to Apple on Monday and start doing weekly updates thereafter. Should help me with my need to keep 'improving' the game and give stable players new content to look forward to. Since everything is in place infrastructure-wise it should be fairly simple to keep adding new powers, actions, items, and locations. Famous last words right?

So this weekend is all about fixing an error in the way my data is being read in from the time server. For some reason it seems to truncate it as an int instead of a long so my seconds are all off. Hopefully a quick google search will give me some decent code to use. Here is what I have now:

EDIT: Got it. Now take all of the code below and replace it with the following line:

timeString = [[NSString alloc] initWithData:receivedData encoding:NSASCIIStringEncoding];



-(NSString*)getStringFromBytes:(NSData*)data
{
int length = [data length];
const uint8_t *bytes = (const uint8_t *)[data bytes];

if(length < 4)
; // oops, handle error

// demarshall the big-endian integer from 4 bytes
uint32_t myInt = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | (bytes[3]);
// convert from (n)etwork endianness to (h)ost endianness (may be a no-op)
// ntohl is defined in
myInt = ntohl(myInt);

// advance to next datum
bytes += 4;
length -= 4;

// demarshall the string length
if(length < 2)
; // oops, handle error
uint16_t myStringLen = (bytes[0] << 8) | (bytes[1]);
// convert from network to host endianness
myStringLen = ntohs(myStringLen);
bytes += 2;
length -= 2;

// make sure we actually have as much data as we say we have
if(myStringLen > length)
myStringLen = (uint16_t)length;

// demarshall the string
NSString *myString = [[NSString alloc] initWithBytes:bytes length:myStringLen encoding:NSUTF8StringEncoding];
bytes += myStringLen;
length -= myStringLen;

return myString;
}


Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now