Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
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  
  Loading all images at once, or as-needed  (Read 638 times)
0 Members and 1 Guest are viewing this topic.
Offline vbrain
« Posted 2013-11-01 19:10:26 »

So, I've been wondering what method of loading assets would be better:

1. Load all assets at once when the game is first run. This will mean that all the assets will be kept in memory. Sounds, music, images for in-game, images for menus, everything.

2. Load everything as needed. At the start of each menu, only it's needed images will be loaded. When the game starts, it will release the menu assets from memory and load the assets for game play.

Currently, I'm using method 1, but I feel like I should switch to method 2 to conserve memory. What do you think, and what method do you use?
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2013-11-01 19:20:07 »

I would say go with method 2, as it will take up far less memory, which is obviously a good thing. If your game is small (pong clone, pac man, whatever else), and you don't have a ton of assets, then no it wouldn't be a huge deal. But think about it, say you have a image that will only be used for the menu, why keep it in memory if you don't need it?

Offline vbrain
« Reply #2 - Posted 2013-11-01 19:32:54 »

I would say go with method 2, as it will take up far less memory, which is obviously a good thing. If your game is small (pong clone, pac man, whatever else), and you don't have a ton of assets, then no it wouldn't be a huge deal. But think about it, say you have a image that will only be used for the menu, why keep it in memory if you don't need it?

Exactly what I was thinking. My game is slowly getting bigger and bigger, and it occurred to me that method 1 (which I had used for smaller games) would not be a good idea for a more advanced game.
Loading a 1mb background picture for the menu and keeping it in the memory during gameplay when it isn't needed seems like a bad idea.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #3 - Posted 2013-11-01 19:45:25 »

I would also recommend using spritesheets to store all your textures instead of loading them individually, it'll reduce your memory footprint if your images aren't huge.

Offline Elusivehawk

Junior Member


Medals: 1
Projects: 1



« Reply #4 - Posted 2013-11-01 20:03:13 »

Yeah, method 2 is definitely the way to go; However, you'll want to multithread asset loading, otherwise performance will tank in short bursts every time something new happens, which you definitely don't want.
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.

radar3301 (11 views)
2014-09-21 23:33:17

BurntPizza (28 views)
2014-09-21 02:42:18

BurntPizza (18 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (29 views)
2014-09-19 03:14:18

Dwinin (46 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!