Cybeaer

Stage/Container Management for lower memory usage

Recommended Posts

Hi there,

first i'm more or less new to JS and Pixi (comming from php), so please be patient if i ask strange questions ;) 

i want to write an relative huge game/app with many locations and animations (spine maybe) and want to realize it in an one page app. To keep the memory usage low i try to write an stage/container management class that only initialize the elements (sprites/animations/dom elements) on demand and dispose them afterwards.

My question is now is there allready an solution for this hidden in pixi? Or does a best practise exist for this? Or does there exist maybe even a tutorial for such a thing?

Like mentioned i tried allready to write an class, but this works only for better management, but not for less memory usage or performance (app.js) And till now only adding (dom)elements and displaying them works (with resize! :) ) but destroying or adding the sprites in the container wont work.

so any suggestions or guiding directions how to solve the many locations issue?

Share this post


Link to post
Share on other sites

textures in meaning of sprite/sheets? Then i maybe just need to read myself into preloading and such a loading bar/percentage display..

then the only issue is to handle all these "sets" of stages/locations. I had an test scenery with only 4 different stages and the source was way to confusing keeping all these inside my class.

And with the "class" i wrote i cant add sprites to the containers and/or hiding them. Is there some kind of library/package with which i can handle this a bit more tidy?

i put myself on a limitation of max 500lines of code (+/-10%) per class

Share this post


Link to post
Share on other sites

If you use IDE, i recommend to write on typescript, that'll make easier to maintain the code.

As for structure, there's https://github.com/pixijs/pixi-display/tree/layers that makes layer management much easier.

Memory problems are hard to fight with pixi, there're tools but for each game solution is unique. I need to know how much resources do you have and which type.

Share this post


Link to post
Share on other sites

i hoped i could use es6 (or was it called es2016?) i use several "ide", varied from vim to intellij. depending where i code at the moment ^^

With structure i mean i have aaaaall scenes and all sprites/animations "alive" in the code. It would be nice if i could specify some "scenes" and its content and call/use it when its needed, so i dont have to remember to which scene the dom element or sprite belongs to.

Quote

Memory problems are hard to fight with pixi

you let my hopes shake xD

Share this post


Link to post
Share on other sites
2 hours ago, Cybeaer said:

iWith structure i mean i have aaaaall scenes and all sprites/animations "alive" in the code. It would be nice if i could specify some "scenes" and its content and call/use it when its needed, so i dont have to remember to which scene the dom element or sprite belongs to.

You could for example make a Container for each scene and add all the scene's sprites to its container, then to change scenes add the new scene's container to stage and remove the old scene's from stage. Then for scene transitions you could animate the containers' alpha or position or something before you remove the old scene's container, for example.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.