Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Don't kill me...  (Read 7367 times)
0 Members and 1 Guest are viewing this topic.
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #30 - Posted 2004-08-17 11:40:40 »

Quote
3. Mac display problems. Again, not sure why it displays properly on other platforms and not on the mac. I'm guessing it's a BufferStrategy issue. This is what I was doing (I don't want page flip since I'm using dirty rectangles to speed up rendering already)

1  
createBufferStrategy(2, new BufferCapabilities(new ImageCapabilities(true), new ImageCapabilities(true), null));


@swpalmer, can you elaborate on the problem? Does it occur in windowed mode or at the different resolutions as well?


Hard to explain...

I see it switch to fullscreen.  The Aqua background is painted (this is normal), and because you have hard-coded the display resolutions and I'm using a widescreen display I see black areas on the sides.
Then a fraction of a second later I see that square aqua background shift down and to the right by an inch or two, still being clipped by the original area of the screen.  Then the background is drawn in this offset position and the progress bar is shown as you set up,  the title screen appears and you can see that everything is obviously shifted down and to the right since the green bar border only shows on the top and the left.

I have never seen anything like it before. Other fullscreen games (e.g. Gravity Battle) work fine.  I suspect it might be related to the order that certain things are done.

P.S. When I choose exit I'm left in fullscreen mode on a blank black screen. - though I don't recall that happening before.

Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #31 - Posted 2004-08-17 13:28:40 »

Made changes again:

1. Now does frame skipping so it's at least playable on slower computers.

There are now two counters on the bottom left corner:

FPS shows the amount of times the renderer is called
UPS shows the amount of times the game is updated

The game will try to render at 60FPS, failing that, it will skip frames to meet that goal.

Press F3 to enable/disable the counters
Thanks to blah3 for suggesting this
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #32 - Posted 2004-08-17 16:58:48 »

Wow. A completely different game when played at the normal speed Wink.

Worked fine for everything EXCEPT the input (which is still losing keypresses and sometimes taking two keypresses where there was just one) and the menu screen whose fade appears to still be frame locked (i.e. slow).

The "READY GO" message is a LOT nicer when moving fast!

PS in all previous versions, when the red and blue bars scroll out at start of level, there was huge amount of tearing on both bars - approximately ten or twenty simultaneous tears on each bar. So, you're not doing any double-buffering then?

malloc will be first against the wall when the revolution comes...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline esdeboer

Junior Newbie




Java games rock!


« Reply #33 - Posted 2004-08-17 17:22:43 »

The framerate mystery is because I didn't have the timer.dll (webstart doesn't like my proxy)
With the timer dll the framerates drop to 16 fps
Without the timer the framerate is still 50 fps and 63 updates
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #34 - Posted 2004-08-17 18:43:13 »

Just tried it on a 2ghz PC in windows with GF4MX.

Observations:

- The IMHO v.annoying "feature" that once you hit drop you cannot move sideways becomes a LOT less annoying when you have the alpha shadow of where the block will land!

- The controls work much better - you can actually smoothly slide the blocks. Although rotations are still sometimes being dropped or lost. I think you might need to re-examine your KB handler, it seems buggy.

- What are the occasional flashes in random incomplete rows, or is this just eye candy? Smiley

- I was still getting a mere 25-26 FPS!!! (note PC specs above) but presumably because it's windows with accelerated alpha everything not only ran smoothly but looked good too (I had all effects ON this time).

malloc will be first against the wall when the revolution comes...
Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #35 - Posted 2004-08-18 06:05:19 »

Quote


Hard to explain...

I see it switch to fullscreen.  The Aqua background is painted (this is normal), and because you have hard-coded the display resolutions and I'm using a widescreen display I see black areas on the sides.
Then a fraction of a second later I see that square aqua background shift down and to the right by an inch or two, still being clipped by the original area of the screen.  Then the background is drawn in this offset position and the progress bar is shown as you set up,  the title screen appears and you can see that everything is obviously shifted down and to the right since the green bar border only shows on the top and the left.


I've changed the screen setup a bit for FSEM mode. Mind trying again to see if the layout's still screwed on your Mac?

Quote

P.S. When I choose exit I'm left in fullscreen mode on a blank black screen. - though I don't recall that happening before.


This is probably due to the buggy nature of FSEM mode for 1.4.2.

I've been forced to restart the game to perform video mode changes, and add lots of ugly Thread.sleep()s to the code to get a bit of stability.

I've cleaned up the screen disposing routine so it hopefully won't happen again.


Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #36 - Posted 2004-08-18 06:33:46 »

Quote
The framerate mystery is because I didn't have the timer.dll (webstart doesn't like my proxy)
With the timer dll the framerates drop to 16 fps
Without the timer the framerate is still 50 fps and 63 updates


So you're saying that WITH the timer you get 16 fps and WITHOUT you get better frame rates? Are you on a Windows platform?

Very wierd.  Huh

Quote

- The controls work much better - you can actually smoothly slide the blocks. Although rotations are still sometimes being dropped or lost. I think you might need to re-examine your KB handler, it seems buggy.


@blah: I kind of wish I could trade my com for yours for a couple of days to see and fix the problems you're having on your machine. I'm kind of stuck otherwise since it seems to be working pretty well on a couple of PCs I've tested.

I've changed the KB handler to be a bit more robust. But I didn't do any major changes, so it's probably still fuctionally the same.

A shortcoming/feature of my game is that a piece cannot rotate if it's blocked.

Here's my keyboard handling classes, maybe you can help me figure out the problem:

This class basically represents all the states of the keys on the keyboard. If a key is depressed, it's key code is added into a list
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  
public class Keyboard extends KeyAdapter
{
      private IntList pressedKeys; // a list of all keys that are currently pressed
      
      public Keyboard()
      {            
            pressedKeys = new IntList(5); // A list of ints to represent the keys that are currently pressed
      }
      
      public synchronized void resetKeyStates()
      {
            pressedKeys.clear();
      }
      
      public synchronized void keyPressed(KeyEvent e)
      {
            int keyCode = e.getKeyCode();
            if(!pressedKeys.contains(keyCode)) // add the key to the list if it's not already in it
                  pressedKeys.add(keyCode);
      }
      
      public synchronized void keyReleased(KeyEvent e)
      {
            pressedKeys.remove(e.getKeyCode()); // remove the key from the list
      }
      
      public synchronized int[] getPressedKeysList()
      {
            if(pressedKeys.size() > 0)
            {
                  int[] keys = new int[pressedKeys.size()];
                  pressedKeys.toArray(keys); // returns a copy of the array of all keys pressed
                  return keys;
            }
            return null; // if no keys are being pressed, return null
      }
}


Then I've got a that class represents the player controls. It basically takes the current state of the keys on the keyboard (giving priority to the keys that have a movement function, and feeds them to the main game class). Here's the main key handling code:

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  
int[] keysPressed = keyboard.getPressedKeysList(); // the current list of all keys pressed
            
            if(keysPressed != null) // if there's at least 1 key being pressed
            {      
                  int keyCode;
                  int keyFunction;
                  
                  for(int i=0; i < keysPressed.length; i++)
                  {
                        keyCode = keysPressed[i];
                        keyFunction = actionKeys[keyCode]; // get the game function of the key
                        if(keyFunction > NO_FUNCTION) // the current pressed key has a MOVEMENT TYPE function
                        {
                              if(previousKey == keyCode) // if the key is still pressed down
                              {
                                    if(previousTime >= 130) // delay to avoid typing too fast
                                          currentGameMode.keyPressed(playerID, keyFunction, keyCode); // feed the key to the current game mode      
                                    
                                    previousTime+=waitTime;      
                                    return;                        
                              }
                                                
                              currentGameMode.keyPressed(playerID, keyFunction, keyCode); // feed the key to the current game mode
                              previousKey = keyCode;
                              previousTime = 0;
                              return;
                        }
                  }
            }
            else
                  previousKey = 0; // no key is pressed at the moment


And then there's the "advance game state" loop:
1  
2  
3  
4  
5  
6  
7  
8  
// handle input events
            player1.handleKeyInput(waitTime); // processes input for player 1
            player2.handleKeyInput(waitTime); // processes input for player 2
                  
            player1.handleMouseInput();
                
            // advance the game state
            currentGameMode.advanceGameState(waitTime);


Regarding the occasional flashes you see: it's just eye candy. (That's the simulated volumetric light effects which you can disable as well)



Offline esdeboer

Junior Newbie




Java games rock!


« Reply #37 - Posted 2004-08-18 16:56:11 »

Quote


So you're saying that WITH the timer you get 16 fps and WITHOUT you get better frame rates? Are you on a Windows platform?

Very wierd.  Huh



Yes indeed, whithout the timer the fps are much higher (on WinXP)
Offline Matlu

Junior Devvie




Hasta La Victoria Siempre!


« Reply #38 - Posted 2004-08-18 19:42:54 »

VERY nice!!!  

- with 'turbo' runs at approx 180fps
- after 30 seconds my xp CRASHED! No blue screeen, just restart. Never happened before

- Duron 1.2 Ghz, 512mb ram
- Windows XP
- jre 1.4.2_05-b04 (sun)
- geForce 2 mx400

Multiplayer Online Games
http://www.duelboard.com
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #39 - Posted 2004-08-18 21:42:58 »

New version is a bit better.  Now it only shifts to the right, and by a smaller amount.  On the title screen I see that the border on the right just barely makes it on the screen now, so that is the amount of shift.

I turned on all the graphics options - bad idea FPS was 10.. it is unplayable like that.  Seems to miss keypresses.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #40 - Posted 2004-08-19 05:41:54 »

Quote
New version is a bit better.  Now it only shifts to the right, and by a smaller amount.  On the title screen I see that the border on the right just barely makes it on the screen now, so that is the amount of shift.


Is the entire screen shifted to the right, including the background graphics (that means the area to the left would probably have a strip of black/white), or is it just the foreground that is shifted?

Quote

I turned on all the graphics options - bad idea FPS was 10.. it is unplayable like that.  Seems to miss keypresses.


Kind of expected not-so-good performance on non-windows platforms since there's no hardware acceleration of translucent effects.

What is your UPS counter like? The only reason it should miss keypresses is if the the game isn't updating at 60 UPS.

Hey and thanks for helping to test my game on your Mac swpalmer. Man, wrestling with the blasted Mac VM to get it to run my app like other VMs is damned frustrating.

Quote

VERY nice!!!  

- with 'turbo' runs at approx 180fps
- after 30 seconds my xp CRASHED! No blue screeen, just restart. Never happened before

- Duron 1.2 Ghz, 512mb ram
- Windows XP
- jre 1.4.2_05-b04 (sun)
- geForce 2 mx400


Thanks for your comments.

Since your machine is capable of running the app at 180FPS in turbo mode, what's your normal FPS / UPS like? Is it a steady 63FPS?

About the xp reboot issue, i hope you saved your work.  Smiley
Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #41 - Posted 2004-08-19 05:46:27 »

Quote


Yes indeed, whithout the timer the fps are much higher (on WinXP)


Okay I'm lost on that. What's your UPS count like with the timer? The timer.dll is basically the same one provided in the gagetimer package.

Anyway, I've uploaded a different native .dll clock and timer class Hopefully, this one works properly on your system.

Thanks for testing.



Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #42 - Posted 2004-08-19 06:34:21 »

The slickest tetris game I've seen, so far  Smiley
The presentation is really awesome!
I also got some input problems (double keypresses), and when I left the game, my XP task bar was somewhere floating at the lower half of the screen.  Huh This was on my PC at work (P4, JRE 1.4.2_04, ATI mobility radeon).
Probably a driver issue, maybe combined with a bug in the fullscreen API. On my PC at home, I don't have the problem...

Offline esdeboer

Junior Newbie




Java games rock!


« Reply #43 - Posted 2004-08-19 14:02:46 »

Quote


Okay I'm lost on that. What's your UPS count like with the timer? The timer.dll is basically the same one provided in the gagetimer package.



It seems that the problem was not the timer.dll, I tried it today and I got 63/63 but sometimes a game has very low fps (16) and high UPS (70 to 200)

Your new version also has 63/63 (no low fps yet after two games)
Offline barfy

Junior Devvie




The evidence of things not seen


« Reply #44 - Posted 2004-08-19 15:52:26 »

@esdeboer:

Quote


It seems that the problem was not the timer.dll, I tried it today and I got 63/63 but sometimes a game has very low fps (16) and high UPS (70 to 200)


Thanks heaps for helping me out here.

Actually, that sounds like a timer issue. If FPS is this low and UPS that high, then it could be that the timer isn't returning accurate timings on your machine (which makes my frame skipping algo do crazy things).

Quote

Your new version also has 63/63 (no low fps yet after two games)


Just to clarify: So you're saying you get a steady 63 FPS/UPS now after downloading the most recent version (with a new timer.dll) but before you were getting crazy numbers in the FPS/UPS?

Hopefully this updated timer would settle the FPS issue on some machines (like blahx3's and DrBizarr0's).

Quote
The slickest tetris game I've seen, so far  
The presentation is really awesome!
I also got some input problems (double keypresses), and when I left the game, my XP task bar was somewhere floating at the lower half of the screen.   This was on my PC at work (P4, JRE 1.4.2_04, ATI mobility radeon).
Probably a driver issue, maybe combined with a bug in the fullscreen API. On my PC at home, I don't have the problem...


@erikd: Really appreciate those encouraging comments! Cheesy

Regarding the double keypresses issue, can you elaborate on when/how it happened (within the game while moving a piece or menu screen) ? Everything seems to be fine on my side... Are you running at a steady 63FPS/UPS?
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #45 - Posted 2004-08-19 20:49:39 »

Quote
Regarding the double keypresses issue, can you elaborate on when/how it happened (within the game while moving a piece or menu screen) ? Everything seems to be fine on my side... Are you running at a steady 63FPS/UPS?


I only get the double keypresses at my work PC, where I get 17-23 FPS (don't recall UPS there). I mainly notice the problem when rotating the blocks (it often rotates more than intended).
Here at home, I don't get the problem (getting 30-35 fps/62-63UPS, running on an athlon XP 2200+, Ti4200).

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #46 - Posted 2004-08-20 00:07:04 »

Quote
Is the entire screen shifted to the right, including the background graphics

yes

Quote
What is your UPS counter like? The only reason it should miss keypresses is if the the game isn't updating at 60 UPS.

55-60

Offline weston

Junior Devvie





« Reply #47 - Posted 2004-08-20 04:24:32 »

When I exit the game the taskbar is not at the bottom of my screen. I have fixed this before by restoring the user's original display mode before the program exits.

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline esdeboer

Junior Newbie




Java games rock!


« Reply #48 - Posted 2004-08-21 06:47:53 »

Quote


Just to clarify: So you're saying you get a steady 63 FPS/UPS now after downloading the most recent version (with a new timer.dll) but before you were getting crazy numbers in the FPS/UPS?



yes the FPS is now mostly a steady 63, One time it was 6/63 but that was probably because exceed was open  (exceed and fullscreen java don't go along nicely)
Offline misterX

Junior Devvie




java forever!


« Reply #49 - Posted 2004-08-24 19:00:10 »

simply put: the best Tetris game i ever played!!!
great job!
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

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

toopeicgaming1999 (63 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (57 views)
2014-11-12 21:11:50
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!