Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Loading stuff...when should it be done?  (Read 4512 times)
0 Members and 1 Guest are viewing this topic.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #30 - Posted 2012-07-19 19:25:34 »

Really? omg... I just googled it and it seems to be true :O

I just found this forum question on google: http://newsgroup.xnview.com/viewtopic.php?t=4101
Just another guy confirming, that compression level 6 would be the best.
Oh, and I always thought such compression levels only apply on gimp...
And finally, if your artists are using Photoshop it looks like photoshop automatically saves png's with compression level 6 by default, so my suggestion wouldn't help you...

How cheeky! I might consider changing, then. Is there any reason I shouldn't just use 9 compression?

Offline StumpyStrust
« Reply #31 - Posted 2012-07-19 19:31:12 »

If you use photoshop you know that when you create a new file or image you get a lot of options. Your choice will greatly effect the size of files and what not.

Resolution and color mode are the big ones. There are more options with advanced but I don't really use that much.


Offline DrewLols

Senior Member


Medals: 1
Projects: 1


Noob going through metamorphosis...


« Reply #32 - Posted 2012-07-19 19:44:16 »

Can't say that this is in my place to give advice seeing as I'm sort of a newb myself, but I for one believe that unless you're not concerned with the memory consumption at all, I would suggest option 2.  I actually asked a similar question in the past.

You could make a class meant for loading resources upon request.  For instance, in my project, I wrote something along the lines of...
(Keep in mind that I'm programming with Slick2D)




public class Resources
{

    HashMap images;    // Cached images
    String imageLoc;     // Folder for images


    public Resources()
    {
        images = new HashMap<String, Image>();
        imageLoc = "res/images/";
    }


    public void getImage(String fileName
    {
                 // Checks for image in cache...
                 Image image = images.get(fileName);

                // If the image was not found in cache...
      if(image == null)
      {

                         // Tries to load the image using the file name given, and caches it
         try
         {
                                image = new Image(imageLoc + fileName);
            images.put(fileName, image);
         }

                        // Fails to load the image...  what a sad day...
         catch (SlickException e)
         {
            e.printStackTrace();
         }
      }

                // Gimmeh mah image!
                return image;
   }


        public void release()
        {
            // All resources are released to save memory
        }
}




This code is untested, but it demonstrates the helpfulness of hash maps in some instances.  Dunno if this will be useful to you, but I just felt like posting it.  I always prefer to make many hash maps for different types of resources, and make a few methods for retrieving the resources like the one above.  I also make load methods which load a requested resource while returning nothing serving only as a lightweight version of the get methods.

P.S. Sorry for the sloppyness

Did you know that 90% of statistics are wrong?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline davedes
« Reply #33 - Posted 2012-07-19 19:59:09 »

Really? omg... I just googled it and it seems to be true :O

I just found this forum question on google: http://newsgroup.xnview.com/viewtopic.php?t=4101
Just another guy confirming, that compression level 6 would be the best.
Oh, and I always thought such compression levels only apply on gimp...
And finally, if your artists are using Photoshop it looks like photoshop automatically saves png's with compression level 6 by default, so my suggestion wouldn't help you...

How cheeky! I might consider changing, then. Is there any reason I shouldn't just use 9 compression?
Greater compression may lead to smaller file size, but also much greater load times.

Before changing the compression strength, you should be thinking about other more significant parameters: indexed colours, bit depth, transparency, etc.
http://www.smashingmagazine.com/2009/07/15/clever-png-optimization-techniques/

Here's a couple handy tools for optimizing PNG/JPG/etc:
http://imageoptim.com/
http://trimage.org/

Unfortunately, these tools may "over-compress" images -- meaning the file size is small, but the loading (decompression) time is longer than usual. Because of this, you might be better off saving the images yourself, choosing the right parameters and compression settings with Gimp/Photoshop.

Offline Ultroman

JGO Knight


Medals: 24
Projects: 1


Snappin' at snizzes since '83


« Reply #34 - Posted 2012-07-19 22:11:17 »

Thanks for all these great replies, guys! I'll be doing my own testing around with my PNGs to see how it works for me. I have a debugger set up so I can see how many nano-seconds I'm allowed to sleep each update, and a load-time calculation for the images, so I should be able to muster up some results. Probably a good idea to test both on my laptop (Geforce 525M) and my desktop (Geforce 9600GT; yep, still holds it's own in newer games ^^).

- Jonas
Offline ra4king

JGO Kernel


Medals: 337
Projects: 2
Exp: 5 years


I'm the King!


« Reply #35 - Posted 2012-07-20 05:16:31 »

This post should help you with Java2D in general.

This post should explain the whole roadmap with Java gaming and your eventual migration to OpenGL.

Good luck! Smiley

Offline ReBirth
« Reply #36 - Posted 2012-07-20 09:38:51 »

I prefer OP's 2nd option. Don't split the load time. Let the user starts a game and they could go make a coffee, ice skating, chopping some wood, p**ping, or slapping a bear before they experience the smooth gameplay.

EDIT: option 1 I meant.

Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #37 - Posted 2012-07-20 13:35:34 »

I prefer OP's 2nd option. Don't split the load time. Let the user starts a game and they could go make a coffee, ice skating, chopping some wood, p**ping, or slapping a bear before they experience the smooth gameplay.
Huh option 2 was splitting the load-time, so it loads levels at the start of each level ?!?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline ReBirth
« Reply #38 - Posted 2012-07-21 08:28:40 »

@matheus23
Option 1 I meant, a once time hard bloody load.

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.

Riven (7 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

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

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

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

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

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

Zero Volt (51 views)
2014-07-17 23:47:54
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!