Show Posts
|
|
Pages: [1] 2
|
|
1
|
Game Development / Newbie & Debugging Questions / Re: Trouble creating Jar
|
on: 2011-08-18 19:26:05
|
|
Sigh. Once again I turned to help here too soon. I just fixed it. Turns out the problem was in my map loading. I was bringing it in as a file stream, which was used by an object stream, when I should just have used the object stream with the resource loader.
Thanks if you saw the original post and was going to help!
|
|
|
|
|
2
|
Game Development / Newbie & Debugging Questions / Trouble creating Jar [Solved]
|
on: 2011-08-18 19:19:39
|
|
Hello,
So I'm trying to get what I have of my game (so far) into a Jar file. I'm using Netbeans' built in Jar builder, which hasn't failed me yet. But when I open the jar, nothing happens. I've tried opening it through the command prompt, hoping it will spit out some kind of error, but again nothing happens. The two major things I can think of are the two external file loading points (map and texture). However they both have try/catch controls which should print to the console if there's an error. I inserted the files into the jar, in the same way I've done with previous iterations of the game. All the correct jars and dlls are correctly included in the distribution folder. The manifest is correct, too. I'd be happy if the command prompt would just throw out some kind of error I could work from.
Any preliminary ideas?
|
|
|
|
|
3
|
Java Game APIs & Engines / JOGL Development / Re: Getting a strange new error
|
on: 2011-08-17 16:33:55
|
|
Well I slept on the problem, and then just now I fixed it. The first time I installed OpenGL it was using an automatic plug-in. So naturally, doing it manually, I forgot the gluegen part. Then, I realized that Netbeans itself had the native library path set in it's config from the plug-in. So rather than mess with that, I just said, "Screw it," and replaced the old natives in that directory with the new one. Slapped f6, and my game popped up in all its updated glory. Thanks for the help, guys!
|
|
|
|
|
7
|
Java Game APIs & Engines / JOGL Development / Getting a strange new error
|
on: 2011-08-17 05:58:24
|
So I finally muddled through my code and fixed the problems caused by updating. But here's one that happens when I try to compile: 1 2 3 4 5 6 7 8 9 10
| Exception in thread "main" java.lang.UnsatisfiedLinkError: com.jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z at com.jogamp.common.jvm.JVMUtil.initialize(Native Method) at com.jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:59) at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:1145) at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:232) at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:182) at javax.media.opengl.awt.GLCanvas.<init>(GLCanvas.java:172) at Engine.Engine.<init>(Engine.java:93) at Engine.Engine.main(Engine.java:87) Java Result: 1 |
I have... no idea.
|
|
|
|
|
8
|
Java Game APIs & Engines / JOGL Development / Just updated JOGL, problem with listeners
|
on: 2011-08-15 21:31:18
|
|
Okay so first I'll say that all my programming knowledge (beyond basics) is self-learned, and it's hard to learn well that way. In my program, I had the KeyListener and FocusListener added to the autodrawable. Why? Because it worked, and I'm not sure about any other reason. Trying to add it to the frame or canvas brought up static issues. But now that I've updated JOGL, the autodrawable isn't supporting my listeners anymore. Any suggestions?
|
|
|
|
|
9
|
Game Development / Newbie & Debugging Questions / Re: Game starts stuttering *randomly*
|
on: 2011-07-25 19:45:58
|
|
Well I've done some digging and it seems that a lot of the generated objects are a bit outside my control, byproducts of the greater complexity involved in using JOGL and font rendering and so on.
Some of it may also be caused by un-optimized JOGL. I'd say 20% of all the time I spent learning Java was dedicated to wrapping my head around VBOs, and shoehorning them into my engine. Basically, I believe I've got it right, just not optimized.
The good news is that for some reason my game has settled down. I tossed -Xincgc in there, and I'm not sure if it helped, but seems like it might have. There are just the occasional pauses when a larger collection occurs, but I ran the game for over 4 minutes with just a scant few hiccups. As this game is just a personal project to share with friends, I can live with those. Time to get on with it!
Thanks for the help, folks!
|
|
|
|
|
10
|
Game Development / Newbie & Debugging Questions / Re: Game starts stuttering *randomly*
|
on: 2011-07-25 04:55:23
|
|
Thanks these are good suggestions. I do remember Hashmaps being used a lot, when I profiled the game. I'll have to track those down. I have buffers that hold the vertex and texture information, assuming those are included in what you meant. I don't allocate them every frame. Just the few I start with that are reused (info deleted by standardized delete methods and simply repopulated). That stuff doesn't happen every frame, either.
Anyway, I'm still keeping an eye on this thread tonight, to spot any new ideas. Thanks again.
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / Re: Game starts stuttering *randomly*
|
on: 2011-07-24 21:37:03
|
|
philfrei I'm using FPSAnimator to control the game loop. I'd like to keep experimenting, but I've to get ready for work. I might be on after work to see what others have to say, but will not be coding (programming + vodka = bad).
I do have to say that Threads were never touched upon in the classes I took. What little I know about them is entirely self-taught, and probably encompasses about 4% of what there is to learn.
Thanks for the advice so far, and later folks!
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Re: Slick2d smooth movement between tiles
|
on: 2011-07-24 21:02:06
|
I've managed to get this working by using the following code: 1 2 3 4 5 6 7 8 9
| if(moveInProgress == true){ if(moveDirection.equalsIgnoreCase("a")){ if(currentMoveStep <= 31 && currentMoveStep > 0){ x = x-1; currentMoveStep--; }else if(currentMoveStep == 0){ moveInProgress = false; currentMoveStep = 31; } |
Every update I'm incrementing the sprites position by one pixel, once a full tile has been moved a reset a boolean value to stop any further movement and accept another key press. It seems to work well, I just cant tell if there is a better solution to this. That's probably what my movement code started out looking like. Over the years it's grown to include checking/setting collision of tiles, changing the sprite based on how far through the step it is, and some other stuff.
|
|
|
|
|
14
|
Game Development / Newbie & Debugging Questions / Re: Game starts stuttering *randomly*
|
on: 2011-07-24 20:57:42
|
|
Adding a larger heap size had some interesting results. It didn't quite stutter like it did before, I'm guessing because it didn't go through some massive garbage collection. However pretty quickly I noticed that there were small little pauses. It's hard to say, but I think they happened every second. Unfortunately my map was randomly generated and did not have the room for me to walk trough more than two hiccups at a time. So an improvement? I suppose.
ra4king is probably right about my objects. When I started the project I was obsessed with making every little distinct thing it's own class. Therefor I have a MapManager object, which holds (for testing purposes) just one Map object. That Map object uses a 2d 50x50 array of Tile objects. I never thought about it at the time but yeah that's 2,500 objects for just one map! For shame me, for shame.
I'm not quite sure how to take all of the information stored in the Tile object and integrate it with the Map object. Assuming I can store it all in array form inside it's Map parent, would that help things? Is a giant, information stuffed single object better than a simple object that stores all the info in other objects?
|
|
|
|
|
16
|
Game Development / Newbie & Debugging Questions / Game starts stuttering *randomly*
|
on: 2011-07-24 19:38:28
|
I used to think it was random, but not anymore. Basically I have a game that is a top-down, 2d and tile-based. There is smooth animation from tile to tile. At least for the first minute or so. I put the game down for a while because I could not figure out why, after a minute or so, it would start stuttering. Then I noticed while profiling it that once the heap space starts filling up and the garbage collector switches on, then that is when the game slows down.  In the heap space panel, the slowdown happens right after that first steep drop in used heap space. I've had a few basic computer science classes, but 90% of what I know is self taught, so this is getting to be outside my ability to think through. I just wanted to know if someone here could help me out, give me a kick in the pants for overlooking something stupid maybe? Also I'm not sure what else to provide, but will post whatever is asked for. Thanks.
|
|
|
|
|
17
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator hates me
|
on: 2011-03-30 07:06:30
|
Not really sure about the releasing of VBOs. It's still a best practice to release VBOs so keep that code in, but in my experience I don't every remember having that be a speedup. It's possible that your graphics card is doing something weird and gets in an unoptimized state if there is a VBO bound and you disable the vertex/texture client states. But that's all conjecture.
Well I'm still drunk so I won't do any more testing (I can't trust the results in this state) but I think the results were very promising with my fix. EDIT - No, that did not solve anything. The game still started stuttering.
|
|
|
|
|
18
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator hates me
|
on: 2011-03-30 04:12:48
|
|
OKAY. Maybe I should code while drunk. Another post giuy said to release the VBO bindings when done with them. I did that, and ran the program. I let it sit for two minutes, after which point it usually stutters. IT DID NOT. I will do more testing but I am hopeful.
|
|
|
|
|
19
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator hates me
|
on: 2011-03-30 03:54:08
|
|
Dude.... I never program when I'm drunk (like I am now). However you're awesome. I will try that. I should say though, that the collision method is not the problem. It takes two ints. Those ints are coordinates in a 2d array. The method returns a simple boolean. I never paid attention in class but that should take a constant amount of time (and not much at theat). Collision aint no problem.
What the hell is up with my code? This is killing me. My pre-VBO code has this problem too.
|
|
|
|
|
21
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator hates me
|
on: 2011-03-29 15:56:12
|
In the game loop: 1 2 3 4 5 6 7 8 9 10
| gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glClear(GL.GL_DEPTH_BUFFER_BIT);gl.glLoadIdentity(); gl.glOrtho(-8f, 7f, -4f, 3f, 0.1f, 100f); update(gl); mapMan.draw_map(gl); |
(Part of) the update method: 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
| else if((key_set[3] && !player.get_moving() && mapMan.collision(player.get_player_position('x'), player.get_player_position('y') + 1)) || (player.get_coord('y') > 0 && player.get_coord('y') <= 1f)) { if(!player.set_moving(true)) { player.set_stride(player.get_foot() ? 2 : 1); player.set_direction(3); mapMan.set_passable(player.get_player_position('x'), player.get_player_position('y')+1, false); } if(player.set_coord('y', 0.05f)) { player.set_foot(); if(!key_set[3]) { player.set_stride(0); } mapMan.set_passable(player.get_player_position('x'), player.get_player_position('y')-1, true); update_map(gl); mapMan.update_player_tex(gl, player.get_direction()*3+player.get_stride()); } else { mapMan.update_player(0.0f, -player.get_coord('y'), gl, player.get_direction()*3+player.get_stride()); } } else { player.set_stride(0); mapMan.update_player_tex(gl, player.get_direction()*3+player.get_stride()); } |
Ugh yes I know that's complex. And that's just for the down direction. I have not yet optimized it in any way. Lastly: 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
| public void draw_map(GL gl) { engine.pass_tex().bind(); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glEnableClientState(GL.GL_VERTEX_ARRAY); gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
for(int index = 0; index < VBOtex.length-1; index++) { gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOtex[index]); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOVertices[0]); gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); gl.glDrawArrays(GL.GL_QUADS, 0, vertexCount); } gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOtex[4]); gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, VBOVertices[1]); gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); gl.glDrawArrays(GL.GL_QUADS, 0, 12);
gl.glDisableClientState(GL.GL_VERTEX_ARRAY); gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY); } |
The for loop is for drawing all four layers of the map. Ummmm... probably not the best way to do it but I'm still figuring things out. Thanks for the help.
|
|
|
|
|
23
|
Java Game APIs & Engines / JOGL Development / Re: FPSAnimator hates me
|
on: 2011-03-29 15:27:16
|
|
No, it's just the one texture. Not reading from the disk either. I can't imagine that too many objects are being created... That's one of the things the Netbeans profilers are good for. I do use vsync, but I just tried turning it off and tweaking the fps desired and the result was horrible. It was choppy and crappy from the start. At least with the original setup the game ran smoothly for a little while and then turned crappy. I'm stumped.
|
|
|
|
|
24
|
Java Game APIs & Engines / JOGL Development / FPSAnimator hates me
|
on: 2011-03-28 21:08:43
|
|
I have a game which uses FPSAnimator for the game loop. The game runs perfectly fine for about a minute, and then becomes choppy. Sometimes, also for seemingly no reason, it might snap back to normal speed. Now, I'm just an amateur programmer, and not great at all with debugging. I can't really rule out a memory leak, and Netbeans is helping me sort that out, but when debugging comes into play I get stupid.
Does anyone have any thoughts? I don't know what to post here (as far as code goes), so let me know please.
|
|
|
|
|
26
|
Java Game APIs & Engines / JOGL Development / Should I move to VBOs? [Resuelto]
|
on: 2011-03-17 23:36:52
|
|
Hey folks. I've been working on a game for a long time now. I made it using immediate rendering. It's a simple display, drawing 612 quads for the tiles (as long as there is something to draw at all), and quads for whatever other characters there are milling about. It runs at 60fps with the v-sync, and does so smoothly even on my old laptop (which is 5 years old... but does have a dedicated graphics card).
Seeing as how there is so little stress (since I see people complaining about how their millions of vertexes are only chugging along) in my game, is there any reason at all for me to rewrite the whole thing using VBOs? I've been working on it the past few days, but I'm not a hardcore programmer and I'm running into issues.
Thanks in advance for the opinions.
|
|
|
|
|
27
|
Java Game APIs & Engines / Java Sound & OpenAL / Re: Skipping Clips
|
on: 2010-09-22 18:09:38
|
Ah. Yeah I was looking around the forum and it looked like you were the man to ask. I'll take a look at that option. I hope I don't need it. The game I'm working on is a Pokemon clone, and I consider those to be pretty much the ultimate closed system. Nothing new ever needs to be generated, so if there was ever a need for 5 explosions at once (like the move Explosion or Self Destruct, I just realized), there would probably be a sound effect just for it. But since the point of the game is to learn (and oh boy have I learned things), I'll give your suggestion a shot. Thanks, man. EDIT - Woo I figured it all out. Mods you can close this puppy up. The solution I used can be found here: http://www.dreamincode.net/forums/index.php?app=blog&module=display§ion=blog&blogid=114&showentry=1631
|
|
|
|
|
28
|
Java Game APIs & Engines / Java Sound & OpenAL / Skipping Clips
|
on: 2010-09-22 17:24:59
|
Hi all. It's my first time working with sound in Java and I feel like I'm back in high school trying to figure out a monster. I wanted to create sound effects for my game. I started with this class, that seemed very helpful at first: 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 59 60 61 62 63
| import java.io.*; import java.net.URL; import javax.sound.sampled.*;
public enum SoundEffect { EXPLODE("explode.wav"), GONG("gong.wav"), SHOOT("shoot.wav"); public static enum Volume { MUTE, LOW, MEDIUM, HIGH } public static Volume volume = Volume.LOW; private Clip clip; SoundEffect(String soundFileName) { try { URL url = this.getClass().getClassLoader().getResource(soundFileName); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(url); clip = AudioSystem.getClip(); clip.open(audioInputStream); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (LineUnavailableException e) { e.printStackTrace(); } } public void play() { if (volume != Volume.MUTE) { if (clip.isRunning()) clip.stop(); clip.setFramePosition(0); clip.start(); } } static void init() { values(); } } |
It does work pretty well. But let's take one specific case. When I walk into a wall it's supposed to play a sound. That works, but if I hold the key down, sometimes the sound does not play. Seems like something is getting overwhelmed playing the sound over and over. It's not a total deal breaker for using this code, but I just wanted to know if there's any way to fix it. Also the sounds in my game are very simple, and only come from one basic direction, so I don't think I should have to use anything fancy like JOAL. However I could be wrong so let me know? EDIT - That is not my code. I simply used it as a jumping off point. It is relatively unchanged in my game, aside from the constructor calls up top. EDIT 2 - Well I figured out how to get past my problem for now, in a way I like, but I'd still like to know if there is anything I can do in the future if I need to rapidly play sounds. Thanks!
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|