Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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 / Re: Severe Sporadic System Slowdowns? on: 2005-09-10 03:58:21
Well I turned off 'Dislay window contents while moving window' in the windows display settings and it's not quite as bad...  Seems like a hack of a solution though.  :/
2  Java Game APIs & Engines / JOGL Development / Severe Sporadic System Slowdowns? on: 2005-09-10 03:12:41
(Say that five times fast Wink)

I've got a GLCanvas in a Swing app, and sometimes my entire system seems to become unresponsive for short periods of time (probably 2~3 seconds, but it sure feels like more Tongue) while the application is active.  I notice it consistently when I move the application window, but I noticed it occasionally when appending text into a textarea and forcing the textarea to scroll...

Needless to say, I'm concerned about this behaviour.  I really want to use JOGL in this application, but if I can't get a reliable steady framerate, then I won't be able to.   Undecided

After the system 'unfreezes', when I had taskmanager open already, 'java.exe' was running at 100% CPU.

I plugged in the FPSAnimator to see if it made a difference (either way, I'll be using it).

I'm running a Windows XP system with loads of RAM and a decent video card.

I'm running the application from within NetBeans.


Thank you!  Hope that's enough info to get a lead!
3  Game Development / Networking & Multiplayer / Re: Writing a client using NIO on: 2005-09-05 02:06:24
Thanks for the help everyone!

I managed to scrounge up a really nice client/server NIO chat application sample (courtesy of PKWooster) using Swing for the client and now I'm all up and running!  Everything sort of makes sense when you take a working example app and recopy it line-for-line!  Wink

Now I just need to integrate JOGL into the client, which should be simple compared to the last day or so! Cheesy
4  Game Development / Networking & Multiplayer / Writing a client using NIO on: 2005-09-03 21:36:54
Thought I'd put this in a separate topic!

I've seen a bunch of links describing how to use NIO to write servers.  Are there any similar resources for making clients?  Is NIO even worthwhile to use to write clients?   Huh

Thanks! Cheesy
5  Game Development / Networking & Multiplayer / Re: Shutting down the network loop on: 2005-09-03 19:05:05
Yeah, the frame is already set to close like that...

I worked around it by putting my test server into a console app  Tongue

Actually, now I'm running into a brand new slew of problems...  I can find a bunch of tutorials and whatnot about creating a server using NIO, but not a client...  Do people not use NIO for writing clients?  I'm very new to NIO...  (and it's been a while since I've done anything in Java anyway Wink)

I'm going to take a trip to the book store today to see if they've got any books of interest there!  Cheesy
6  Game Development / Networking & Multiplayer / Shutting down the network loop on: 2005-09-03 15:32:10
Hi there!

I'm trying to make a little chat server using Swing and NIO.  I've got the main class based on JFrame, and a ServerBase object (based on the code from http://java.about.com/gi/dynamic/offsite.htm?zi=1/XJ&sdn=java&zu=http%3A%2F%2Fwww.owlmountain.com%2Ftutorials%2FNonBlockingIo.htm) that does all the networking jazz.  The problem is that when I shut the main window, the program doesn't actually exit.

This is what the main networking method looks like:

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  
   public void acceptConnections() throws IOException, InterruptedException
   {
      SelectionKey acceptKey = selectableChannel.register( selector, SelectionKey.OP_ACCEPT );
      System.out.println( "Acceptor loop..." );
      while( ( keysAdded = acceptKey.selector().select() ) > 0 )
      {
         System.out.println( "Selector returned " + keysAdded + " ready for IO operations" );
         
         Set readyKeys = selector.selectedKeys();
         Iterator i = readyKeys.iterator();
         while( i.hasNext() )
         {
            SelectionKey key = (SelectionKey)i.next();
            i.remove();
           
            if( key.isAcceptable() )
            {
               ServerSocketChannel nextReady = (ServerSocketChannel)key.channel();
               System.out.println( "Processing selection key" +
                  " read=" + key.isReadable() +
                  " write=" + key.isWritable() +
                  " accept=" + key.isAcceptable()
                  );
               
               SocketChannel channel = nextReady.accept();
               channel.configureBlocking( false );
               SelectionKey readKey = channel.register( selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE );
               readKey.attach( new ChannelCallback( channel ) );
            }
            else if( key.isReadable() )
            {
               SelectableChannel nextReady = (SelectableChannel)key.channel();
               System.out.println( "Processing selection key" +
                  " read=" + key.isReadable() +
                  " write=" + key.isWritable() +
                  " accept=" + key.isAcceptable()
                  );
               
               readMessage( (ChannelCallback)key.attachment() );
            }
            else if( key.isWritable() )
            {
               ChannelCallback callback = (ChannelCallback)key.attachment();
               // Have to find a way to actually ... you know... do stuff.
              String message = "What is your name?";
               ByteBuffer buf = ByteBuffer.wrap( message.getBytes() );
               int nBytes = callback.getChannel().write( buf );
            }
         }
      }
     
      System.out.println( "End acceptor loop." );
   }


From what I can tell, it just sort of sits at the 'while( blah blah )' until it gets something over the network, right?  But since I haven't written a client yet, that never happens.  hehe

For that matter, how can I hook up an event handler of some sort to catch when the application is shutting down, so that I can clean all this up?

Thanks 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.

xsi3rr4x (31 views)
2014-04-15 18:08:23

BurntPizza (28 views)
2014-04-15 03:46:01

UprightPath (43 views)
2014-04-14 17:39:50

UprightPath (26 views)
2014-04-14 17:35:47

Porlus (43 views)
2014-04-14 15:48:38

tom_mai78101 (64 views)
2014-04-10 04:04:31

BurntPizza (124 views)
2014-04-08 23:06:04

tom_mai78101 (224 views)
2014-04-05 13:34:39

trollwarrior1 (190 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!