Force Close on loading TMX

  ... in the unlikely case you discovered a bug, post it here.

Force Close on loading TMX

Postby H3R3T1C » Thu Aug 05, 2010 10:27 am

Hello when I try to load my TMX map file my app force crashes.
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): FATAL EXCEPTION: main
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.h3r3t1c.game/com.h3r3t1c.game.Main}: java.lang.IllegalArgumentException: No TextureRegion found for pGlobalTileID=-13
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread.access$2300(ActivityThread.java:135)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.os.Handler.dispatchMessage(Handler.java:99)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.os.Looper.loop(Looper.java:144)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread.main(ActivityThread.java:4937)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at java.lang.reflect.Method.invokeNative(Native Method)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at java.lang.reflect.Method.invoke(Method.java:521)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at dalvik.system.NativeStart.main(Native Method)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): Caused by: java.lang.IllegalArgumentException: No TextureRegion found for pGlobalTileID=-13
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.entity.layer.tiled.tmx.TMXTiledMap.getTextureRegionFromGlobalTileID(TMXTiledMap.java:160)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.entity.layer.tiled.tmx.TMXLayer.initializeTextureRegions(TMXLayer.java:214)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.entity.layer.tiled.tmx.TMXParser.endElement(TMXParser.java:155)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:160)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatParser.append(Native Method)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:521)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:482)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:320)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:277)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.entity.layer.tiled.tmx.TMXLoader.load(TMXLoader.java:91)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.entity.layer.tiled.tmx.TMXLoader.loadFromAsset(TMXLoader.java:76)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at com.h3r3t1c.game.Main.onLoadScene(Main.java:78)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at org.anddev.andengine.ui.activity.BaseGameActivity.onCreate(BaseGameActivity.java:57)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
08-05 02:15:05.188: ERROR/AndroidRuntime(7756): ... 11 more

map file: http://www.sendspace.com/pro/dl/f532yg
It works when I remove the second layer so it looks like a parsing error in the second layer?
H3R3T1C
 
Posts: 2
Joined: Thu Aug 05, 2010 10:19 am

Re: Force Close on loading TMX

Postby Nicolas Gramlich » Thu Aug 05, 2010 1:20 pm

I'm having a look...
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Force Close on loading TMX

Postby Nicolas Gramlich » Thu Aug 05, 2010 3:51 pm

I fixed the bug. Changeset: http://code.google.com/p/andengine/sour ... 1f57f1b20d

The problem was that I was reading bytes from the inputstream, at a range of -128 to +127, which should have been in the range of +0 to +255. This caused the strange negative TileID to appear.

Thinking of performance it is better not to give tiles that are not visible a TextureRegion, that means leaving an invisible tile blank (when creating the TMX in the Tiled-Editor) instead of giving it the background TextureRegion will perform significantly better.

Also remember: The smaller the tiles, the poorer the performance!

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Force Close on loading TMX

Postby Nicolas Gramlich » Thu Aug 05, 2010 4:21 pm

Quick question about the TMX-file and the images you used. Are they royalty/license free, so I could maybe use them in the AndEngineExamples :?:

(Need to check performance on the 1st gen devices first)

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Force Close on loading TMX

Postby Nicolas Gramlich » Thu Aug 05, 2010 5:44 pm

Due to the two layers and the small tile-size the performance is unfortunately to bad on low end devices to be put into the AndEngineExamples (~13 FPS on the HTC Dream/G1).

Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Force Close on loading TMX

Postby H3R3T1C » Thu Aug 05, 2010 6:13 pm

Ok thanks for the fix. For right now im just messing around with it and trying to see how the engine works. As for the sprite sheet its from RM2K3 Legend of Zelda: Link's Awakening remake so im not sure if its royalty/license free or not but I believe that it may be ripped from one of the game boy advanced zelda games.
H3R3T1C
 
Posts: 2
Joined: Thu Aug 05, 2010 10:19 am

Re: Force Close on loading TMX

Postby Nicolas Gramlich » Thu Aug 05, 2010 6:22 pm

Btw here is a screenshot of the TMXTiledMap.

zelda_tmx_fixed.png
zelda_tmx_fixed.png (31.3 KiB) Viewed 2713 times


Best Regards,
Nicolas
Nicolas Gramlich
Site Admin
 
Posts: 1734
Joined: Mon Jun 07, 2010 6:20 pm
Location: Schriesheim, Germany

Re: Force Close on loading TMX

Postby reittes » Fri May 27, 2011 9:49 am

For some reason, I still cant make it work. When i use the map from the andengine example, it works fine, but next I just changed some tiles from your "desert.tmx" with map editor and the application force closes.

Edit: finally got it, it was the gzip compression problem of tiled map editor. :)
---------------------------------------------
My Apps: https://play.google.com/store/apps/deve ... eizon+Apps
reittes
 
Posts: 59
Joined: Tue May 24, 2011 4:56 pm

Re: Force Close on loading TMX

Postby kblood » Sat Jun 11, 2011 8:24 pm

Nicolas Gramlich wrote:Also remember: The smaller the tiles, the poorer the performance!

Best Regards,
Nicolas


Hmmm, I am playing around with TMX right now. And I thought about making a game with 16x16 tiles, but making the camera zoomed in, to make it pixelated and old school.

That would make it have better performance wouldn't it? Compared to making a TMX with the same number of tiles, but all of them 32x32 and the game zooming out a bit to have a full view of the TMX?

Or the question really is, are you saying the performance becomes poorer because more tiles have to be shown and "rendered" at once?
kblood
 
Posts: 333
Joined: Wed May 25, 2011 10:13 pm

Re: Force Close on loading TMX

Postby felipe » Mon Sep 10, 2012 3:45 am

Hello guys,

I dont know if this is a expected behavior but, when I leave a tile blank in the map editor, it forces the close of application. Looking more closely, the blank tile receive the gid = 0 in the tmx file, which causes this.

Is this a normal behavior? I'm using the Tiled Map Editor version 0.8.1.

:)
felipe
 
Posts: 3
Joined: Thu Aug 16, 2012 2:29 am


Return to Bugs

Who is online

Users browsing this forum: No registered users and 6 guests