Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Reloading openGL assets on android


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 SillyCow   Members   -  Reputation: 886

Like
0Likes
Like

Posted 13 March 2013 - 05:05 PM

My new game on android has bigger models and textures than my previous game.

 

The design I used for my previous game is a menu activity which would then call my play-level activity.

The player would choose an item from the menu, and the game activity would load.

 

This worked fairly well when I didn't have alot of assets. On good devices loading was almost instantaneous.

But now, my new game needs about 15 seconds to load the models and textures.

Most of the time is spent on parsing the model files and turning them into binary data for VBOs.

The other part is spent decompressing JPEGs & turning them into texture bitmaps.

 

I know I can reduce loading time by having my models saved in binary VBO  format in the first place, and saving my textures in a GPU compressed format. But I view that as a messy solution. I only want one set of data, I shouldn't have to load it over and over. From my PC experience, I'd tackle this problem by keeping everything in global RAM, load it once when the game starts, and keep it in RAM until the game is closed. Perhaps even keep it the GPU if possible.

 

As far as I can tell Android requires me to have isolated RAM for different activities. So when the play-level activity ends, my data goes bye bye. And thus every time the player goes back to the menu, I reload the assets.

 

Of course, I can start with the play-level activity first, and have that then call the menu. But again that seems messy, why should I load the play-level activity before the player started playing?

 

Does anyone have a good suggestion for a design pattern here?


Edited by SillyCow, 13 March 2013 - 05:32 PM.

My new android game : Enemies of the Crown

My previous android game : Killer Bees


Sponsor:

#2 frob   Moderators   -  Reputation: 22289

Like
1Likes
Like

Posted 13 March 2013 - 05:50 PM

But now, my new game needs about 15 seconds to load the models and textures.
Most of the time is spent on parsing the model files and turning them into binary data for VBOs.
The other part is spent decompressing JPEGs & turning them into texture bitmaps.

Sounds like you've got the problem solved already.

 

 

For PC and major consoles you use a DDS format.  No decompression necessary and it is handled by the card on PC and on the big consoles.  This dramatically improves texture memory sizes and texture loading speeds.

 

For Android you get to choose between ETC1 (supported by everyone) and optionally choose between PVRTC, ATITC, and S3TC, depending on which specialized hardware you want to support.

 

That will get rid of much of your known bottleneck.


Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 gfxgangsta   Members   -  Reputation: 608

Like
0Likes
Like

Posted 13 March 2013 - 06:48 PM

If you do end up using ETC1, just know that it doesn't support Alpha, but there are workarounds.

 

http://en.wikipedia.org/wiki/Ericsson_Texture_Compression



#4 SillyCow   Members   -  Reputation: 886

Like
0Likes
Like

Posted 14 March 2013 - 12:12 AM

I still have the problem of my models, and level files...


My new android game : Enemies of the Crown

My previous android game : Killer Bees


#5 Nusakan   Members   -  Reputation: 444

Like
0Likes
Like

Posted 14 March 2013 - 06:36 PM

I still have the problem of my models, and level files

 

I really can't think of anything other then going for custom binary format file. I think its well worth the trouble of implementing it though. I was using .dae(collada) models before, it was taking anywhere around 30 second to 1 minute depeding how many models to read. After implementing a CBF it took around 5 seconds to load all models. So my advice would be none other then CBF.


Edited by Nusakan, 15 March 2013 - 11:41 AM.


#6 SillyCow   Members   -  Reputation: 886

Like
0Likes
Like

Posted 15 March 2013 - 01:01 PM

But even 5 seconds is plenty of time. After I've got the models in memory loading them over and over seems like a waste of the user's time.

My new android game : Enemies of the Crown

My previous android game : Killer Bees


#7 Nusakan   Members   -  Reputation: 444

Like
0Likes
Like

Posted 15 March 2013 - 09:18 PM

But even 5 seconds is plenty of time. After I've got the models in memory loading them over and over seems like a waste of the user's time.

I am sorry if I m missing something but I am not sure what you ment by loading them over and over. your models should be loaded on the memory before you start your game. you shouldn't be loading models again and again during game play. that will surely slow things down. Once you got your models all loaded, you just show what you want to show and ignore the ones you don't need.

 

Also you don't need to load the same models again once you loaded them to the  memory once. As an example , lets say you have a zombie npc model. and if you have 10 of these zombies on your game, you only need to load the zombie once. not 10 times. same things applies to your textures. if you have a textures that is shared by different models, you don't need to load textures for these models again. you simply use the same texture.



#8 SillyCow   Members   -  Reputation: 886

Like
0Likes
Like

Posted 16 March 2013 - 01:58 AM

The problem is that my menu is a different android activity. It is the activity that launches the "play level" activity. Think "angry birds" here. When the user exits to the menu, and then re-enters the "play level" mode, I relaunch the activity and have to load everything again. This is because once the activity is disposed of, all the memory it allocated is also gone.

My new android game : Enemies of the Crown

My previous android game : Killer Bees


#9 Nusakan   Members   -  Reputation: 444

Like
0Likes
Like

Posted 16 March 2013 - 05:16 AM

The problem is that my menu is a different android activity. It is the activity that launches the "play level" activity. Think "angry birds" here. When the user exits to the menu, and then re-enters the "play level" mode, I relaunch the activity and have to load everything again. This is because once the activity is disposed of, all the memory it allocated is also gone.

Well. I still don't see a problem here. waiting couple of seconds before a level loads is perfectly acceptable. even angry bird has that. my 5 second example was in a 3D game environment where models has skeletal animation data, position vertices, normal vertices and text coords as well as vertex weights. The entire scene is made by approximately 20k vertices. I am not sure how complex your scene is but I would suggest you not  to disregard  CBF without trying it.   



#10 Ed Welch   Members   -  Reputation: 485

Like
0Likes
Like

Posted 16 March 2013 - 10:02 AM

I advise using compressed textures (i.e PVR), or if quality is an issue use compressed Targa. RLE compressed Targa loads much faster than PNG or jpg.

Also, if loading a file do not load it byte by byte, load it all in one block.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS