Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Pages: [1] 2 3  All

Author Topic: unload scene  (Read 15655 times)

0 Members and 1 Guest are viewing this topic.

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
unload scene
« on: May 28, 2013, 10:06:04 PM »

Hi

How can I completly unload scene from memory? I'm asking because every time when I'm changing scene to another by (Game.ChangeScene) I got feeling that my game starts to take more and more memory. I've checked every script, actors, everything and I don't know what's going on. The only possibility which comes to my mind is that WME does not release the memory completely from previous scene and something is collecting. That would explain why game starts to take more and more memory. Therefore I want to completly unload current scene from memory before I will use Game.ChangeScene. How can I do this?
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unload scene
« Reply #1 on: May 29, 2013, 06:55:33 AM »

WME does unload the old scene. You'd run out of memory pretty fast if it didn't.
If you feel some stuff is staying it memory, the tips from your other thread still apply (namely the DumpTextureStats() method).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #2 on: May 29, 2013, 09:08:08 AM »

I did DumpTextureStats() method and I didn't find anything suspicious. Maybe I didn't notice something. I'll do it once again today just for double check and I'll share with results here.
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

2.0

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 217
    • View Profile
Re: unload scene
« Reply #3 on: May 29, 2013, 01:13:13 PM »

In general, it is easy to check whether the memory leaks exactly in WME or not - you need to run one of the many games based on the WME to check its behavior. I think if the problem in memory leak in the engine existed, it would have been a well known (at worst).
The issue, I think, still in the scripts. But without seeing the sources, is hard to figure out what was wrong.
Logged

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #4 on: May 29, 2013, 11:07:25 PM »

Ok, I did few tests and I got really strange results.

- I did empty scene only with my actors. But there is no any other graphics. I got access to this scene using TAB key and in scene init there is dumptextures method. WME process takes 383 MB and this is normal because I got 3 actors with lots of frames. Dump textures file didn't show any anomalies
- after 5 min of palying I got to my test scene. WME process takes 512 MB (there is lot of animations)
- I did save game for this moment and hit TAB key to jump to my empty scene
- WME process dropped to 480 MB (should be ~ 383 MB like I said in the begining) Dump textures file didn't show any anomalies
- I turned off my game and turn on again
- I've loaded my save game. WME process takes now 464 MB (not 512 MB as in the moment when I was saving)
- I hit TAB key to jump to my empty scene and now WME process takes ~383 as in the begining

Soo... there is something wrong. Where should I look? It's not textures because now I'm sure but something strange is happening

Here is one of my actors script. Maybe I'm doing something wrong here. It's about footstep sound.

Code: [Select]
#include "scripts\base.inc"

on "footstep"
{
var rsteps;
var Reg = Scene.GetRegionAt(this.X, this.Y);

var steps;

if(Reg.fNature == "metal")
{
steps[0] = "sounds\fx_footsteps\metal\footstepMetal1.ogg";
steps[1] = "sounds\fx_footsteps\metal\footstepMetal2.ogg";
steps[2] = "sounds\fx_footsteps\metal\footstepMetal3.ogg";
steps[3] = "sounds\fx_footsteps\metal\footstepMetal4.ogg";
steps[4] = "sounds\fx_footsteps\metal\footstepMetal5.ogg";
steps[5] = "sounds\fx_footsteps\metal\footstepMetal6.ogg";
steps[6] = "sounds\fx_footsteps\metal\footstepMetal7.ogg";
rsteps = Random(0, 6);
}
if(Reg.fNature == "concrete")
{
steps[0] = "sounds\fx_footsteps\concrete\concrete1.ogg";
steps[1] = "sounds\fx_footsteps\concrete\concrete2.ogg";
steps[2] = "sounds\fx_footsteps\concrete\concrete3.ogg";
steps[3] = "sounds\fx_footsteps\concrete\concrete4.ogg";
steps[4] = "sounds\fx_footsteps\concrete\concrete5.ogg";
rsteps = Random(0, 4);
}
if(Reg.fNature == "concrete_inside")
{
steps[0] = "sounds\fx_footsteps\concrete_indoor\concrete_indoor1.wav";
steps[1] = "sounds\fx_footsteps\concrete_indoor\concrete_indoor2.wav";
steps[2] = "sounds\fx_footsteps\concrete_indoor\concrete_indoor3.wav";
steps[3] = "sounds\fx_footsteps\concrete_indoor\concrete_indoor4.wav";
steps[4] = "sounds\fx_footsteps\concrete_indoor\concrete_indoor5.wav";
rsteps = Random(0, 4);
}



this.PlaySound(steps[rsteps]);
}

I've turned off my actors footsteps and problem still exist. Any tips would be very helpful

It's look like something is collecting in memory during gameplay but it disappear after game load. It's not textures, it's not actors footsteps (because I'v turned this off). So this must be some garbage data in memory which is not included to save game file.
« Last Edit: May 30, 2013, 01:31:12 AM by hubertMichael »
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

donamin

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 27
    • View Profile
Re: unload scene
« Reply #5 on: May 30, 2013, 02:52:00 PM »

i'm having this problem too.
it seems that scenes are not unloaded completely.
i'm trying to implement a pause menu. i implemented my menu using a new scene. i use changescene to pause menu when esc is pressed. every things works fine, but when i press "new game" button in pause menu which loads that scene  using changescene again, some elements of scene are missing!
Logged

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #6 on: May 30, 2013, 03:39:24 PM »

donamin: I think that in your case it's completly different problem. From what you're saying you did something wrong with some variables. Maybe they need to be reseted to it's default values or something like this. I'm sorry but I suggest you to make a new topic about your problem and show us your scripts. I'm sure by then we will be able to help you.

Alright, I did another test on different scenes. Problem still exist. Dump texture method didn't help me. In csv file everything is alright. So...
I got three scenes:
A - there nothing but my two actors. There is any entity.
B - there is only my main actor. There is any entity.
C - there is only my actor and really really big spirtes. There is any entity.

Im going in circle through this scenes in this order A -> B -> C ->  A -> B -> C -> A -> B -> C -> A -> B -> C
WME process takes memory like this:
1   A = 380 MB
2   B = 450 MB
3   C = 594 MB
4   A = 390 MB
5   B = 429 MB
6   C = 640 MB
7   A = 440 MB
8   B = 482 MB
9   C = 675 MB
10 A = 505 MB
11 B = 530 MB
12 C = 715 MB

I did absolutely nothing in these scenes. I was just walking. It looks like a memory leak for me because right now I don't have any idea what's wrong. Dump texture is alright. In base.inc I don't have any stuff like Game.LoadWindow or similar user failures. What I was telling in the posts above, after game load memory is going back to normal usage. So... what else?
« Last Edit: May 30, 2013, 03:41:11 PM by hubertMichael »
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unload scene
« Reply #7 on: May 30, 2013, 03:57:40 PM »

When you're performing these tests, is the debug console on, by any chance?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #8 on: May 30, 2013, 04:05:28 PM »

Yes, I got always debug console on.

I've checked sprites if keep loaded in memory is turn off. It is turned off. Now before Game.Changescene I've used Scene.UnloadObject for all sprites in scene. No results, problem still exist.
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unload scene
« Reply #9 on: May 30, 2013, 04:10:09 PM »

The debug console is using Microsoft .NET framework, which uses garbage collector. That means it keeps the memory allocated (as long as there's enough memory available) and only releases it from time to time or when more memory is needed. That would explain your memory usage fluctuations.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #10 on: May 30, 2013, 04:13:47 PM »

So if I will disable debug console everything should back to normal? I'll check it right now.
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #11 on: May 30, 2013, 04:20:51 PM »

I've disabled debug console and unfortunately problem still exist. Ofcourse WME process takes less memory but it's usage is still growing. Not so fast as with debug console but it's growing slowly.
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unload scene
« Reply #12 on: May 30, 2013, 04:35:03 PM »

How slowly? Some growth is expected, because if the "remember node state" option is enabled in scenes, the node states are stored in memory permanently.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: unload scene
« Reply #13 on: May 30, 2013, 05:07:17 PM »

It's not slowly. It's just a smaller numbers. I've turned off remember nodes states and including sprites in my test scenes A, B, C. I was walking through them like before A -> B -> C -> A ...

1  A = 353 MB
2  B = 407 MB
3  C = 580 MB
4  A = 367 MB
5  B = 412 MB
6  C = 628 MB
7  A = 419 MB
8  B = 466 MB
9  C = 662 MB
10 A = 450 MB
11 B = 506 MB
12 C = 696 MB

Debug conlsole is set to "never",  debug mode is set to "no", show FPS is set to "no". My game is 2D, use direct3d 9 is set to "no".
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: unload scene
« Reply #14 on: May 30, 2013, 05:50:32 PM »

No idea then. If you want to dig really deep, there's this diagnostic command: Game.DEBUG_DumpClassRegistry(); It will create a file called "zz_class_reg_dump.log" in the game directory. It contains a list of all internal objects WME is currently allocating. You can try calling this before and after and compare the two logs to see which of the values are growing significantly.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
Pages: [1] 2 3  All
 

Page created in 0.021 seconds with 21 queries.