Author Topic: Can't deserialize object  (Read 4287 times)

Offline JKumar

  • byte
  • *
  • Posts: 33
    • View Profile
Can't deserialize object
« on: October 07, 2010, 04:53:00 pm »
Hi,

        I am having a md2 file with 1.67MB and after serializing, it comes to be 9.78 MB.


It gets serialized with some error at the last  and when i am trying to deserialize in jPCT-AE it says

 "Can't deserialize object"

see the log

[7:25:04 PM] JKumar: Number of GL-commands: 15731
Number of Frames: 440
Reading Texture coordinates...
Done!
Reading polygonal data...
Done!
Reading keyframes...
Done!
Coverting MD2-format into jPCT-format...
Processing: walk...
Processing: jump...
Processing: shieldblockdo...
Processing: blockonhead...
Processing: swingattackch...
Processing: swingattackhe...
Processing: jumpattack...
Processing: swingattackch...
Processing: swingattackwa...
Processing: stabwa...
Processing: blockchest...
Processing: deadbackward...
Processing: roll...
Processing: rollblock...
Processing: rollattack...
Processing: kick...
Processing: punch...
Processing: breath...
Processing: standturnlr...
Processing: walkbendr...
[ Thu Oct 07 19:24:49 IST 2010 ] - ERROR: Too many sub-sequences defined. Modify configuration to allow a higher number.
Processing: fencingwalk...
[ Thu Oct 07 19:24:49 IST 2010 ] - ERROR: Too many sub-sequences defined. Modify configuration to allow a higher number.
Processing: absorbingattac...
[ Thu Oct 07 19:24:49 IST 2010 ] - ERROR: Too many sub-sequences defined. Modify configuration to allow a higher number.
Done!


Is there issue with md2 file as its running fine in  "md2Viewer 1.4".

Any guess

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #1 on: October 07, 2010, 05:08:16 pm »
Well, then just do what the error message tells: "Too many sub-sequences defined. Modify configuration to allow a higher number". There's a setting in Config: http://www.jpct.net/doc/com/threed/jpct/Config.html#maxAnimationSubSequences. The default is 20 which is fine for all md2s that i've ever seen...but obviously not for yours... ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #2 on: October 07, 2010, 05:14:22 pm »
BTW: 10mb is pretty huge...have you serialized it with reduced set to true? You can greatly reduce disc/card usage by zipping it and load the zipped version instead but it'll still consume a lot of memory. Are you sure that you need all the sub-animations?

Offline JKumar

  • byte
  • *
  • Posts: 33
    • View Profile
Re: Can't deserialize object
« Reply #3 on: October 18, 2010, 03:02:08 pm »
Hi,

        My Code is running fine in 2.1 but when i am using it in device with 2.2. Its not able to Deserialize my model.

     Everything running fine in 2.1.

Any issue with jPCT and SDK 2.2 ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #4 on: October 18, 2010, 04:57:20 pm »
No, no issues. And the log that you've posted simply indicates a configuration mistake on your side (as mentioned above) that has nothing to do with the underlying platform. Maybe you are getting some different problem on 2.2, but then that's not a part of your posted log!?
« Last Edit: October 18, 2010, 05:09:16 pm by EgonOlsen »

Offline JKumar

  • byte
  • *
  • Posts: 33
    • View Profile
Re: Can't deserialize object
« Reply #5 on: October 20, 2010, 01:25:16 pm »
HI,

          Following is the serialize log for the model from the jPCT --

Loading file data/model_no_7.md2
Expanding buffers...1000000 bytes
Expanding buffers...1500000 bytes
File data/model_no_7.md2 loaded...1131692 bytes
Magic number: 844121161
Version: 8
Skin width: 512
Skin height: 512
Frame size: 3804
Number of skins: 1
Number of Vertices: 941
Number of Texture coordinates: 4719
Number of triangles: 1573
Number of GL-commands: 15731
Number of Frames: 271
Reading Texture coordinates...
Done!
Reading polygonal data...
Done!
Reading keyframes...
Done!
Coverting MD2-format into jPCT-format...
Processing: walksplit...
Processing: jumpsplit...
Processing: breathsplit...
Processing: blockonheads...
Processing: swingattackch...
Processing: swingattackhe...
Processing: jumpattackspl...
Processing: swingattackch...
Processing: swingattackwa...
Processing: stabsplita...
Processing: blockchestspl...
Processing: deadfallbackw...
Processing: rollsplitw...
Processing: rollblockspli...
Processing: rollattackspl...
Processing: kicksplitl...
Processing: punchsplit...
Processing: fencingwalksp...
Processing: absorbingattac...
Done!

When i run this in 2.1, it runs fine but when i use the same file 2.2 it gives error "Can't Deserialize" (see attached log file...use wordpad for the clear view).

I don't know y its happening with the same code for different Android SDK


[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #6 on: October 20, 2010, 02:03:00 pm »
There you have your problem:

Code: [Select]
10-20 10:46:56.469: DEBUG/asset(3702): Data exceeds UNCOMPRESS_DATA_MAX (6400588 vs 4194304)

Android limits the file size and these limits vary from version to version. Either zip the file and load it via a zipped inputstream instead or rename it to .mp3. That makes Android think that it's already compressed and the error should go away.

Offline JKumar

  • byte
  • *
  • Posts: 33
    • View Profile
Re: Can't deserialize object
« Reply #7 on: October 21, 2010, 12:52:38 pm »
Hi,

      Though i tried with zip but no success. But my requirement got changed and the model is reduce from 19 animations to 12 animations which helped the code to run smoothly in both 2.1 and 2.2.

I thank you for jPCT which running as the base of my project.

I have another query regarding multi-touch.As my target device is 2.2 and above so i have multi-touch support.

My requirement is to use touch button combination on the screen and that can only be acheived using multitouch.

And my question is- Is there any help from jPCT for multi-touch? What is the user of Overlay class in the jPCT?  Any link between multi-touch and overlay?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #8 on: October 21, 2010, 01:09:09 pm »
No, there's no binding from jPCT to any gui or input components. If you want to show controls for multi-touch input components, just blit them to the screen or write your own, simple gui component system that does this for you.
I don't recommend to use Overlay, if you can get away with blitting, because it's more expensive...and on Android, that actually counts.

Offline tuanphong

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Can't deserialize object
« Reply #9 on: November 15, 2010, 12:21:22 am »
Hi, I have change file to mp3. It don't success
So I load it via zip input stream. But it also don't success.
Please help me.

Code: [Select]
11-15 06:09:35.781: INFO/jPCT-AE(318): Loading Texture...
11-15 06:09:35.822: INFO/jPCT-AE(318): Loading Texture...
11-15 06:09:35.842: INFO/jPCT-AE(318): Loading Texture...
11-15 06:09:35.941: DEBUG/dalvikvm(318): GC freed 181 objects / 7984 bytes in 95ms
11-15 06:09:36.031: DEBUG/dalvikvm(318): GC freed 49 objects / 1880 bytes in 80ms
11-15 06:09:36.082: INFO/jPCT-AE(318): Loading Texture...

[b]11-15 06:09:36.271: INFO/jPCT-AE(318): [ 1289776176272 ] - ERROR: Unsupported version: 0
11-15 06:09:36.271: WARN/System.err(318): java.lang.RuntimeException: [ 1289776176272 ] - ERROR: Unsupported version: 0
11-15 06:09:36.281: WARN/System.err(318):     at com.threed.jpct.Logger.log(Logger.java:159)
11-15 06:09:36.281: WARN/System.err(318):     at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:31)
11-15 06:09:36.281: WARN/System.err(318):     at com.threed.jpct.Loader.loadSerializedObject(Loader.java:97)
11-15 06:09:36.281: WARN/System.err(318):     at ar.jPCT.jPCT$MyRenderer.onSurfaceCreated(jPCT.java:295)
11-15 06:09:36.292: WARN/System.err(318):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1112)
11-15 06:09:36.301: WARN/System.err(318):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)[/b]

11-15 06:09:36.301: INFO/jPCT-AE(318): [ 1289776176307 ] - ERROR: Can't deserialize object: [ 1289776176272 ] - ERROR: Unsupported version: 0
11-15 06:09:36.341: INFO/ActivityManager(66): Displayed activity ar.jPCT/.jPCT: 2052 ms (total 2052 ms)
11-15 06:09:36.371: WARN/dalvikvm(318): threadid=15: thread exiting with uncaught exception (group=0x4001b188)
11-15 06:09:36.381: ERROR/AndroidRuntime(318): Uncaught handler: thread GLThread 8 exiting due to uncaught exception

[b]11-15 06:09:36.422: ERROR/AndroidRuntime(318): java.lang.RuntimeException: [ 1289776176307 ] - ERROR: Can't deserialize object: [ 1289776176272 ] - ERROR: Unsupported version: 0
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at com.threed.jpct.Logger.log(Logger.java:159)
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at com.threed.jpct.DeSerializer.deserialize(DeSerializer.java:188)
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at com.threed.jpct.Loader.loadSerializedObject(Loader.java:97)
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at ar.jPCT.jPCT$MyRenderer.onSurfaceCreated(jPCT.java:295)
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1112)
11-15 06:09:36.422: ERROR/AndroidRuntime(318):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)[/b]

11-15 06:09:36.441: INFO/Process(66): Sending signal. PID: 318 SIG: 3
11-15 06:09:36.441: INFO/dalvikvm(318): threadid=7: reacting to signal 3
11-15 06:09:36.451: ERROR/dalvikvm(318): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

This is the deserialize code I have write
Code: [Select]
    Config.maxAnimationSubSequences=100;
       
    String textureString = "C:\\a\\skin.bmp";
        String obj3dString = "C:\\a\\tris_abm.md2";
        String output = "C:\\a\\sf15.ser";

        TextureManager.getInstance().flush();       
     
        Texture grass2 = new Texture(textureString);
        TextureManager tm = TextureManager.getInstance();
        tm.addTexture("grass2", grass2);

        Object3D grass = Loader.loadMD2(obj3dString, 5);
        grass.setTexture("grass2");
        grass.build();

        DeSerializer de = new DeSerializer();
        de.serialize(grass, new FileOutputStream(output), true);

This is serialize code
Code: [Select]
Loader.loadSerializedObject( new ZipInputStream( res.openRawResource( R.raw.sf15 ) ) );

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Can't deserialize object
« Reply #10 on: November 15, 2010, 08:04:01 am »
Get a newer version of desktop jPCT. You serialized file format is too old. It doesn't contain the version info that i've added some time ago.