Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (516)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (577)
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  Java Game APIs & Engines / JOGL Development / Should I use ARB or NON arb functions? on: 2009-07-07 15: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 13: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; //We'll completely ignore all loadlibrary calls from jinput.
   }
}


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  
//Code cut out, it's not hard, just look up the System.getProperty("os.name") field on the internet
switch(ostype){
            case WINDOWS:
               System.load(runningDir+File.separator+"jinput-dx8.dll");
               System.load(runningDir+File.separator+"jinput-raw.dll");
               //System.load(runningDir+File.separator+"jinput-wintab.dll");
               break;
            case MACOSX:
               System.load(runningDir+File.separator+"libjinput-osx.jnilib");
               break;
            case LINUX: case 4231: //Solaris
               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 13:39:37
Link to adapter: http://www.play-asia.com/paOS-13-71-6m-49-en-70-qc3.html
With 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 { //Replace controllerenvironment with new one, unfortunately we can't dispose old one correctly till shutdown
            defaultEnvironment = ControllerEnvironment.class.getDeclaredField("defaultEnvironment");
            defaultEnvironment.setAccessible(true);
            defaultEnvironment.set(null,new DefaultControllerEnvironment()); //DefaultControllerEnvironment made public.
         } 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 05: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 13: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.
6  Java Game APIs & Engines / JInput / Re: Newest JINPUT: 3 versions of linux fail after GetControllers on: 2008-05-23 03:27:38
Sorry for necroing my old thread, but I gotta solve this problem.

My game is really coming along, and works beautifully on mac & Windows. However, my linux friends have decided that it is unacceptable to run the game as root.

Here is some of the joystick input code Stepmania uses, which does NOT have to be run as root to get to full and superfast joystick access:
http://sourceforge.net/mailarchive/forum.php?thread_name=20080105053904.GF16723%40machine.or.cz&forum_name=stepmania-devs

How high on the priority list is getting non-root access working on linux? A simple switch to disable force feedback (Since I need it for nothing) may help, but it looks like we're having trouble even reading (Stepmania, once again, gets full access to my dance pads whereas jinput gets the "failed to create device" error)

Please?
7  Java Game APIs & Engines / JInput / Re: Newest JINPUT: 3 versions of linux fail after GetControllers on: 2008-03-27 03:22:37
Thanks, me and my friend are looking for a way to give embedded applets in linux firefox root access. Because it's already signed, and has read privvies... but somehow can't read these linux files

because that's what we're doing.
8  Java Game APIs & Engines / JInput / Newest JINPUT: 3 versions of linux fail after GetControllers on: 2008-03-26 04: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 Tongue

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
9  Game Development / Newbie & Debugging Questions / Re: Stuttering in very simple Java2D fullscreen exclusive mode game on MS Window on: 2007-06-17 01:51:05
's scary as it looks, you really should try opengl Sad Seriously, just spend the time and stress out over getting it installed: You'll have alot of trouble getting it to work, but when you do, you will be happy.

Just do it.
10  Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack? on: 2007-06-15 16: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) //THIS IS OPTIONAL, ITS JUST SO THAT YOU NEVER "HIT THE SAME TIME" TWICE, because BYTE_OFFSET has 10 ms resolution, slower than our iteration.
                  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++){ //This if a very bad way to do it :p I'll fix it soon.
               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 15: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 Cheesy

edit: nahhhh actually that doesn't work either Sad looks like I'll have to deal with my 10 ms resolution Sad
12  Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack? on: 2007-06-15 14:23:44
k, modified my above post in between you posting Tongue

but ya, I figured out the samplerate for my file by looking at sample programs, it is currently working, but the resolution is very low: al_bytes_offset appears to be updated very infrequently
13  Game Development / Newbie & Debugging Questions / Re: Synchronizing events with a streaming audio soundtrack? on: 2007-06-15 13:40:58
Yes, I'm looking for code that does that Tongue

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 21: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 Tongue

I'll stick with my vanilla build.

can't help you, man.
15  Game Development / Newbie & Debugging Questions / Re: Installing JOGL on: 2007-06-14 21:29:21
CTRL+SHIFT+O, my friend. Save afterwords too.
16  Game Development / Newbie & Debugging Questions / Re: Installing JOGL on: 2007-06-14 21: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 Tongue
17  Game Development / Newbie & Debugging Questions / Synchronizing events with a streaming audio soundtrack? on: 2007-06-14 21:01:35
Post revision v.2: (hopefully more fun to read)

I want to play a streaming ogg file, and fire an event at second 8.043 of the song.

Things I have available: Jogl and Joal both running, but I can use anything at this point: I'm desperate! What audio systems will give me the capability to get playback position?
18  Game Development / Newbie & Debugging Questions / jTouhou - very slow framerates & HUGE delay before window pops up on: 2007-06-04 23: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 Tongue 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.
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.

TehJavaDev (33 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (41 views)
2014-10-26 19:37:11

Luminem (22 views)
2014-10-26 10:17:50

Luminem (27 views)
2014-10-26 10:14:04

theagentd (33 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (58 views)
2014-10-16 15:22:06

Norakomi (47 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!