Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
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 / Java 2D / Re: Problem with image drawing and FPS on: 2012-08-23 03:09:29
I'll check what you said, maybe there is something I can't think of right now.
The only thing that comes in mind is that I don't draw a specific area of the map size on the board. I draw all 1000 tiles, even though those that are not supposed to be drawn. Is it possible that causing the issue? In other words I am NOT implementing something like this: . Instead all of my tiles are drawn.
2  Java Game APIs & Engines / Java 2D / Re: Problem with image drawing and FPS on: 2012-08-23 02:33:51
I think I found a temporary solution to my problem, although any other ideas are more than welcomed. My solution is to load images as ImageIcons. I tried to load a 100x100 map at 80 fps/ups and the results were the game to run at 50 fps and 80 ups.
3  Java Game APIs & Engines / Java 2D / Re: Problem with image drawing and FPS on: 2012-08-22 23:01:01
Below you can see the classes of the program. I made a small version of my game that runs in windowed mode (the same problem with fps dropping occurs in both full screen mode and NON full screen mode) which only paints the background and contains the classes that are needed to do that.

Game class:

gamePanel class (Most of the gaming loop code is taken from a book i've been reading):

World class:

Floor class:

Tile class:

Map class:

The image i use is this one (to change the location within the program change the string in the beginning of the Floor class: 40th line)

You can change the map size by modifying the mHeight and mWidth variables  at the very beginning of the World class.

I tried using volatileImages but didn't speed up my FPS value.
An alternative of Java2D like slick2D is not an option right now. I'd like to find a way to solve my problem using java2D. In case I can't find a solution, then I'll use another library like slick2D, etc.

By the way thanks everyone for your answers Smiley
4  Java Game APIs & Engines / Java 2D / Re: Problem with image drawing and FPS on: 2012-08-22 17:38:37
There are many draw functions used in the game, so here I am posting the one I think is the most responsible one.
The code to draw the "floor" of the map is the following:

   public void draw(Graphics g){
      Graphics2D g2d = (Graphics2D) g;

      //draw Floor
      for (int i = 0; i < floorAl.size(); i++){
         g2d.drawImage(floorAl.get(i).getImage(), null, floorAl.get(i).getX(), floorAl.get(i).getY());

floorAl is an ArrayList<Tile>, where all the Tile objects representing the floor are contained along with the their x,y positions and their BufferedImages.
The Tile class makes use of another class called BufferedImageLoader which is responsible for loading any BufferedImage passed as a parameter to the constructor.
5  Java Game APIs & Engines / Java 2D / Problem with image drawing and FPS on: 2012-08-22 17:11:32
I am developing a full screen exclusive mode isometric tile game from scratch -i.e. I don't use a game engine- and I have a problem when it comes to drawing "BufferedImages" and "Images" on screen. (I am using active rendering)

The default FPS value is set to 80, but when the map tiles are drawn on screen the FPS value drops at 60. The map size (=array's size) at the moment is 100 tiles (10 width * 10 height). If I change that to 100*100=1000 tiles then the FPS value drops to 0 and the game cannot be played.

The code I use to load buffered images is the following:

BufferedImage image= File(file));

while the code to load Images is the following:

Image image= File(file));

where file is a string containing the path to the image.
The size of the tile-image that it loaded is ~3KB.

Do you have any idea why does the FPS value drop? Or a different way to suggest on how to draw images without occuring problems to the FPS value?

Thanks in advance,
Pages: [1]
theagentd (99 views)
2017-02-18 13:42:33

theagentd (103 views)
2017-02-18 13:35:16

h.pernpeintner (1268 views)
2017-01-24 22:39:11

h.pernpeintner (1257 views)
2017-01-24 22:38:32

Galdo (1816 views)
2017-01-12 13:44:09

Archive (1921 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2459 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2298 views)
2016-12-15 21:50:57

Lunch (2377 views)
2016-12-06 16:01:40

ral0r2 (2155 views)
2016-11-23 16:08:26
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!