Memory usage question.

0 favourites
  • 8 posts
From the Asset Store
Memory game, with 10 levels for you to have fun. Made in Construct3, template available for purchase.
  • I read the memory usage part in the manual and I think I get it, but still ain't sure of what the answer is in the following scenario.

    If I have objects that have a var attached to them, for every instance,...is seen (which by default is 0 but becomes 1 when the player's FoV sees it), for example, and they are not Globally persistent or anything, when I leave the layout they get destroyed right. When I come back they are loaded anew with the modified Is Seen var. (if I've seen them or not). My question is, is this bad memory usage? Like, real bad. Where does this modification of the var live? Is it truly unloaded when leaving the layout and the loaded back again when returning?

    Cheers!

  • "My question is, is this bad memory usage? Like, real bad. Where does this modification of the var live? Is it truly unloaded when leaving the layout and the loaded back again when returning?"

    No it's not bad memory usage, it's normal. When you leave a layout all instances are forgotten, and when you start a layout all instances will appear as they would on the start of the layout. Again, this is normal.

  • Perfectly normal. That's why it's called RANDOM access Memory.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey, thanks. That's what I thought, but still I don't get one thing. My example is that a layout loads with one default value of of a variable which a lot of objects have - I then change that value by seeing it with my FOV (read I explore a map which is hidden in uncharted territory by default), I then change the layout, load a new one, and then I return to the former and I still see all the parts of the map which I have seen in my previous exploration (every object I see changes its IsSeen instance variable frmo 0 to 1, and then, on layout start all that are seen are set to visible, all that are not are set to invisible)...this means that the vars i;ve altered during the course of my game are remembered somewhere despite changing layouts. Where is this somewhere? Is it a temp file someplace, it remains in the memory?

  • Global variables are ... well .. global.

  • Tis why im talking about instance variables, not global...the sprites have variables, they have a default value, which was then altered and remained altered after leaving the room and coming back. The sprites are made to persist globally (aka not be terminated when the layout is changed.)

  • You can make a sprite global, you can give a sprite the Persist behavior.

    You can also make a layer global.

    Global sprites (and theire instance variables) or sprites on a global layer stay in memory when swapping layouts.

    Not sure how the Persist behavior actual works, memory wise. I guess that they stay in memory.

    All 3 are really nice features. Got to look em up in the manual, when you plan to change layouts, or take objects from one layout to another (like HUDS).

    Memory used by the variables is negligible though, compared to the memory use by the graphics. So, if you have to worry, worry about the amount of sprites (and theire animations) used (independed from if they are global are not). Althaugh, you can have a lot of sprites on screen, as long as you dont try to give them all a personal movement system.

  • Cool cool, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)