Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Newbie & Debugging Questions / Re: [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-16 04:42:24
Sorry my english is terrible. I don't mean to said that I want to create a map "format". My game uses procedural generation for the generation of map. I can easily replace TiledMap by a simple multidimensional array_list. The support of TiledMap in a applet is not that important for my game project.
I can still modify TiledMap  like you said and make it use a stream. Maybe that would fix my error.
2  Game Development / Newbie & Debugging Questions / Re: [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-15 01:51:32
Ok I will create my own map format and use it instead of TiledMap.

Thanks for all the replies!
3  Game Development / Newbie & Debugging Questions / Re: [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-14 21:24:07
The TiledMap automatically loads the tileset image. If I remove the "/img/" and I change empty.tmx to:
1  
<image source="/img/tiles2et.png" width="200" height="200"/>


I still get the same error log. I think that the TiledMap doesn't use a stream when loading the tileset image and thus the error.
I found in the Slick2d source the line responsible for loading the tileset image:
1  
 Image image = new Image(tilesLocation+"/"+ref,false,Image.FILTER_NEAREST,trans);


Is it possible to use TiledMap in a applet?

4  Game Development / Newbie & Debugging Questions / Re: [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-14 04:25:29
Thanks you again for the quick reply.

What do you mean the full path? "map/empty.tmx" is the full path to the map. The problem seems that slick can't load the tileset image. But empty.tmx seems to have been loaded otherwise the error log won't mention "tiles2et.png".

The second parameter ("/img/") is optional and is only the location which we can find tileset images.
5  Game Development / Newbie & Debugging Questions / Re: [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-13 22:00:46
Thanks you for the reply.

I change the stream line to :
1  
map = new TiledMap(  Thread.currentThread().getContextClassLoader().getResourceAsStream("map/empty.tmx"), "/img/");


And I edit empty.tmx and change the path to the tileset image :
1  
<image source="tiles2et.png" width="200" height="200"/>


I didn't put any '.' in any file and I get this error in the Java console.

Demo applet
6  Game Development / Newbie & Debugging Questions / [Slick2d] Problem loading a TiledMap in a Applet on: 2012-06-13 03:25:23
Hi everyone!

I'm working on the game using .tmx TiledMap. The standalone version works without a problem. When I try to run my game as an applet, it fails to load the tileset image ( /img/tiles2et.png) of the TiledMap (/map/empty.tmx) :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
Starting real applet
Done loading
Mon Jun 11 18:37:12 EDT 2012 INFO:Starting display 800x600
Mon Jun 11 18:37:12 EDT 2012 INFO:Use Java PNG Loader = true
WARNING: Found unknown Windows version: Windows 7
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
Mon Jun 11 18:37:12 EDT 2012 INFO:Found 3 controllers
Mon Jun 11 18:37:12 EDT 2012 INFO:0 : Logitech USB Headset
Mon Jun 11 18:37:12 EDT 2012 INFO:1 : Logitech USB Keyboard
Mon Jun 11 18:37:12 EDT 2012 INFO:2 : Logitech USB Keyboard
Mon Jun 11 18:37:12 EDT 2012 ERROR:access denied ("java.io.FilePermission" ".\img\..\img\tiles2et.png" "read")
java.security.AccessControlException: access denied ("java.io.FilePermission" ".\img\..\img\tiles2et.png" "read")
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkRead(Unknown Source)
   at java.io.File.exists(Unknown Source)
   at org.newdawn.slick.util.FileSystemLocation.getResourceAsStream(FileSystemLocation.java:52)
   at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:61)
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
   at org.newdawn.slick.Image.<init>(Image.java:196)
   at org.newdawn.slick.tiled.TileSet.<init>(TileSet.java:113)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:447)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:122)
   at zis.MapGenerator.generateEmptyMap(MapGenerator.java:34)
   at zis.MapGenerator.<init>(MapGenerator.java:26)
   at zis.PlayState.init(PlayState.java:72)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216)
   at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92)
Mon Jun 11 18:37:12 EDT 2012 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:480)
   at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:122)
   at zis.MapGenerator.generateEmptyMap(MapGenerator.java:34)
   at zis.MapGenerator.<init>(MapGenerator.java:26)
   at zis.PlayState.init(PlayState.java:72)
   at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
   at org.newdawn.slick.AppletGameContainer$Container.initApplet(AppletGameContainer.java:272)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.initGL(AppletGameContainer.java:229)
   at org.newdawn.slick.AppletGameContainer$ContainerPanel.start(AppletGameContainer.java:216)
   at org.newdawn.slick.AppletGameContainer$1.run(AppletGameContainer.java:92)
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" ".\img\..\img\tiles2et.png" "read")
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkRead(Unknown Source)
   at java.io.File.exists(Unknown Source)
   at org.newdawn.slick.util.FileSystemLocation.getResourceAsStream(FileSystemLocation.java:52)
   at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:61)
   at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
   at org.newdawn.slick.Image.<init>(Image.java:196)
   at org.newdawn.slick.tiled.TileSet.<init>(TileSet.java:113)
   at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:447)
   ... 9 more


I check multiple time and the two file are in the ZIS.jar. I also try sign my jar and I still get the same result.
I try running loading the map using Stream and I get the same error:

1  
2  
3  
4  
5  
6  
 // Without Stream
map = new TiledMap( "map/empty.tmx", true);
// With Stream
map = new TiledMap(  Thread.currentThread().getContextClassLoader().getResourceAsStream("map/empty.tmx"), "img/");
// or
map = new TiledMap(  Thread.currentThread().getContextClassLoader().getResourceAsStream("map/empty.tmx"));


Applet Demo

Source

Thanks you in advance.
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (143 views)
2013-05-17 21:29:12

alaslipknot (150 views)
2013-05-16 21:24:48

gouessej (181 views)
2013-05-16 00:53:38

gouessej (174 views)
2013-05-16 00:17:58

theagentd (184 views)
2013-05-15 15:01:13

theagentd (169 views)
2013-05-15 15:00:54

StreetDoggy (213 views)
2013-05-14 15:56:26

kutucuk (237 views)
2013-05-12 17:10:36

kutucuk (236 views)
2013-05-12 15:36:09

UnluckyDevil (241 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.337 seconds with 21 queries.