Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Flickering applet  (Read 1070 times)
0 Members and 1 Guest are viewing this topic.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Posted 2011-12-20 01:20:29 »

My applet:

http://www.otcsw.com/applet/DreadMaze/

Has some weird flickering issues (you need to play a couple minutes in to see them). I'm guessing it has to do with the fact that I originally made it an app then changed some things last minute to make it an applet, but I was wondering if anyone had any pointers as to why this might happen. I'm sort of double buffering. I'm drawing everything to a BufferedImage which is drawn into a JPanel that is within another JPanel within the Applet. I tried removing the BufferedImage part and just drawing everything right into the JPanel but then it got awful.

I am only creating the graphics for the BufferedImage once, then I'm drawing to that. I considered maybe recreating and disposing the graphics every draw call. Any idea if that would help?

Thoughts?

EDIT - I removed the super.paintComponent call and that seems to help, but it still flickers. Not sure what the deal is.

See my work:
OTC Software
Offline philfrei
« Reply #1 - Posted 2011-12-20 01:47:50 »

I saw no flickering. I can't think why changing an App to an Applet would affect flicker.

Very fun! Really great to be able to click any square and have it automatically do the path. Maze traversal could be rather tedious otherwise.

My hero's health bar was always empty. I'm assuming that is the red bordered long skinny rectangle. After a couple of games being scared and running away from everything, I started exploring the entire maze and battling and picking up ALL the experience and stuff possible on each level. But I never saw my health bar change, if that is what it was. Thus, it was really hard to judge when I had enough to battle a boss or run away. (Hard to tell, for me, who was a boss or not, too.)

Is it possible to have an enemy boss get generated in between the hero and the requisite shield or potion? I'm not sure if this happened or not, as I had trouble ID'ing what was what. Are the potions time-based?

It might be interesting if the places one went (and could no longer see) faded from sight (and memory...). It might be interesting to have multiple paths if it does occur that "random" generation creates an impossible obstacle (boss between you and potion). If one is too weak to battle and runs away into a blind alley, that seems like it can happen randomly, and thus, with nothing one can do or anticipate to avoid this situation, one might give up hope or interest.

But really cool, and all the animation looked smooth as far as I could tell.
Windows XP, Mozilla Firefox 8.0

"It's after the end of the world! Don't you know that yet?"
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2011-12-20 01:51:45 »

I had/have this issue: http://www.java-gaming.org/topics/how-on-earth-do-i-stop-my-applet-from-flickering/25013/msg/214084/view.html

What platform/browser/jre are you using?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #3 - Posted 2011-12-20 02:24:03 »

Wow that was really fun. I really liked the sounds effects Tongue
No flickering for me, everything ran smoothly and beautifully.

Offline BoBear2681

JGO Coder


Medals: 19



« Reply #4 - Posted 2011-12-20 02:51:02 »

The flickering is terrible here on OS X, which I think is what you're using, right Eli?  Maybe Orangy's on the right track with it being a platform-specific problem.
Offline JL235

JGO Coder


Medals: 10



« Reply #5 - Posted 2011-12-20 04:33:32 »

See my comment here.

It's a known issue with Mac OS. Essentially the applet can't own the context it is drawing to, because the JVM plugin now runs in a separate process. To get around this it does some copy/update magic, but the downside is that applications that update constantly (like games), flicker horribly. You can drag the applet out into it's own window (I don't know specifically how, as I don't use Mac OS, but you can), where it owns the Window, and so avoids the copy/update issue.

Other OS's are unaffected because Mac OS has a more restrictive security policy around window ownership between processes. I believe on Mac OS they have to be explicitly given from one process to another, which browser's currently aren't built to do.

I believe the 32-bit JRE is unaffected, as the JVM doesn't run in a separate process; this is simply because it is out dated. But these days most browsers will use the 64-bit JRE by default (I believe you can only get 64-bit on Lion), and some browsers will only use the 64-bit version (if I remember correctly, Chrome does this).

Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2011-12-20 05:33:29 »

... and some browsers will only use the 64-bit version (if I remember correctly, Chrome does this).
No, Chrome is a 32-bit process and it only uses the 32-bit version of Java on Windows. I don't know about Mac though.

Offline ReBirth
« Reply #7 - Posted 2011-12-20 14:03:04 »

Wow that was really fun. I really liked the sounds effects Tongue
No flickering for me, everything ran smoothly and beautifully.
you really have something on your computer right?

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #8 - Posted 2011-12-20 16:15:33 »

Excellent thanks for the comments everyone. Great to know it's Mac OS X only (that is indeed what I'm running on, with Safari/Chrome).

One thing I notice is that when I reconstruct the back buffer BufferedImage (which happens each time you get to a new level) the buffering seems to stop for a little while. I'm going to maybe create a new BufferedImage every single draw call (which seems mighty costly, but this game is pretty cheap) and see if that helps.

Also reading over Orangy's post and other linked info.

As for gameplay comments - you will know when you're fighting a boss. It's every 5 levels and it says beforehand very loudly "BOSS BATTLE!!!1!!!1!" just so you know. The boss is also extra huge. It is possible to die during the course of gameplay before you reach the boss just from getting unlucky - because items are random and enemies can pick up items, if one gets a shield then the whole group following them will get the shield (as it will drop only to be picked up the next) which can sometimes make it take 3 times as long to kill each enemy. This can whittle down your health and screw you over. Usually if you make it to your first level up and you defeat the first boss, you're golden.

I'm not sure what's up with the hero's health bar, did anyone else have that issue? It works fine for me locally. Some of the smooth animations (I think the health bar increasing/decreasing is included in this) are not framerate-independent so if you have a particularly high or low framerate I could see maybe it screwing up. Oh well, that's what happens with limited time.

See my work:
OTC Software
Offline AurelienRibon

Senior Newbie


Medals: 3


Toolmaker, yeah.


« Reply #9 - Posted 2011-12-20 16:26:59 »

No problems here (win7 32b), but you already figured your issue with OSX Smiley
Excellent game btw, I spent a lot of minutes on it, it's really entertaining and has an excellent gameplay! Reminds me of some game I had on my Texas instrument back in school.

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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #10 - Posted 2011-12-20 16:33:28 »

FYI reconstructing the backbuffer every draw cycle does nothing but hurt the FPS. Oh well. :-/

I just included a link to download the JAR directly, as it's also executable as an app anyway. So Mac users can do that.

See my work:
OTC Software
Pages: [1]
  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.

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

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

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

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

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

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

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

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

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

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
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!