Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (532)
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 / Newbie & Debugging Questions / Re: How to achieve scrolling screen with BufferStrategy? on: 2012-10-21 00:39:56
Well I think I managed to solve my problem (thinking is pretty hard when I am awfully tired  Grin)

Well now I am asking is this vice way to do:

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  
public void renderScreen() {
      if(bI == null) { //double buffer image I used before BufferStrategy
        bI = createImage(screen_width*2, screen_height);
         bG = bI.getGraphics();
      }
           //drawing code here
  }
   
   public void paint(Graphics g) {
      strategy = this.getBufferStrategy();
      g = strategy.getDrawGraphics();
     
      //draw buffer image to screen
     g.drawImage(bI, (int)buffer_pos_x, 0, null); //drawing the "buffer" Image to screen
     g.dispose();
      strategy.show();
      Toolkit.getDefaultToolkit().sync();
   }
   
   public void run() {
      if(mappi != null && pl != null) {
         while(game_on == true) {
            pl.playerMove();
            renderScreen();
            repaint();
            try {
                Thread.sleep(fps_sleep);
            } catch(InterruptedException ie) {}
         }
      }
      if(game_on == false) System.exit(0);
   }


Is that a correct order of BufferStrategy and rendering & etc. ?

Edit: As regarding to my last topic where I had problems with Fraps, I ran to this kind of problem:
When recording under 77fps Fraps records flickrs while playing game. When recording at 77fps flickers dont exist. Is this normal? I am just testing my game and the final game wont run faster than 60 fps. Normal? Problematic? Strange behavior? Bad Code?
2  Game Development / Newbie & Debugging Questions / Re: How to achieve scrolling screen with BufferStrategy? on: 2012-10-20 23:59:19
Maybe one of the most common type of sentences on this forum: I am pretty new to coding (well not new but after long time since training I decided to continue game making) so I dont quite understand how I should include AffineTransform into my code. I am using JFrame (if that tells something?). Im pretty lost at the moment.  Clueless

Edit: I wouldnt like to change all my code into Graphics2d so thats why I feel this kinda as a problem. Cheesy
3  Game Development / Newbie & Debugging Questions / How to achieve scrolling screen with BufferStrategy? on: 2012-10-20 21:06:49
I had problems with Fraps and my Java game few days back and I was suggested to use BufferStrategy. So I used it and problems are gone now, but I ended up to situation where my coding skills arent enough to solve this simple problem: I used to draw everything to an image. After everything was drawn the Image was shown to screen (=double buffering). And now BufferStrategy has taken place of the image.

I used to also move that image so that screen scrolls left and right depending where player moves. So how can I reach same result? Im pretty stuck at this point with this.  Huh
4  Game Development / Newbie & Debugging Questions / Re: Java & Fraps = flickering? on: 2012-10-17 18:51:46
If you dont throttle the fps, you are just going to heat up the gpu and stuff, normally just vsync and/or cap at 60 fps
Actually I had fps capping in there but I commented it away while trying to find solution to this problem. Dont worry its not a problem. I used 60 fps mainly for this.  Grin
5  Game Development / Newbie & Debugging Questions / Re: Java & Fraps = flickering? on: 2012-10-17 18:40:53
BufferStrategy works for me with Fraps! Thank you for help Cero!  Grin

However I ran to problem: I used to draw my graphics to image which I used for double buffering. I drew that image to screen and checked offset for image from players position (scrolling screen).
6  Game Development / Newbie & Debugging Questions / Re: Java & Fraps = flickering? on: 2012-10-17 17:16:02
your game runs > 60 fps
seems odd already.
in Java2D, you should use BufferStrategy and preferably Vsync
I am giving BufferStratety a try. But fps>60 is odd? How so? Cheesy
I am pretty novice to game making and been working on this project for half a year when I have had a time for coding so I am lacking of knowledge of how things should be done. Tongue
7  Game Development / Newbie & Debugging Questions / Re: Java & Fraps = flickering? on: 2012-10-17 02:20:59
wow thats odd. I always use FRAPS and never had a problem...mmmh
well one thing you can do is upload some app of yours that has the problem and let someone else try using FRAPS
may of course also have to do with the FRAPS version, if there was a bug, which I dont know
I thought it was bug I tried 2 versions on Fraps and problem still existed in newer one. Go on and give it a try: http://dhost.info/ttradio/dimMain.jar  Smiley
8  Games Center / WIP games, tools & toy projects / Re: Tiny Dungeons - WIP on: 2012-10-17 02:07:12
Graphics is indeed awesome! Im hoping to hear about this more!
9  Game Development / Newbie & Debugging Questions / Re: Java & Fraps = flickering? on: 2012-10-17 01:46:02
Unfortunately I do not have your solution (yet) but I have experienced a similar issue where every other second or so my game's Fraps recording will flash blue in the background. I'm using Slick2D as opposed to pure Java2D but if I find a solution I will be sure to inform you.
That would be really glad and I would be thankfully!  Grin
10  Game Development / Newbie & Debugging Questions / Java & Fraps = flickering? on: 2012-10-17 01:17:53
I am trying to record my progress with my game making into a video with Fraps, but I am running in to this kind of problem: <a href="http://www.youtube.com/v/0m6n5Gnt7-s?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/0m6n5Gnt7-s?version=3&amp;hl=en_US&amp;start=</a>
Does anyone have a clue is this Java + Fraps related problem or is this purely just because of my code? Fraps and Minecraft runs just fine but with my own creation I have that problem. As you can see: recording runs well couple seconds but then it starts (I tested and its not related to screen scrolling). Any ideas are welcome.  Huh
11  Game Development / Newbie & Debugging Questions / 2d collision detection on: 2009-11-06 20:06:12
I'm making 2d game viewed from up and I'm having problems with collision detection. First I made array based collision detection and moving but I think it wasn't good. So I'm asking how I could make simple collision detection? I was thinking something like this: if(player inside of box) {player_loc - player_speed } where player_speed is how many pixels player will move everytime button is pressed but it didn't work as I wanted it to work.  Huh

EDIT: I solved this already! Sorry for post! Smiley
12  Java Game APIs & Engines / JOGL Development / Re: JOGL and Ubuntu problem! on: 2008-09-06 08:51:08
I get JOGL to work on this computer (finally).I have 2 computers, but on other I dont get it to work.Something is wrong with it.I must just try some ways to fix the problem in it.But thanks a lot cylab!
13  Java Game APIs & Engines / JOGL Development / Re: JOGL and Ubuntu problem! on: 2008-09-04 17:28:07
Well now i get something working!Thanks!But I have only one problem yet!I run that your program but it doesnt draw anything to window!It gives lot of error but I get window!That good!Thanks! Smiley
14  Java Game APIs & Engines / JOGL Development / Re: JOGL and Ubuntu problem! on: 2008-09-04 15:37:28
I deleted files from ext (I putted them to there earlier), but now I must use com.sun.opengl because it is new version of JOGL.But still I get error.Eclipse gives error from Animator and something stuff like that.Before i deleted jogl from ext it didnt do that same.So do I have to put them back to ext?
15  Java Game APIs & Engines / JOGL Development / Re: JOGL and Ubuntu problem! on: 2008-09-04 13:53:47
I tryed to use one JOGL cube example from programming website, but I get error like this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: net.java.games.jogl.impl.JAWTFactory.JAWT_GetAWT0(Ljava/nio/Buffer;)Z
   at net.java.games.jogl.impl.JAWTFactory.JAWT_GetAWT0(Native Method)
   at net.java.games.jogl.impl.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:37)
   at net.java.games.jogl.impl.NativeLibLoader$1.run(NativeLibLoader.java:66)
   at java.security.AccessController.doPrivileged(Native Method)
   at net.java.games.jogl.impl.NativeLibLoader.<clinit>(NativeLibLoader.java:46)
   at net.java.games.jogl.impl.x11.X11GLContextFactory.<clinit>(X11GLContextFactory.java:50)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:169)
   at net.java.games.jogl.impl.GLContextFactory.getFactory(GLContextFactory.java:69)
   at net.java.games.jogl.GLJPanel.<init>(GLJPanel.java:89)
   at net.java.games.jogl.GLDrawableFactory.createGLJPanel(GLDrawableFactory.java:193)
   at net.java.games.jogl.GLDrawableFactory.createGLJPanel(GLDrawableFactory.java:160)
   at JoogliDemo.main(JoogliDemo.java:24)


i didi everything like in that Eclipse quide told!Whats the problem?
16  Java Game APIs & Engines / JOGL Development / Re: JOGL and Ubuntu problem! on: 2008-09-03 17:44:46
I tryed to add Native Librarys but I get that same error.I added those gluegen.jar or what ever it was and jogl.jar again and tryed to replace that with new jogl.jar old jogl.jar but that didnt help. =(
17  Java Game APIs & Engines / JOGL Development / JOGL and Ubuntu problem! on: 2008-09-03 16:35:14
So I download JOGL and installed it somehow right way but when I try to run any program what contains JOGL I get error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl.jar in java.library.path
   at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
   at java.lang.Runtime.loadLibrary0(Runtime.java:823)
   at java.lang.System.loadLibrary(System.java:1030)
   at Demo.main(Demo.java:12)

So where I have to add that jogl.jar?I am using Ubuntu and Eclipse!I tryed to sreach help from Google but I didn't find anything. Angry
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.

pw (15 views)
2014-07-24 01:59:36

Riven (14 views)
2014-07-23 21:16:32

Riven (13 views)
2014-07-23 21:07:15

Riven (15 views)
2014-07-23 20:56:16

ctomni231 (43 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!