What's the needs of "Asset manager"?

What's the needs of "Asset manager"?
0.0 0


Hi guys,

We are implementing asset manager to enhance CCFileUtils. So i want to know what’s the needs of it.
You are appreciated to give me some suggestions. It is better if you have a prototype.

Thank you.


Hi Minggo,
I am new on this forum, and I am working on a conversion of a game from Ios to Android.
Thank you for the job done by the community and all the advice on this forum, it’s really helpfull :smiley: .

A suggestion for an asset manager : a research function
bool findFile(const char **name, std::string &*fullPath)


in android:
use asset fd with mmap, so you don’t need to unzip files from apk.
just use mmap and get the file content! :slight_smile:


hi Minggo,
what mostly confused me is that I want to save something in the game,even it’s different operations in Android and IOS ,what’s more,it’s too diffculty in Android to do that.So,is there some methods to unite the file operation in different platform?


`Nico L.
Thank you for your suggestion, so “bool isFileExist()” is needed.

`Splash Huang
Thank you. Do you have any suggestion of the interface of asset manager?

@trila Yang
Did you mean some interface like save is needed?


I have to see the sencond owner ,help to topping,

—by first note


i guess errrrrr,
getFileType() (png/mp3/pvr.ccz/plist/…)?
copyFileToWritableStorage(const char* fileName) (usually used for a sqlite3 db file)?

for music files, is it possible to get duration?

And Another feature (not about Assets Manager) is that the SimpleAudio Engine should support play sound in sequence……


Can you add a function in CCFileUtil to get list of all files/directory in given path.

Function like CCArray* getFilesInDirectory(const char *dir_path);


It would be nice to have a list of fallbacks for folders. My iPad and retina iPhone versions share a lot of resources, so when the file is not found in the iPad folder I would like it to go look in the retina iPhone folder and then if the file is not found then it should go look in the root folder


Minggo Zhang wrote:

Hi guys,
We are implementing asset manager to enhance CCFileUtils. So i want to know what’s the needs of it.
You are appreciated to give me some suggestions. It is better if you have a prototype.
Thank you.

Is it possible to update part of a zip file without affecting other parts? and is it possible to add content to an existing zip file?

I don’t know if anybody is working on something like asset downloading, after we have downloaded the assets as a zip file, we can work without unzip it, and use the content directly. But what if we want to update the zip file? It seems we can only download the whole zip file again, or unzip the files. Any one knows any better way to do the update? Thanks.


`Michael Ding
Does getFileType() needed? I think it is known as the file extension.

`Billy Lavoie
I think CCFileUtils::addResourceDirector() meets your needs. Right?

`Cissy Hope
I don’t know why you need to update part of a zip file.

`Michael Ding
About SimpleAudioEngine, i think it is better to discuss it in anther thread.

Now asset manager looks like

// functions CCFileUtils has
unsigned char* getFileData(const char *fileName,  const char *mode, unsigned long *size);
unsigned char* getFileDataFromZip(const char *fileName,  const char *mode, unsigned long *size);

const char* fullPathFromRelativePath(const char *relativePath);

void addResourceDirectory(const char *directoryName);
void removeResourceDirectory(const char *directoryName);

const char* getWritablePath();

// new functions
bool isFileExist(const char *fileName);
CCArray* listFilesInDirectory(const char *directory);
unsigned long getFileSize(const char *fileName);

Any more ideas?


@Minggo Zhang
Perfect :slight_smile:


Minggo Zhang wrote:

@Cissy Hope
I don’t know why you need to update part of a zip file.

Like we have downloaded the asset zip file at the beginning of game, but one month later we may want to update/add more resources.

We can:

  1. If haven’t unzipped the original file, we need to download the whole zip file again from scratch.
  2. Unzipped the orginal file as soon as it is downloaded, and only update/add the new file.

Just wonderring if we have third solution, like update/add the zip file without unzip it.


*getDeviceFile(char* nameOfFile)*

Will return file.png (iphone) or file-hd.png (iphone retina), file-ipad.png(ipad), file-ipadhd.png (ipad retina), file-hd5.png (iphone 5)

on android it will return the best image for device resolution -> a device with 480x320 resolution will return file.png, a device with 400x800 resolution will return the file-hd.png, etc…

I’m using this for my latest port “Guess the Character” to android devices.


i think i would be very helpfull if the asset manager would support additional resource pathes. The order of the pathes discribes the search priority.
With that mechanism it would be possible to download files in the writable path and use them instead of the original files without do the check for every sprite etc on its own.


Perhaps an abstracted function to use platform specific cloud storage (if available) would be nice.


I looked at the release yesterday and no signs of the new asset manager (btw it’s nice to see the whole “family” release at once).

I was just wondering if there’s an approximate time frame for the asset manager? It would be useful for my project but I might have to work something else out.


What do you think about letting anything listen for changes to files in realtime,
I wonder if that could enable changes like this:

might be more useful for development though?
Looks like an exciting features still…


I am sorry about plan of “assert manager”.
We have other more important things to do.



It seems, according to this post discussion on assetManagerEx that it is being worked - and I have a question about it:

-> is this feature is only for use in Cocos2d-JS? Can I use this in Cocos2d-x ?