[CRASH][1.3.7]SetUserPosition first send crash app

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

[CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 06 Apr 2015, 07:39

I have a problem and ask you help.

I adopt your SpaceWar example for iOS platform. I use your iOS-project Tri experience and Space War unity example.
All is absolutely the same, but on Objective-C
for example

Code: Select all

-(void)onUserVariablesUpdate:(SFSEvent *)evt
{
    //
    SFSUser *user = [evt.params objectForKey:@"user"];
    NSArray *changedVars = [evt.params objectForKey:@"changedVars"];
    //etc
}

-(void)onProximityListUpdate:(SFSEvent *)evt
{
    //
    NSArray* addedUsers = [evt.params objectForKey:@"addedUsers"];
    NSArray* removedUsers = [evt.params objectForKey:@"removedUsers"];
   
    NSArray* addedItems = [evt.params objectForKey:@"addedItems"];
    NSArray* removedItems = [evt.params objectForKey:@"removedItems"];
   
    //Trace the number of changes for each list
    NSLog(@"ProxyUpdate: %d, %d, %d, %d", addedUsers.count, removedUsers.count, addedItems.count, removedItems.count);
   
    //etc
}


The situation
All goes perfect
1. Connection to server
2. Login
3. Join Room (room is static)
4. Spawn model for user (throught uservariable)
5. onUserVariablesUpdate and spawn ship on client

Problem begins then I try to connect another player or even if I spawn a weapon shot on server by fireWeapon command.
I checked server logs, weapon shot is spawned ok and then
I got a message SetUserPosition on client.
It’s first time this method shows in log - and the application crashes.
I think there is something with proximity list. I have no ProximityListUpdate.
It never calls.
I try to make exception breakpoint in Xcode, but it goest inside your code and i couldn’t solve it.

That's the log, last part
[SFS - INFO]Handling Message: SetUserPosition: { Message id: 30 }
{Dump: }
(int) r: 2
(sfs_array) q:
(sfs_array)
(int)0
(sfs_array)
(sfs_array)
(utf_string)vy
(byte)3
(double)0.05746759737538308

(sfs_array)
(utf_string)vx
(byte)3
(double)-0.0263004800697794

(sfs_array)
(utf_string)iModel
(byte)4
(utf_string)Torpedo

(sfs_array)
(utf_string)iType
(byte)4
(utf_string)weapon

(sfs_array)
(utf_string)y
(byte)3
(double)101.996504751687

(sfs_array)
(utf_string)x
(byte)3
(double)80.64140075409303



(sfs_array)
(int)1
(sfs_array)
(sfs_array)
(utf_string)vy
(byte)3
(double)0.05746759737538308

(sfs_array)
(utf_string)vx
(byte)3
(double)-0.0263004800697794

(sfs_array)
(utf_string)iModel
(byte)4
(utf_string)Torpedo

(sfs_array)
(utf_string)iType
(byte)4
(utf_string)weapon

(sfs_array)
(utf_string)y
(byte)3
(double)101.996504751687

(sfs_array)
(utf_string)x
(byte)3
(double)80.64140075409303



(sfs_array)
(int)2
(sfs_array)
(sfs_array)
(utf_string)vy
(byte)3
(double)0.05746759737538308

(sfs_array)
(utf_string)vx
(byte)3
(double)-0.0263004800697794

(sfs_array)
(utf_string)iModel
(byte)4
(utf_string)Torpedo

(sfs_array)
(utf_string)iType
(byte)4
(utf_string)weapon

(sfs_array)
(utf_string)y
(byte)3
(double)101.996504751687

(sfs_array)
(utf_string)x
(byte)3
(double)80.64140075409303



(sfs_array)
(int)3
(sfs_array)
(sfs_array)
(utf_string)vy
(byte)3
(double)0.05746759737538308

(sfs_array)
(utf_string)vx
(byte)3
(double)-0.0263004800697794

(sfs_array)
(utf_string)iModel
(byte)4
(utf_string)Torpedo

(sfs_array)
(utf_string)iType
(byte)4
(utf_string)weapon

(sfs_array)
(utf_string)y
(byte)3
(double)101.996504751687

(sfs_array)
(utf_string)x
(byte)3
(double)80.64140075409303


2015-04-05 00:33:49.482 Space Story RUS HD[2776:727687] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(0x2a8645a7 0x38967c77 0x2a778177 0x39a207 0x3b2fb5 0x3aa0eb 0x3a14b1 0x3a1695 0x39e76f 0x39f1cb 0x385237 0x2a7dba17 0x2a7e5d77 0x2a7db6a3 0x2a2b4cbd 0x2a2b49ab 0x2a2b48df 0x2a82daef 0x2a82b237 0x2a82a64b 0x2a828cc9 0x2a775b51 0x2a775963 0x31cc11a9 0x2ddc7c91 0x36cdb 0x36c68)
libc++abi.dylib: terminating with uncaught exception of type NSException


I looked through message dump and it seems strange that there is three object, not one.

Please, help me!!!
I've tried to solve it for several days and don't have any attempts to try.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby Lapo » 07 Apr 2015, 08:58

Hi,
I am not able to reproduce any of these problems. We have a number of tests that we run originally when developing the MMO-part of the API and they all work just fine. Joining new users or adding/removing MMOItems fires the appropriate events and provides the expected parameters.

Are you sure you don't have server side errors?
Please check the logs and tell us what is going on.

Also please report which SmartFoxServer version you're using.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 07 Apr 2015, 16:41

As I said, I used SpaceWar project for Unity, use server-side (as it was, not changes!) code and adapt client-code Unity for iOS, with help of iOS Tris project.
Here is more of my code

Code: Select all

-(void)makeInit
{
    smartFox = [[SmartFox2XClient alloc] initSmartFoxWithDebugMode:YES delegate:self];
}

-(void)makeConnection
{
    /*
     * Load our XML config file and once done, attempt a connection
     */
    [smartFox loadConfig:@"config.xml" connectOnSuccess:YES];
}

-(void)makeLogin
{
    NSString *sLogin = [NSString stringWithFormat:@"%i",arc4random_uniform(200000)];
    [self login:sLogin];
}

-(void)login:(NSString *)loginName
{
    if(!smartFox.isConnected)
    {
        return [self makeConnection];
    }
    [smartFox send:[LoginRequest requestWithUserName:loginName password:@"" zoneName:@"SpaceWar" params:nil]];
}

-(void)sendPublicMessage:(NSString *)message
{
    [smartFox send:[PublicMessageRequest requestWithMessage:message params:nil targetRoom:nil]];
}

#pragma mark - Event handlers

-(UIViewController *)getLastViewController
{
    AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    return [app getLastViewController];
}

-(void)reflect:(NSString *)method :(SFSEvent*)evt
{
    SEL sel = NSSelectorFromString(method);
    //
    if([self getLastViewController])
    {
        if([[self getLastViewController] respondsToSelector:sel])
            [[self getLastViewController] performSelector:sel withObject:evt];
    }
}

- (void)onConnection:(SFSEvent *)evt
{
    UIViewController *lvc = [self getLastViewController];
    if ([[evt.params objectForKey:@"success"] boolValue])
    {
        NSLog(@"ONLINE: Connected. Please login");
//after that by button click in view we will call makeLogin function
//-(IBAction)clickTutorial:(id)sender
//{
//    [ONLINE_SFS_MANAGER makeLogin];
//}
    }
    else
    {
        NSLog(@"ONLINE: Connection error: %@", [evt.params objectForKey:@"error"]);
    }
}

-(int)getLagValue
{
    return clientServerLag;
}

-(void)onPingPong:(SFSEvent *)evt
{
    clientServerLag = (int)[[evt.params objectForKey:@"lagValue"]intValue] / 2;
}

- (void)onLogin:(SFSEvent *)evt
{
    NSLog(@"onLogin");

    NSLog(@"user = %@",[evt.params objectForKey:@"user"]);
    NSLog(@"data = %@",[evt.params objectForKey:@"data"]);
    //SFSUser *user = [[evt.params objectForKey:@"user"]retain];
    SFSObject *gameData = [evt.params objectForKey:@"data"];
    SFSObject *ships = [gameData getSFSObject:@"starships"];
    NSArray *shipsModels = [ships getKeys];
    //SFSObject *weapons = [gameData getSFSObject:@"weapons"];
    //
    SFSUserVariable *userVariable = [SFSUserVariable variableWithName:UV_MODEL value:@"Astro"];
    NSArray* userVars = [NSArray arrayWithObject:userVariable];
    [smartFox send:[SetUserVariablesRequest requestWithUserVariables:userVars]];
    //
    [LagMonitor initWithInterval:1 qSize:5 smartfox:smartFox];
    [smartFox send:[JoinRoomRequest requestWithId:@"Sol"]];
}

- (void)onRoomJoin:(SFSEvent *)evt
{
    NSLog(@"onRoomJoin");
    [self reflect:@"onRoomJoin:" :evt];
    //
    SFSRoom *room = [evt.params objectForKey:@"room"];
    //MMORoom *roomMMo = [evt.params objectForKey:@"room"];
    if (![room isGame])
        NSLog(@"Non game room");
    else
        NSLog(@"Game room");
// my code to start new level here!!!
    //Application.LoadLevel("Game");
    [IPhone startNewGame:GAMEMODE_ONLINEGAME difficultyLevel:GAMEDIFFICULTY_LEVEL_EASY];
    if([self getLastViewController])
        [[self getLastViewController] dismissModalViewControllerAnimated:YES];

}

- (void)onRoomJoinError:(SFSEvent *)evt
{
    [self reflect:@"onRoomJoinError:" :evt];
}

- (void)onUserEnterRoom:(SFSEvent *)evt
{
    NSLog(@"onUserEnterRoom");
    [self reflect:@"onUserEnterRoom:" :evt];
    //
    SFSRoom *room = [evt.params objectForKey:@"room"];
    SFSUser *user = [evt.params objectForKey:@"user"];

    NSLog(@"User: %@ has just joined Room: %@", user.name, room.name);
}

- (void)onUserExitRoom:(SFSEvent *)evt
{
    [self reflect:@"onUserExitRoom:" :evt];
}
- (void)onUserCountChange:(SFSEvent *)evt
{
    [self reflect:@"onUserCountChange:" :evt];
    SFSRoom *room = [evt.params objectForKey:@"room"];
    int uCount = [[evt.params objectForKey:@"uCount"] intValue];
    //NSLog(@"Room: %@ contains %d users and %d spectators", room.name, uCount, sCount);
}

- (void)onPublicMessage:(SFSEvent *)evt
{
    [self reflect:@"onPublicMessage:" :evt];
}

- (void)onPrivateMessage:(SFSEvent *)evt
{
    [self reflect:@"onPrivateMessage:" :evt];
}

- (void)onRoomVariablesUpdate:(SFSEvent *)evt
{
    [self reflect:@"onRoomVariablesUpdate:" :evt];
    //
    SFSRoom *room = [evt.params objectForKey:@"room"];
    if ([room containsVariable:@"player1"] && [room containsVariable:@"player2"])
    {
    }
    else
    {
    }
}

- (void)onObjectMessage:(SFSEvent *)evt
{
    [self reflect:@"onObjectMessage:" :evt];
}

//
+(int)online_getIntUserVariable:(SFSUser *)user name:(NSString *)sName
{
    SFSUserVariable *r1 = [user getVariable:sName];
    return r1 ? [r1 getIntValue] : 0;
}
+(double)online_getDoubleUserVariable:(SFSUser *)user name:(NSString *)sName
{
    SFSUserVariable *r1 = [user getVariable:sName];
    return r1 ? [[r1 getDoubleValue]doubleValue] : .0f;
}
+(BOOL)online_getBoolUserVariable:(SFSUser *)user name:(NSString *)sName
{
    SFSUserVariable *r1 = [user getVariable:sName];
    return r1 ? [r1 getBoolValue] : false;
}
+(NSString *)online_getStringUserVariable:(SFSUser *)user name:(NSString *)sName
{
    SFSUserVariable *r1 = [user getVariable:sName];
    return r1 ? [r1 getStringValue] : nil;
}
+(bool)online_array:(NSArray *)arr hasString:(NSString *)str
{
    for(NSString *item in arr)
    {
        if([item caseInsensitiveCompare:str]==NSOrderedSame)
            return true;
    }
    return false;
}
+(NSString *)online_vectorToString:(SSVector *)v
{
    return [NSString stringWithFormat:@"%.2f%@%.2f%@%.2f",v.m_fX,SEPARATOR_STRING,v.m_fY,SEPARATOR_STRING,v.m_fZ];
}

-(void)onUserVariablesUpdate:(SFSEvent *)evt
{
    NSLog(@"onUserVariablesUpdate");
    [self reflect:@"onUserVariablesUpdate:" :evt];
    //
    SFSUser *user = [evt.params objectForKey:@"user"];
    NSArray *changedVars = [evt.params objectForKey:@"changedVars"];
    if(changedVars && [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_ROTATE])
    {
        if(user != smartFox.mySelf)
        {
                int r1 = [SSOnlineSmartFoxManager online_getIntUserVariable:user name:UV_ROTATE];
                [ONLINE_GAME setStarshipRotating:user.id rotation:r1];
        }
       
    }
    if (changedVars && ([SSOnlineSmartFoxManager online_array:changedVars hasString:UV_X] ||
                        [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_Y] ||
                        [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_VX] ||
                        [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_VY] ||
                        [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_DIR] ||
                        [SSOnlineSmartFoxManager online_array:changedVars hasString:UV_THRUST]))
    {
        // Create current user starship if not yet existing
        // For debug purposes, if the AoI is smaller than the viewport size, display it around the current user starship
        if (user && (user == smartFox.mySelf))
        {
            bool bHere = true;
            bHere = bHere;
            [ONLINE_GAME createStarship:user.id name:user.name isMine:true scriptID:[SSOnlineSmartFoxManager online_getStringUserVariable:user name:UV_MODEL]];
        }
       
        // Reset user starship state in simulator, taking lag into account
        float x = (float)[SSOnlineSmartFoxManager online_getDoubleUserVariable:user name:UV_X];
        float y = (float)[SSOnlineSmartFoxManager online_getDoubleUserVariable:user name:UV_Y];
        float vx = (float)[SSOnlineSmartFoxManager online_getDoubleUserVariable:user name:UV_VX];
        float vy = (float)[SSOnlineSmartFoxManager online_getDoubleUserVariable:user name:UV_VY];
        float direction = (float)[SSOnlineSmartFoxManager online_getDoubleUserVariable:user name:UV_DIR];
        bool t = [SSOnlineSmartFoxManager online_getBoolUserVariable:user name:UV_THRUST];
        //
        SSVector *pos = [[SSVector alloc]initWithX:x Y:y Z:Z_NULL];
        SSVector *dir = [[SSVector alloc]initWithX:vx Y:vy Z:Z_NULL];
        [ONLINE_GAME setStarshipRotating:user.id rotation:direction];
        [ONLINE_GAME setStarshipPosition:user.id pos:pos dir:dir thrust:t];
        SAFE_RELEASE(pos);
        SAFE_RELEASE(dir);
    }
}

-(void)onProximityListUpdate:(SFSEvent *)evt
{
    NSLog(@"onProximityListUpdate");
    [self reflect:@"onProximityListUpdate:" :evt];
    //
    NSArray* addedUsers = [evt.params objectForKey:@"addedUsers"];
    NSArray* removedUsers = [evt.params objectForKey:@"removedUsers"];
   
    NSArray* addedItems = [evt.params objectForKey:@"addedItems"];
    NSArray* removedItems = [evt.params objectForKey:@"removedItems"];
   
    //Trace the number of changes for each list
    NSLog(@"ProxyUpdate: %d, %d, %d, %d", addedUsers.count, removedUsers.count, addedItems.count, removedItems.count);
   
    //Proceed with rendering the users and items on screen
    //...
    //...
    for(SFSUser *ru in removedUsers)
    {
    }
   
    // Loop the addedUsers list in the event params to create the starships now visible
    // To the usual lag we add 10ms, which is half the value of the proximityListUpdateMillis setting on the server
    // As we don't know exactly after how much time the update event was fired after the users updated their positions in the MMORoom
    // (could be 0ms up to 20ms), we use half the proximityListUpdateMillis value as a sort of mean value for an additional corretion of the lag
    for(SFSUser *au in addedUsers)
    {
    }
   
    // Loop the removedItems list in the event params to remove the weapon shots no more visible
    // NOTE: sprites might have been already removed in case the shots explode within the AoI of the user
    // (notified by a dedicated Extension response)
    for(MMOItem *ri in removedItems)
    {
    }
   
   
    // Loop the addedItems list in the event params to create those now visible
    // The same note about addedUsers applies here
    for(MMOItem *ai in addedItems)
    {
    }
}



Server-side code is Space War java source code.
If you want - i can send it you by e-mail, don't want to trash this topic.
But it's absolutely jave-code of your Space War, i couldn't even do anything there.

Maybe the problem is, I prepose
in your SpaceWar user select ship model, after that select room (Sol) and after that goes to game.
I skipped this select screens, made auto-paste model Astro and select Sol room.

Please, help me! You are my last hope!
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 07 Apr 2015, 16:43

And about the version.
I'm using last version from you site.
SmartFoxServer_2X, 2.9.0
for Mac OS.
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 08 Apr 2015, 08:12

Code: Select all

2015-04-08 11:09:17.666 Space Story RUS HD[1633:23297] [SFS - INFO]Handling Message: UserCountChange: { Message id: 1001 }
{Dump: }

   (int) r: 1
   (short) uc: 1
2015-04-08 11:09:20.105 Space Story RUS HD[1633:23297] [SFS - INFO]WRITE - Written directly to outStream len:66
2015-04-08 11:09:20.105 Space Story RUS HD[1633:23297] [SFS - INFO]Data Write: Binary Size: 66
80 00 3f 12 00 03 00 01 63 02 01 00 01 61 03 00    ..?.....c....a..
0d 00 01 70 12 00 03 00 01 63 08 00 0c 63 6f 6e    ...p.....c...con
74 72 6f 6c 2e 66 69 72 65 00 01 72 04 00 00 00    trol.fire..r....
01 00 01 70 12 00 01 00 04 77 6e 75 6d 04 00 00    ...p.....wnum...
00 01                                              ..             
2015-04-08 11:09:20.171 Space Story RUS HD[1633:23297] [SFS - INFO]Data Read: Binary Size: 168
80 00 a5 12 00 03 00 01 61 03 00 1e 00 01 63 02    ........a.....c.
00 00 01 70 12 00 02 00 01 72 04 00 00 00 01 00    ...p.....r......
01 71 11 00 01 11 00 02 04 00 00 00 00 11 00 06    .q..............
11 00 03 08 00 02 76 79 02 03 07 bf ad 75 49 8f    ......vy.....uI.
e1 da c0 11 00 03 08 00 02 76 78 02 03 07 3f 91    .........vx...?.
6d 9e d2 52 85 4b 11 00 03 08 00 06 69 4d 6f 64    m..R.K......iMod
65 6c 02 04 08 00 07 54 6f 72 70 65 64 6f 11 00    el.....Torpedo..
03 08 00 05 69 54 79 70 65 02 04 08 00 06 77 65    ....iType.....we
61 70 6f 6e 11 00 03 08 00 01 79 02 03 07 40 52    apon......y...@R
82 d9 33 43 f4 92 11 00 03 08 00 01 78 02 03 07    ..3C........x...
40 50 8b d0 8f cc 3a 2c                            @P....:,       
2015-04-08 11:09:20.171 Space Story RUS HD[1633:23297] [SFS - DEBUG]Handling New Packet
2015-04-08 11:09:20.171 Space Story RUS HD[1633:23297] [SFS - DEBUG]Handling Header Size. Size: 167 (small)
2015-04-08 11:09:20.171 Space Story RUS HD[1633:23297] [SFS - DEBUG]Handling Data: 165, previous state: 0 / 165
2015-04-08 11:09:20.172 Space Story RUS HD[1633:23297] [SFS - DEBUG]<<< Packet Complete >>>
2015-04-08 11:09:20.172 Space Story RUS HD[1633:23297] [SFS - INFO]Handling Message: SetUserPosition: { Message id: 30 }
{Dump: }

   (int) r: 1
   (sfs_array) q:
      (sfs_array)
         (int)0
         (sfs_array)
            (sfs_array)
               (utf_string)vy
               (byte)3
               (double)-0.05753545647978831
            
            (sfs_array)
               (utf_string)vx
               (byte)3
               (double)0.01701973112779357
            
            (sfs_array)
               (utf_string)iModel
               (byte)4
               (utf_string)Torpedo
            
            (sfs_array)
               (utf_string)iType
               (byte)4
               (utf_string)weapon
            
            (sfs_array)
               (utf_string)y
               (byte)3
               (double)74.04450685154214
            
            (sfs_array)
               (utf_string)x
               (byte)3
               (double)66.18460459655824
            
         
      
   
2015-04-08 11:09:20.684 Space Story RUS HD[1633:23297] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]'
*** First throw call stack:
(
   0   CoreFoundation                      0x038ff466 __exceptionPreprocess + 182
   1   libobjc.A.dylib                     0x034c1a97 objc_exception_throw + 44
   2   CoreFoundation                      0x037d5433 -[__NSArrayM objectAtIndex:] + 243
   3   Space Story RUS HD                  0x004562b7 CreateDispatchTimer + 37689
   4   Space Story RUS HD                  0x00474bdb CreateDispatchTimer + 162909
   5   libobjc.A.dylib                     0x034d7771 -[NSObject performSelector:withObject:] + 70
   6   Space Story RUS HD                  0x0046a3bd CreateDispatchTimer + 119871
   7   Space Story RUS HD                  0x0045f64c CreateDispatchTimer + 75470
   8   Space Story RUS HD                  0x0045f876 CreateDispatchTimer + 76024
   9   Space Story RUS HD                  0x0045bd37 CreateDispatchTimer + 60857
   10  Space Story RUS HD                  0x0045c999 CreateDispatchTimer + 64027
   11  Space Story RUS HD                  0x0043c913 __destroy_helper_block_86 + 17747
   12  CoreFoundation                      0x0386356b _inputStreamCallbackFunc + 75
   13  CoreFoundation                      0x038634df _signalEventSync + 191
   14  CoreFoundation                      0x03863409 _cfstream_solo_signalEventSync + 249
   15  CoreFoundation                      0x038632dd _CFStreamSignalEvent + 429
   16  CoreFoundation                      0x03863127 CFReadStreamSignalEvent + 39
   17  CFNetwork                           0x0244c7c6 _ZN12SocketStream40dispatchSignalFromSocketCallbackUnlockedEP24SocketStreamSignalHolder + 66
   18  CFNetwork                           0x0244c3cf _ZN12SocketStream14socketCallbackEP10__CFSocketmPK8__CFDataPKv + 225
   19  CFNetwork                           0x0244c2c2 _ZN12SocketStream22_SocketCallBack_streamEP10__CFSocketmPK8__CFDataPKvPv + 74
   20  CoreFoundation                      0x03862c41 __CFSocketPerformV0 + 881
   21  CoreFoundation                      0x0382298f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
   22  CoreFoundation                      0x0381849d __CFRunLoopDoSources0 + 253
   23  CoreFoundation                      0x038179f8 __CFRunLoopRun + 952
   24  CoreFoundation                      0x0381737b CFRunLoopRunSpecific + 443
   25  CoreFoundation                      0x038171ab CFRunLoopRunInMode + 123
   26  GraphicsServices                    0x050ac2c1 GSEventRunModal + 192
   27  GraphicsServices                    0x050ac0fe GSEventRun + 104
   28  UIKit                               0x008ac9b6 UIApplicationMain + 1526
   29  Space Story RUS HD                  0x0009b7b2 main + 130
   30  libdyld.dylib                       0x03dd2ac9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 08 Apr 2015, 11:50

And one more thing.
There is no code examples for iOS of MmoRoom or SpaceWar project.
May be you have any code examples of mmo, something short, how to make iOS work with mmo room.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby Lapo » 08 Apr 2015, 13:35

Hi,
you didn't tell me if you had any server-side errors.

As regards your code... I really don't know. The Space War example is the most complex we have, it's made of lots of classes and you have just posted a snippet. We can't provide code reviews in the forums. They take too much time. I hope you understand.

The problems you are reporting may be caused by simply using the API in the wrong way, but I don't have enough data to come to that conclusion.

If you have a working example that you can send me I will take a look, although as I side I will be unable to make a review of your code.

You can zip it and send it to our support@... email box with a reference to this thread.

NOTE: I take it that you're using the SpaceWar Extension without modifications. If you have modified the code I won't be able to help.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby Lapo » 08 Apr 2015, 13:57

snuch wrote:And one more thing.
There is no code examples for iOS of MmoRoom or SpaceWar project.
May be you have any code examples of mmo, something short, how to make iOS work with mmo room.

You are right, at the moment there's no MMORoom example for iOS, thought the API are consistent across all supported platforms. So if you study how it works in Java or C# you can apply it in any other language.

We plan to add at least one example for iOS in the near future.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 09 Apr 2015, 19:37

Lapo wrote:If you have a working example that you can send me I will take a look, although as I side I will be unable to make a review of your code.
You can zip it and send it to our support@... email box with a reference to this thread.
NOTE: I take it that you're using the SpaceWar Extension without modifications. If you have modified the code I won't be able to help.


Big problem is that I try to connect SFS to my single-player game. It's a huge game, a Space Story. And all parts, if i send you all of this, gfx engine, hud, etc... it's a thousands of code lines.

I will try to make a simple project, based on your example, Connector or Tris, but adapt in to MMo. And send to you.
No, I'm not usign any modification for SpaceWar Extension right now. I need to make it work for me, then i will try to modificate it and create a server-part.
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 09 Apr 2015, 19:37

Lapo wrote:We plan to add at least one example for iOS in the near future.


That would be great.
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 18 Apr 2015, 12:13

Help me fix it!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby Lapo » 20 Apr 2015, 07:58

Working on it :)
I'll give you an update when the new release is ready.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby Lapo » 04 May 2015, 15:41

UPDATE:
Sorry for the delay. We are now working with XCode 6 but the process of building a framework for iOS has changed. Technically iOS8 support frameworks but there are some issues with backward compatibility and we had to go back to XCode 5. At least for now.

I can send you a pre-release of the 1.3.8 API for you to test. Just send us an email to our support@... email box with a reference to this discussion.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 04 May 2015, 20:52

Try to start with new API version

That's the LOG

Code: Select all

2015-05-04 23:38:49.996 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:49.997 Space Story RUS HD[13879:419525] [SFS - INFO]Handling Message: JoinRoom: { Message id: 4 }
{Dump: }

   (sfs_array) r:
      (int)1
      (utf_string)Sol
      (utf_string)default
      (bool)0
      (bool)0
      (bool)0
      (short)1
      (short)10000
      (sfs_array)
         
      
      (null)(null)
      (null)(null)
      (int_array)[(
    900,
    750,
    0
)]
      (null)(null)
      (null)(null)
   
   (sfs_array) ul:
      
   
2015-05-04 23:38:49.997 Space Story RUS HD[13879:419525] onRoomJoin
2015-05-04 23:38:50.163 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling New Packet
2015-05-04 23:38:50.163 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Header Size. Size: 322 (small)
2015-05-04 23:38:50.163 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Data: 320, previous state: 0 / 152
2015-05-04 23:38:50.179 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:50.180 Space Story RUS HD[13879:419525] [SFS - INFO]Handling Message: SetUserVariables: { Message id: 12 }
{Dump: }

   (int) u: 1
   (sfs_array) vl:
      (sfs_array)
         (utf_string)x
         (byte)3
         (double)90.53098979687475
      
      (sfs_array)
         (utf_string)y
         (byte)3
         (double)98.90164212669522
      
      (sfs_array)
         (utf_string)vx
         (byte)3
         (double)0
      
      (sfs_array)
         (utf_string)vy
         (byte)3
         (double)0
      
      (sfs_array)
         (utf_string)d
         (byte)3
         (double)1
      
      (sfs_array)
         (utf_string)t
         (byte)1
         (bool)0
      
      (sfs_array)
         (utf_string)r
         (byte)2
         (int)0
      
   
2015-05-04 23:38:50.181 Space Story RUS HD[13879:419525] onUserVariablesUpdate
2015-05-04 23:38:56.654 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling New Packet
2015-05-04 23:38:56.654 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Header Size. Size: 167 (small)
2015-05-04 23:38:56.654 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Data: 165, previous state: 0 / 165
2015-05-04 23:38:56.654 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:56.655 Space Story RUS HD[13879:419525] [SFS - INFO]Handling Message: (null) { Message id: 30 }
{Dump: }

   (int) r: 1
   (sfs_array) q:
      (sfs_array)
         (int)1
         (sfs_array)
            (sfs_array)
               (utf_string)vy
               (byte)3
               (double)0.05048825908847379
            
            (sfs_array)
               (utf_string)vx
               (byte)3
               (double)0.03241813835208839
            
            (sfs_array)
               (utf_string)iModel
               (byte)4
               (utf_string)Torpedo
            
            (sfs_array)
               (utf_string)iType
               (byte)4
               (utf_string)weapon
            
            (sfs_array)
               (utf_string)y
               (byte)3
               (double)111.5237068988137
            
            (sfs_array)
               (utf_string)x
               (byte)3
               (double)98.63552438489684
            
         
      
   
2015-05-04 23:38:56.742 Space Story RUS HD[13879:419525] [SFS - WARN]Unknown message id: 30
2015-05-04 23:38:56.743 Space Story RUS HD[13879:419525] [SFS - INFO]Data Read: Binary Size: 158
80 00 23 12 00 03 00 01 61 03 03 e9 00 01 63 02    ..#.....a.....c.
00 00 01 70 12 00 02 00 01 72 04 00 00 00 01 00    ...p.....r......
02 75 63 03 00 01 80 00 4c 12 00 03 00 01 61 03    .uc.....L.....a.
00 0d 00 01 63 02 01 00 01 70 12 00 03 00 01 72    ....c....p.....r
04 00 00 00 01 00 01 63 08 00 0b 73 68 6f 74 5f    .......c...shot_
78 70 6c 6f 64 65 00 01 70 12 00 03 00 02 69 64    xplode..p.....id
04 00 00 00 01 00 01 78 04 00 00 01 a6 00 01 79    .......x.......y
04 00 00 02 67 80 00 26 12 00 03 00 01 61 03 00    ....g..&.....a..
1e 00 01 63 02 00 00 01 70 12 00 02 00 01 72 04    ...c....p.....r.
00 00 00 01 00 01 6e 0c 00 01 00 00 00 01          ......n....... 
2015-05-04 23:38:56.743 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling New Packet
2015-05-04 23:38:56.761 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Header Size. Size: 157 (small)
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Data: 155, previous state: 0 / 35
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - INFO]Handling Message: UserCountChange: { Message id: 1001 }
{Dump: }

   (int) r: 1
   (short) uc: 1
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling New Packet
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Header Size. Size: 119 (small)
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Data: 117, previous state: 0 / 76
2015-05-04 23:38:56.762 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:56.763 Space Story RUS HD[13879:419525] [SFS - INFO]{ Message id: 13 }
{Dump: }

   (int) r: 1
   (utf_string) c: shot_xplode
   (sfs_object) p:
      (int) id: 1
      (int) x: 422
      (int) y: 615
   
2015-05-04 23:38:56.763 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling New Packet
2015-05-04 23:38:56.763 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Header Size. Size: 40 (small)
2015-05-04 23:38:56.763 Space Story RUS HD[13879:419525] [SFS - DEBUG]Handling Data: 38, previous state: 0 / 38
2015-05-04 23:38:56.764 Space Story RUS HD[13879:419525] [SFS - DEBUG]<<< Packet Complete >>>
2015-05-04 23:38:56.764 Space Story RUS HD[13879:419525] [SFS - INFO]Handling Message: (null) { Message id: 30 }
{Dump: }

   (int) r: 1
   (int_array) n: [(
    1
)]
2015-05-04 23:38:56.764 Space Story RUS HD[13879:419525] [SFS - WARN]Unknown message id: 30
snuch
Posts: 11
Joined: 04 Apr 2015, 21:42

Re: [CRASH][1.3.7]SetUserPosition first send crash app

Postby snuch » 04 May 2015, 20:54

The system works the same. I spawn player on server and on client. And create a one fire weapon, one torpedo.
Nothing happends.
Last time I got a SetUserPosition and there was a crash.
Now I don't get a SetUserPosition and a crash, I get some strange (unknown, null) messages.

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 14 guests