Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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]
 

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

The first screenshot will be displayed as a thumbnail.

Riven (7 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!