arnuschky Posted November 24, 2013 Share Posted November 24, 2013 Hello, does Pixi.JS support dynamic asset loading, that is, can I load and unload sprite atlases between scenes? This is rather essential on mobile platforms due to their limited memory. Unfortunately, very few engines seem to support this. Regards,Arnuschky Quote Link to comment Share on other sites More sharing options...
rich Posted November 24, 2013 Share Posted November 24, 2013 You can destroy resources yes, but it's up to the browser when they are eventually garbage collected. There's certainly no way to force something to be unloaded at a specific time, more just a "please delete this when you can". This is the reason no engines that run in a browser actually truly support it. Quote Link to comment Share on other sites More sharing options...
arnuschky Posted November 24, 2013 Author Share Posted November 24, 2013 You can destroy resources yes, but it's up to the browser when they are eventually garbage collected. There's certainly no way to force something to be unloaded at a specific time, more just a "please delete this when you can". This is the reason no engines that run in a browser actually truly support it. There's a call on CocoonJS to control this now (for images only, I think, just call img.dispose()). The question is: does the architecture of Pixi support dynamic unloading of textures? For instance, can I load a spritemap for each level, and each time I switch level I unload the old and one load the new one? Does that work properly with the WebGL texture maps? Quote Link to comment Share on other sites More sharing options...
rich Posted November 24, 2013 Share Posted November 24, 2013 There's no concept of levels at all in Pixi, so you'll have to build that part yourself anyway, so when you do that you can easily add in the destruction of old assets and the loading of new ones, yes. You could also add in the Cocoon hooks at the same time. Quote Link to comment Share on other sites More sharing options...
arnuschky Posted November 24, 2013 Author Share Posted November 24, 2013 Could such a solution be easily integrated with Phaser? Quote Link to comment Share on other sites More sharing options...
xerver Posted November 24, 2013 Share Posted November 24, 2013 Just make sure to destroy your textures when you are done with them. `texture.destroy(true)` will remove it from WebGL memory. Cleaning up the javascript objects can be done the same way you remove resources in javascript anywhere else, null out your references and let the GC clean up later. Quote Link to comment Share on other sites More sharing options...
arnuschky Posted November 24, 2013 Author Share Posted November 24, 2013 Is there a Pixi or Phaser game out there that runs on CocoonJS? I tried to get Run Pixie Run to work on CocoonJS for testing, but as it relies on jQuery that was a no-go (jQuery does not work on CocoonJS) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.