Show Posts
|
|
Pages: [1]
|
|
1
|
Java Game APIs & Engines / JOGL Development / Should I use ARB or NON arb functions?
|
on: 2009-07-07 17:04:21
|
|
I'm trying to get Vertex Buffer objects running in jogl on some older hardware, and I'm finding that it's tedious to be checking if all these functions are even supported..
My guess is that I have to check if the non-arb isSupported, then if not, try the arb issupported, then crash, or use a slow workaround that doesn't use the extension.
I'm just wondering if jogl does that for me; so that I don't have to write so much dern code.
|
|
|
|
|
2
|
Java Game APIs & Engines / JInput / Re: Load DLL outside or inside JAR?
|
on: 2008-07-17 15:48:32
|
I have a solution, but you may / may not like it. Ok, the reason everything is so difficult is because Jinput uses System.LOADLIBRARY, which is bad. Our goal is to use System.load() on a absolute path to where the dlls are. So, get the source of jinput (newest version), and make a new class: 1 2 3 4 5 6
| package <something> public class System { public static void loadLibrary(String lib_name){ return; } } |
Then, do a FileSearch on all of jinputs classes for "System.loadLibrary" and replace it with "<your package>.System.loadLibrary" It should replace 3-4 instances. Then, if you export the new jinput as a jar, run your code, nothing will work, because its not loading anything. So, we can load it ourselves now: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
| switch(ostype){ case WINDOWS: System.load(runningDir+File.separator+"jinput-dx8.dll"); System.load(runningDir+File.separator+"jinput-raw.dll"); break; case MACOSX: System.load(runningDir+File.separator+"libjinput-osx.jnilib"); break; case LINUX: case 4231: System.load(runningDir+File.separator+"libjinput-linux.so"); break; } |
:p I've had to do this with almost every java library I"ve ever used (Jogl, Gstreamer, etc.)
|
|
|
|
|
3
|
Java Game APIs & Engines / JInput / Re: Erroneous Events fired by creating new DefaultControllerEnvironment
|
on: 2008-07-17 15:39:37
|
Link to adapter: http://www.play-asia.com/paOS-13-71-6m-49-en-70-qc3.htmlWith a MadCatz dance pad (I'm suspecting its the adapter, not the pad though lol) I'm on windows VISTA, but I get the same problem on my XP) Here's the offending code. 1 2 3 4 5 6 7 8
| Field defaultEnvironment; try { defaultEnvironment = ControllerEnvironment.class.getDeclaredField("defaultEnvironment"); defaultEnvironment.setAccessible(true); defaultEnvironment.set(null,new DefaultControllerEnvironment()); } catch (Exception e){ e.printStackTrace(); } |
This is the only way I've found to actually refresh the list of controllers. Maybe one of the Win32 components created in the DirectInputControllernvironment is triggering the state info things whenever its created? Here's the debug: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Refreshed:71045.44189948 Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin [HID Keyboard Device, HID Keyboard Device, HID-compliant mouse, Logitech Gaming Keyboard, Logitech Gaming Keyboard, G15 Keyboard, Dual USB Force Feedback Joypad (MP-8866), Dual USB Force Feedback Joypad (MP-8866), 4 axis 16 button joystick, 4 axis 16 button joystick] rz: -0.007827878 @ 71045.93283804 z: -0.007827878 @ 71045.93334332 y: -0.007827878 @ 71045.93373372 x: -0.007827878 @ 71045.93407944 rz: -0.007827878 @ 71045.93718604 z: -0.007827878 @ 71045.93919352 y: -0.007827878 @ 71045.94007088 x: -0.007827878 @ 71045.94045692 slider: -1.0 @ 71045.9409122 slider: -1.0 @ 71045.94123924 rz: 1.0 @ 71045.94304308 z: 1.0 @ 71045.9433288 y: 1.0 @ 71045.94360948 x: 1.0 @ 71045.94386904 slider: -1.0 @ 71045.94459044 slider: -1.0 @ 71045.94500684 |
So, I execute the aforementioned code to refresh the controllers, and then this output comes. The Controller sending these is the "4 axis 16 button joystick" listed here (the superdualjoybox) The time is in seconds (nanos / 1e9) My solution: Those "-0.007827878" in value() seem to be specific to the first few erroneous events: Whenever I press actual buttons, I get nice clean 0.0 and 1.0 results. So, solution: if you get -0.007827878, ignore the next event unless its also -0.007827878.Nevermind. The one that works best is just ignoring input for a second or so. I grey-out the refresh button during this time to the user "gets it".
|
|
|
|
|
4
|
Java Game APIs & Engines / JInput / Erroneous Events fired by creating new DefaultControllerEnvironment
|
on: 2008-07-17 07:01:34
|
|
Behavior: Everytime I use the ControllerEnvironment class (and trigger the static-construction of the DefaultControllerEnvironment), I know these two things happen
1.) Because of my win32 system, the "DirectAndRawInputControllerEnvironment" is picked 2.) The DirectInputControllerEnvironment is set up 3.) The RawInputControllerEnvironment is set up
SOMEWHERE in those 3 steps, all buttons of all my controllers send off a "hello world" event (that is, they appear in the event queue) . Sometimes they have value=0, sometimes value = 1. Sometimes they send a value=0 and then a nanosecond later again with value = 1.
They're giving me problems, because I can't tell them apart from actual events.
I'm thinking these erroneous events (because they are created everytime the environment is set back up, and are not triggered by button presses) are some sort of debugging, and I would like to know how to disable it
Thanks, I really love using this library!
|
|
|
|
|
5
|
Java Game APIs & Engines / JInput / Re: Newest JINPUT: 3 versions of linux fail after GetControllers
|
on: 2008-05-27 15:11:55
|
|
A call to the Version.getVersion() class returned
2.0.0-b01
Anyway, I've been working on the other parts of my game pretty heavily the past month (being able to use controllers on the developing system, windows, made this possible), so I'll get the newest version this afternoon and try it out again on my friends' computers.
Sorry for posting a rant and not following up on it, i'll get back to you later today.
|
|
|
|
|
8
|
Java Game APIs & Engines / JInput / Newest JINPUT: 3 versions of linux fail after GetControllers
|
on: 2008-03-26 05:03:09
|
Code: ControllerEnvironment evn = ControllerEnvironment.getDefaultEnvironment(); Controller[] controllers = evn.getControllers(); Output: (reproducible on all 3 of my friend's linux boxes) Loading: net.java.games.input.LinuxEnvironmentPlugin Failed to open device (/dev/input/event6): Failed to open device /dev/input/event6 (13) Failed to open device (/dev/input/event5): Failed to open device /dev/input/event5 (13) Failed to open device (/dev/input/event4): Failed to open device /dev/input/event4 (13) Failed to open device (/dev/input/event2): Failed to open device /dev/input/event2 (13) Failed to open device (/dev/input/event1): Failed to open device /dev/input/event1 (13) Failed to open device (/dev/input/event0): Failed to open device /dev/input/event0 (13) Linux plugin claims to have found 0 controllers ^ what is "hopeful" is that it does say "claims to have found 1 controllers" whenever we plug in our DDR dance mat to the usb adaptor  I've seen posts handling this bug, but I fear it's... reemerged? BTW the application works beautifully on my windows err heres the applet: http://dragonfire.exofire.net/lightningsteps/Java
|
|
|
|
|
10
|
Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack?
|
on: 2007-06-15 18:06:05
|
THE RESULT OF THIS THREAD: This method gives you 10 ms resolution to ACTUAL MIXER PLAYBACK TIME. That is GOOD ENOUGH. (I'm making a music game, and it is spot on. Seriously, I stress tested it: It looks right on the beat.) Code to synchronize audio through JOAL, because you can't get this capability with javasound (because theres an unpredictable delay from javasound to mixer playback. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| new Thread(new Runnable(){ public void run(){ while(true){ try { Thread.sleep(1); } catch (Exception e){ }; int[] values = new int[1]; al.alGetSourcei(sourceID, AL.AL_BYTE_OFFSET, values,0); long temp_Position_MS = (int)(1000.0*(totalBytes-BUFFER_SIZE*2+values[0])/ numBytesPerSample/ numChannels / rate); if (Position_MS == temp_Position_MS) Position_MS++; else Position_MS = temp_Position_MS; } } }).start(); |
Somewhere deep in the stream code: 1 2 3 4 5 6 7 8 9 10 11 12
| byte[] pcm = new byte[BUFFER_SIZE]; int size = 0;
try { if ((size = oggDecoder.read(pcm)) <= 0) return false; } catch (Exception e) { e.printStackTrace(); return false; }
totalBytes += size; |
The tester code: 1 2 3 4 5 6 7
| double gap = .096; double bpm = 198.757763975155279; for (int a = 0; a < 400; a++){ if (audio.offOf((int)(1000*(gap+a*(60/bpm))))<20){ Trenderer.draw("BAM!", (int)myCharacter.getX(), (int)myCharacter.getY()); } } |
and 1 2 3 4
| public long offOf(int target){ long returnee = Position_MS - target; return returnee < 0?-returnee:returnee; } |
|
|
|
|
|
11
|
Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack?
|
on: 2007-06-15 17:18:39
|
Well, the problem is that I think that I need to use the BYTE_OFFSET, because that actuall says how many bytes have been played by the mixer (!!!) , but, for somereason, the resolution appears to be EXACTLY 10 ms. Soooo, I made a sub loop, that watches for its change. So, we store the value of BYTE_OFFSET in a temp, and if it doesnt change between iteration, we increment a millisecond. If it changes, we're at the new time. cool  edit: nahhhh actually that doesn't work either  looks like I'll have to deal with my 10 ms resolution 
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack?
|
on: 2007-06-15 15:40:58
|
Yes, I'm looking for code that does that  how many samples per second for ogg? isn't it variable bitrate? edit: What I've got so far: new Thread(new Runnable(){ public void run(){ try { Thread.sleep(500); } catch (Exception e){ } while(true){ try { Thread.sleep(1); //Every ms update } catch (Exception e){ } int[] values = new int[1]; al.alGetSourcei(sourceID, AL.AL_BYTE_OFFSET, values,0); Position_MS = (int)(10000.0*(OggStreamer.this.totalBytes+values[0])/ OggStreamer.this.numBytesPerSample/ OggStreamer.this.numChannels / rate / 10.0); if (Position_MS>4926) System.out.println(Position_MS); } } }).start(); Now, this is very strange: AL_AL_BYTE_OFFSET remains unchanged every 20 iterations!!! Why is it only updated so infrequently!? This could kill my game Does ANYONE have some better ideas?
|
|
|
|
|
14
|
Game Development / Newbie & Debugging Questions / Re: Installing JOGL
|
on: 2007-06-14 23:46:34
|
ooh I think I've seen that before. The fact that "games" is in the import list implies that you're using tutorials based on some weird build of jogl XD get the build by google searching JOGL and doing the first link. POINT BEING, you're reading tutorials on builds of jogl that are convenienced for games, and I havent ever been able to find those  I'll stick with my vanilla build. can't help you, man.
|
|
|
|
|
16
|
Game Development / Newbie & Debugging Questions / Re: Installing JOGL
|
on: 2007-06-14 23:10:47
|
ya, ya, ya, jogl is always a bitch to set up, but when you do end up getting it working, its amazing. What you may have to do: 1.) make sure its in build path of project (You implied this, so were good) 2.) Go to the "Run..." option in eclipse (top of window) and add to the Arguments tab the VM argument -Djava.library.path=---LOCATION OF LIBRARY DIRECTORY--- If it still doesnt work, right click My Computer, go to Advanced, go to Environmental Variables, go to Path, go to Edit, APPEND on to the end of the line --LOCATION OF LIBRARY DIRECTORY-- and a SEMICOLON soo... ya jogl is a bitch to install 
|
|
|
|
|
18
|
Game Development / Newbie & Debugging Questions / jTouhou - very slow framerates & HUGE delay before window pops up
|
on: 2007-06-05 01:47:56
|
You can download a current build (including neede resources) and current source code @ beam.to/jtouhou or taif.selfip.com My problem is this: Even after profiling all the code in my game, the slowdown seems to be the initialization of the new GLJPanel, Setting the window to visible, and the first 3 redraws. After that, fps gradually ups to 20 fps... but its still very slow. So, I'm requesting a quick look-over by anyone with some time to see if I made any blatant errors  if this sort of post is disallowed, I'll really try to just post code snippets here but honestly I still think I have no idea where the slowdown is: the fact is, that from runtime to first repaint (I get a "transparent frame" for a few SECONDS) it takes 23 seconds MINIMUM before the game starts running. AND then, its only 20 fps.. Anyway, thanks for reading! go to beam.to/jtouhou to get the current src code.
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|