Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (540)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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  Game Development / Performance Tuning / Re: Keyboard input? on: 2003-03-12 01:40:17
Something like this might work:

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  
public class Game
extends KeyAdapter
{
      private boolean goLeft = false;
      private boolean goRight = false;

      public void mainGameLoop()
      {
            while (true)
            {
                  if (goLeft)
                  {
                        // go left
                  }
                  else if (goRight)
                  {
                        // go right
                  }
            }
      }

      public void keyPressed(KeyEvent e)
      {
            int code = e.getCode();
            if (code == KeyEvent.VK_LEFT)
            {
                  goLeft = true;
                  goRight = false;
            }
            else if (code == KeyEvent.VK_RIGHT)
            {
                  goRight = true;
                  goLeft = false;
            }
      }

      public void keyReleased(KeyEvent e)
      {
            int code = e.getCode();
            if (code == KeyEvent.VK_LEFT)
            {
                  goLeft = false;
            }
            else if (code == KeyEvent.VK_RIGHT)
            {
                  goRight = false;
            }
      }

}
2  Java Game APIs & Engines / Java 3D / Re: 3d transform data thru socket on: 2003-01-07 02:28:57
Quote
Technically I transmit them with the NIO api, which is told to be the most efficient these days.


Efficiency is not the same as performance. More specifically NIO is the most scalable, since the non-blocking nature does not require you to spawn a new thread per client. But that scalability comes at a price, performance.

So, if your non-NIO system would only ever have a couple of client threads (as opposed to the thousands needed for a web server), NIO overhead is probably not worth it.
3  Java Game APIs & Engines / Tools Discussion / Re: uml DIAGRAMS on: 2002-12-25 19:18:59
Yup, sometimes a whiteboard is the best tool to use.
4  Java Game APIs & Engines / Tools Discussion / Re: uml DIAGRAMS on: 2002-12-21 00:41:23
I just started using ArgoUML.  It's not as nice as Together, but it's a helluva lot cheaper.  Grin

http://argouml.tigris.org/
5  Games Center / Archived Projects / Re: GravityTrap ... first game on: 2002-12-16 20:59:41
Yours.  It's real sporadic, but occasionally it happens.  I'm not to hot with the gui stuff, but is it possible the commands are getting buffered?
6  Games Center / Archived Projects / Re: GravityTrap ... first game on: 2002-12-15 19:38:51
Hehe, is your last name pronounced "Gamer"??
7  Games Center / Archived Projects / Re: GravityTrap ... first game on: 2002-12-15 19:38:01
Awesome! I'm working on a similar game, but I couldn't get the gravity right.   Mind if I borrow some of your code? Grin

Also, there seems to be some wierdness with the input, like key commands are getting buffered. I'd move the ship around and fire for a while, then my input blocks while a bunch of old commands execute. I'll look at the source and see what's causing it.
8  Game Development / Performance Tuning / Re: steering by the keys on: 2002-12-09 22:41:01
Doh!.... except the if (code = KeyEvent.VK_XX) should be if (code == KeyEvent.VK_UP).
9  Game Development / Performance Tuning / Re: steering by the keys on: 2002-12-09 22:38:43
Like this:

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  
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class Game extends KeyAdapter
{
      private boolean up;
      private boolean down;
      private boolean left;
      private boolean right;

      private void mainLoop()
      {
            while (true)
            {
                  // check status of up, down, left, right
            }
      }

      public void keyPressed(KeyEvent e)
      {
            int code = e.getKeyCode();
            if (code = KeyEvent.VK_UP)
            {
                  up = true;
            }
            else if (code. = KeyEvent.VK_DOWN)
            {
                  down = true;
            }
            else if (code = KeyEvent.VK_LEFT)
            {
                  left = true;
            }
            else if (code = KeyEvent.VK_RIGHT)
            {
                  right = true;
            }
      }

      public void keyReleased(KeyEvent e)
      {
            int code = e.getKeyCode();
            if (code = (KeyEvent.VK_UP))
            {
                  up = false;
            }
            else if (code = KeyEvent.VK_DOWN)
            {
                  down = false;
            }
            else if (code = KeyEvent.VK_LEFT)
            {
                  left = false;
            }
            else if (code = KeyEvent.VK_RIGHT)
            {
                  right = false;
            }
      }
}
10  Game Development / Networking & Multiplayer / Re: architecture/multiple "worlds" management on: 2002-11-26 22:07:16
How about generating a key, sending it to the arena, letting it know about an incoming connection.  Once the Arena confirms receipt of the key, send the key to the client.  Client connects to arena, keys match, all is well.  Assuming there is a problem, the arena key times out after, say 1 min.
11  Games Center / Archived Projects / Re: Critique my game... on: 2002-11-05 18:37:11
I had the 1.4 issue with the first one, but the second works fine.
12  Java Game APIs & Engines / Tools Discussion / Re: Java Editor on: 2002-10-31 19:13:38
If one happened to be on Kazaa sometime around 9PM EST tonight, and happened to do a search for "VisualSlickEdit" they might happen to find someone sharing a full version, maybe....
13  Game Development / Networking & Multiplayer / Re: UDP based action on: 2002-10-29 23:18:51
Quote

Game has to be designed around network code. You cannot just bold it in late stage of development. I mean, you can, but you will need to rewrite major portions of it.


I agree with you, that was not what I meant to convey.  Perhaps a better explaination would be:

1) Design your system, with the networking specifics properly abstracted
2) Implement a reasonable prototype with TCP
3) Test, if TCP won't work, then you can move ahead with UDP

The benefit of this approach is
1) If there is more than one person working on the project, alteration to the mechanics of networking should be isolatable
2) The cost of testing a TCP implementation is negligible compared with the cost of implementing a UDP solution.

My 2 cents.  Alot of really smart people work on optimizing TCP over the net....
14  Game Development / Networking & Multiplayer / Re: UDP based action on: 2002-10-29 00:54:22
Given the development speed benefits of TCP, might it not behoove you to properly abstract the networking details, implement with TCP, and then verify whether or not you need to go through the hassle of UDP?
15  Discussions / General Discussions / Re: Missing the "Active Today" button on: 2002-10-17 02:10:25
Doh! Lips Sealed
16  Discussions / General Discussions / Missing the "Active Today" button on: 2002-10-16 22:32:11
I tried using the search feature, but it requires a String to search on.  Being able to one-click for all posts active in the past 24 hours was a great feature of the last board. Grin
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.

Mr.CodeIt (23 views)
2014-12-23 03:34:11

rwatson462 (53 views)
2014-12-15 09:26:44

Mr.CodeIt (45 views)
2014-12-14 19:50:38

BurntPizza (85 views)
2014-12-09 22:41:13

BurntPizza (110 views)
2014-12-08 04:46:31

JscottyBieshaar (78 views)
2014-12-05 12:39:02

SHC (89 views)
2014-12-03 16:27:13

CopyableCougar4 (95 views)
2014-11-29 21:32:03

toopeicgaming1999 (155 views)
2014-11-26 15:22:04

toopeicgaming1999 (151 views)
2014-11-26 15:20:36
Resources for WIP games
by kpars
2014-12-18 10:26:14

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