Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (483)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Slick2D game not running on all computers...  (Read 1438 times)
0 Members and 1 Guest are viewing this topic.
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Posted 2012-08-20 16:54:47 »

My game is obviously built off of the Slick2D library.  It almost always runs on all computers that have Java installed without any problems.  A couple of my friends have complained about it not even starting up, though.  In some cases, the AppGameContainer opens up for a few seconds, and immediately closes.  In other cases, the jar doesn't even run at all!  I've tried outputting all error messages to a log file by writing:

try
{
   PrintStream outie = new PrintStream(new FileOutputStream("log.txt"));
   System.setErr(outie);
}
catch (FileNotFoundException e1)
{
   e1.printStackTrace();
}

This code writes all output to a log file that I specify.  This technique works on my machine when I purposefully write idiot code, but I can't seem to get my program to write to the log file on other people's computers.

I once tried converting the jar to an exe (Don't yell at me for doing this...) and tried to run it on my friend's computer.  The log file wasn't written to, but a command prompt that always was loaded along side it outputted this right before fading away.  I managed to print screen it before it disappeared...

http://www5.picturepush.com/photo/a/9018823/img/Anonymous/whathefail.png

The message is cryptic, though.  I tried searching through the Slick2D library to narrow in on the issue, but the line numbers didn't always match up with the error message.

I would also like to point out that the jar's and exe's behavior were the same aside for the fact that the exe had a command prompt alongside it.

Anyway, has anyone ever seen an error message like this?  Is there any way to guarantee that my game will be compatible on other people's computers?

Did you know that 90% of statistics are wrong?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #1 - Posted 2012-08-20 17:03:32 »

Have you tried simply running the game from the command line?  You can redirect stderr in a DOS console too, it's the same syntax as unix: 
java -jar mygame.jar >log.txt 2>&1




Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #2 - Posted 2012-08-20 17:39:23 »

Have you tried simply running the game from the command line?  You can redirect stderr in a DOS console too, it's the same syntax as unix: 
java -jar mygame.jar >log.txt 2>&1

Ah, well I don't exactly have access to my friend's computer at the moment...  I wouldn't be able to have my friend do this because she isn't exactly computer savvy.  I also have little experience with the command line.

Did you know that 90% of statistics are wrong?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #3 - Posted 2012-08-20 17:43:13 »

Send your friend a .bat file that does the redirection.  Your friend doesn't have to learn, but you do. 
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #4 - Posted 2012-08-20 18:27:10 »

Send your friend a .bat file that does the redirection.  Your friend doesn't have to learn, but you do. 


Easy, man.  I consider every obstacle in the way part of the learning experience.  Since I'm still new, I'll ask you what you mean by a bat file doing the redirection.  That doesn't really mean anything to me, you see.

Did you know that 90% of statistics are wrong?
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #5 - Posted 2012-08-20 18:48:23 »

Ok, so open the jar with a bat.  I think I get it.  Cool enough, cool enough...

Did you know that 90% of statistics are wrong?
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #6 - Posted 2012-08-20 21:31:45 »

Um, ok, this is the error message she received:

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  
Mon Aug 20 16:24:19 EDT 2012 ERROR:null
java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1372)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTextureID(Intern
alTextureLoader.java:106)
        at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTex
tureLoader.java:359)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(Internal
TextureLoader.java:343)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(Internal
TextureLoader.java:329)
        at org.newdawn.slick.Image.<init>(Image.java:238)
        at org.newdawn.slick.font.GlyphPage.<init>(GlyphPage.java:107)
        at org.newdawn.slick.UnicodeFont.loadGlyphs(UnicodeFont.java:374)
        at org.newdawn.slick.UnicodeFont.loadGlyphs(UnicodeFont.java:325)
        at platformerEngine.Resources.getFont(Resources.java:573)
        at platformerEngine.Level.privateInit(Level.java:179)
        at platformerEngine.PlatformerGame.setRoom(PlatformerGame.java:158)
        at platformerEngine.PlatformerGame.transition(PlatformerGame.java:314)
        at platformerEngine.PlatformerGame.update(PlatformerGame.java:489)
        at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:65
7)
        at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408
)
        at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
        at platformerImplementation.Boss.main(Boss.java:62)
Mon Aug 20 16:24:19 EDT 2012 ERROR:Game.update() failure - check the game code.
org.newdawn.slick.SlickException: Game.update() failure - check the game code.
        at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:66
3)
        at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408
)
        at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
        at platformerImplementation.Boss.main(Boss.java:62)



Oof...  This error message doesn't happen on most computers, but it somehow finds its way onto my friend's.  I am thoroughly stumped...  It doesn't have a problem retrieving regular images from files, but the error seems to originate within UnicodeFont.  I know this for a fact because the command line prompted that images were successfully loaded before the error arrived.  The error message rears its ugly head when a UnicodeFont calls loadGlyphs().  Oi!  This is how I call the loadGlyphs method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
         try
         {
            font = new UnicodeFont(fontLoc + fileName, size, false, false);
            font.addAsciiGlyphs();
            font.getEffects().add(new ColorEffect());
            font.loadGlyphs();
            fonts.put(name, font);
            System.out.println("Created " + fileName);

         }
         catch (SlickException e)
         {
            e.printStackTrace();
         }




So, yeah.  Line 6 is where this error occurs.  I can guarantee you that all images are only requested within the init() method of the BasicGame class.  Any ideas?

Did you know that 90% of statistics are wrong?
Offline Cero
« Reply #7 - Posted 2012-08-20 21:31:55 »

first of all you dont have to quickly do a print screen

just open a command line window first, then execute the program and it will crash and everything will still be there

secondly its not cryptic, we cant see everything but it looks like a font cannot be loaded, perhaps because it cannot be found

Offline Cero
« Reply #8 - Posted 2012-08-20 21:33:18 »

I can only assume "fontLoc + fileName" is not a valid font
either you dont supply it and the other system doesnt have it or something with the paths is screwed up

Offline avm1979
« Reply #9 - Posted 2012-08-20 21:46:32 »

Your friend probably needs to update the graphics drivers. That's the first thing I'd try, at any rate.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #10 - Posted 2012-08-20 21:49:20 »

If it were a bad font filename, I wouldn't expect it to be throwing an NPE while generating texture IDs.  This is a failure of something that should basically Always Just Work.  Might be you don't have an initialized GL context ... you are doing all this in one thread, right?
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #11 - Posted 2012-08-20 22:13:39 »

If it were a bad font filename, I wouldn't expect it to be throwing an NPE while generating texture IDs.  This is a failure of something that should basically Always Just Work.  Might be you don't have an initialized GL context ... you are doing all this in one thread, right?


Yessir!  Didn't want complicate my system with multiple threads.  I also can guarantee that the file was within the system.  I ran my game before zipping it and uploading it.  Weird stuff, I tells ya...  Maybe I should try a different Font type?  Heard there was some sort of Bitmap type.

Did you know that 90% of statistics are wrong?
Offline Tjstretchalot

Junior Member


Medals: 2
Projects: 1



« Reply #12 - Posted 2012-08-20 22:40:44 »

The only way this problem could occur, according to my Google searches are:
  • Didn't call Display.create() -> Can be ruled out because it worked on your system
  • A OpenGL call on a different thread -> This would be possible to happen on your friends system if it had a different priority by default or a different java implementation, but since you already stated you don't use multithreading (which you should for loading resources) that can be ruled out
  • Your friend doesn't have a graphics card that supports Open GL 1.1 -> Already mentioned, and the only reasonable answer I can think of
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #13 - Posted 2012-08-20 22:48:42 »

If 1.1 was not supported, a different error would have been thrown.

The only meaning of this NPE is that Display.create() was not called/this is called on a different thread. Are you sure you're not using separate threads...like the main thread and Slick's game loop thread?

Offline princec

JGO Kernel


Medals: 362
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2012-08-20 22:49:15 »

<bah ra4king got there first>

Cas Smiley

Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #15 - Posted 2012-08-20 22:55:30 »

If 1.1 was not supported, a different error would have been thrown.

The only meaning of this NPE is that Display.create() was not called/this is called on a different thread. Are you sure you're not using separate threads...like the main thread and Slick's game loop thread?

I'm faiiiiirly certain I'm not using multiple threads.  Is there a possible way to search for the keyword 'Thread' throughout my engine?  I could always go through each class and search for it...  Just wanna potentially save time in the future.

<edit> Checked all of the classes that made sense.  Found no extra threads.  I think I remember attempting to use a separate thread for SOMETHING in the past, but I throught I removed it.  Well, I didn't find it, anyway.

Did you know that 90% of statistics are wrong?
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #16 - Posted 2012-08-20 23:00:39 »

You don't have to explicitly use them. Could you post relevant code in our pastebin: http://pastebin.java-gaming.org

Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #17 - Posted 2012-08-20 23:15:04 »

HANG ON!  There is no line 62 in my Boss class!  There may have been in the past when I tried using a separate thread for something, but it certainly isn't there now!  Well, it said the exception originated in the main method, but that still doesn't explain why it thinks there is a 62nd line.  Anyway, I'll try my hand at a code dump.

Did you know that 90% of statistics are wrong?
Offline DrewLols

Senior Member


Medals: 2
Projects: 1


Noob going through metamorphosis...


« Reply #18 - Posted 2012-08-20 23:44:02 »

first of all you dont have to quickly do a print screen

Ok, I know this is old, but I did a print screen before I knew how to use a batch file.  Anyway, I can confirm that my game is able to access image resources such as png files without a problem.  I know this because every time an image resource is retrieved, I state:

System.out.println("Created " + fileName);

I retrieve all of my resources from a Resource object which implements a HashMap blah blah blah...

Thing is, the ("Created " + fileName) gets called a couple of times before the exception is thrown.  Maybe it would help if I posted everthing the message said instead of just the error.


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  
Mon Aug 20 16:24:11 EDT 2012 INFO:Slick Build #274
Mon Aug 20 16:24:15 EDT 2012 INFO:LWJGL Version: 2.8.4
Mon Aug 20 16:24:15 EDT 2012 INFO:OriginalDisplayMode: 1280 x 800 x 32 @60Hz
Mon Aug 20 16:24:15 EDT 2012 INFO:TargetDisplayMode: 800 x 600 x 0 @0Hz
Mon Aug 20 16:24:16 EDT 2012 INFO:Starting display 800x600
Mon Aug 20 16:24:16 EDT 2012 INFO:Use Java PNG Loader = true
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
Mon Aug 20 16:24:17 EDT 2012 INFO:Found 0 controllers
Mon Aug 20 16:24:17 EDT 2012 INFO:Offscreen Buffers FBO=false PBUFFER=true PBUFF
ERRT=false
Mon Aug 20 16:24:17 EDT 2012 DEBUG:Creating pbuffer(unique) 1x1
Created pauseBg.png
Created textBox.png
Mon Aug 20 16:24:18 EDT 2012 INFO:Offscreen Buffers FBO=false PBUFFER=true PBUFF
ERRT=false
Mon Aug 20 16:24:18 EDT 2012 DEBUG:Creating pbuffer(unique) 1x1
Created menuFilt
Mon Aug 20 16:24:19 EDT 2012 ERROR:null
java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1372)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTextureID(Intern
alTextureLoader.java:106)
        at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTex
tureLoader.java:359)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(Internal
TextureLoader.java:343)
        at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(Internal
TextureLoader.java:329)
        at org.newdawn.slick.Image.<init>(Image.java:238)
        at org.newdawn.slick.font.GlyphPage.<init>(GlyphPage.java:107)
        at org.newdawn.slick.UnicodeFont.loadGlyphs(UnicodeFont.java:374)
        at org.newdawn.slick.UnicodeFont.loadGlyphs(UnicodeFont.java:325)
        at platformerEngine.Resources.getFont(Resources.java:573)
        at platformerEngine.Level.privateInit(Level.java:179)
        at platformerEngine.PlatformerGame.setRoom(PlatformerGame.java:158)
        at platformerEngine.PlatformerGame.transition(PlatformerGame.java:314)
        at platformerEngine.PlatformerGame.update(PlatformerGame.java:489)
        at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:65
7)
        at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408
)
        at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
        at platformerImplementation.Boss.main(Boss.java:62)
Mon Aug 20 16:24:19 EDT 2012 ERROR:Game.update() failure - check the game code.
org.newdawn.slick.SlickException: Game.update() failure - check the game code.
        at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:66
3)
        at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408
)
        at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318)
        at platformerImplementation.Boss.main(Boss.java:62)


Heh, weird...  Some of the (Created) lines are called before certain buffers are finished.  Dunno if this is the exact problem, though...

Did you know that 90% of statistics are wrong?
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #19 - Posted 2012-08-20 23:55:14 »

Well it does seem like you are calling glGenTextures in Slick's thread and after the Display is created.

Looking at GL11's line 1372, an NPE there shows GLContext.getCapabilities() has returned null.......meaning a context hasn't been created -____-

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (18 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (63 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (38 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!