Hello
How are you today, cocos2d-x experts.
I have problem with cocos2d-js PC web game development.
I am using 35MB plist & png texture images for my web game.
But it’s memory usage is about 1GB.
So my web game doesn’t work properly in PC which has 2GB RAM.
load:function () {
this.errResources = []
cc.loader.load(this.resources,
function (result, count, loadedCount, err, value) {
if(err == null){
this.loaded++
var percent = (this.loaded / this.count * 100);
percent = Math.min(percent, 100);
this.progress.setPercent(percent);
}else {
this.errResources.push(value)
}
}.bind(this), function () {
if(this.unloadCount < 5){
if(this.errResources.length > 0){
this.unloadCount++
this.resources = []
for(var i = 0; i < this.errResources.length; i++){
this.resources[i] = this.errResources[i]
}
this.load()
}else if(this.jslist.length == 0){
this.loadPreLoad()
}else {
this.loadJs(this.jslist)
}
}else {
this.loadJs(this.jslist)
return
}
}.bind(this));
return true
},
We are using cc.loader.load() for download assets.
Below is load() function of CCBoot.js
load: function (resources, option, loadCallback) {
var self = this;
var len = arguments.length;
if (len === 0)
throw new Error("arguments error!");
if (len === 3) {
if (typeof option === "function") {
if (typeof loadCallback === "function")
option = {trigger: option, cb: loadCallback};
else
option = {cb: option, cbTarget: loadCallback};
}
} else if (len === 2) {
if (typeof option === "function")
option = {cb: option};
} else if (len === 1) {
option = {};
}
if (!(resources instanceof Array))
resources = [resources];
var asyncPool = new cc.AsyncPool(
resources, cc.CONCURRENCY_HTTP_REQUEST_COUNT,
function (value, index, AsyncPoolCallback, aPool) {
self._loadResIterator(value, index, function (value, err) {
var arr =Array.prototype.slice.call(arguments, 2);
if (option.trigger)
option.trigger.call(option.triggerTarget, arr[0], aPool.size, aPool.finishedSize, err, value); //call trigger
AsyncPoolCallback(err, arr[0]);
}.bind(this, value));
},
option.cb, option.cbTarget);
asyncPool.flow();
return asyncPool;
},
When I download 35MB assets, it will require 1GB memory in browser?
Is it normal in cocos2d-js or do you have any advice?
When I test my web game from Core 2 Duo, RAM:2GB PC, with firefox browser.
It shows below error and game is stuck.
Thank you
Best Regards