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  All

Author Topic: Memory Problem  (Read 10051 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
Memory Problem
« on: June 07, 2012, 09:53:42 PM »

Hi

I got very strange problem. I got 2d adventure game.

Size of my main actor all frames is 53 MB.
wme.exe process memory size is 97 MB without actor but when I load actor by "jack = Game.LoadActor("actors\jack\jack.actor");" wme.exe process growing to 900 MB !!! What is going on?? Because of this I can't load second actor.
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Memory Problem
« Reply #1 on: June 07, 2012, 10:35:01 PM »

I bet you have a recursion and loading your actor over and over and over. :)

Please post the whole relevant script. (is it in base.inc? :))
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: Memory Problem
« Reply #2 on: June 07, 2012, 11:06:16 PM »

No, it's not in any loop

This is my script for button "new game":

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


////////////////////////////////////////////////////////////////////////////////
on "MouseEntry"
{
load_game_h.Active = false;
new_game_h.Active = true;
}

on "LeftClick"
{
//Game.ChangeScene("scenes\intro\intro.scene");
Game.ChangeScene("scenes\loading_screen\loading_screen.scene");
}

So it changes scene to loading_screen.

This is scene_init for loading_screen.scene

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



// load our main actor
Sleep(1500);
jack = Game.LoadActor("actors\jack\jack.actor");
//cyber_jack = Game.LoadActor("actors\cyber_jack\cyber_jack.actor");
//cyber_jack.Active = false;
actor = jack;
Game.MainObject = actor;
Game.InventoryObject = actor;


jack.TakeItem("cyber_deck");
//cyber_jack.TakeItem("cyber_deck2");

bar = Game.LoadWindow("interface\character_bar\char.window");
indyk = bar.GetWidget("indyk");

Game.ChangeScene("scenes\jacks_ship\jacks_ship.scene");


In jacks_ship scene_init there is no any LoadActor command. I'm loading actor only in scene_init of loading_screen.

There is also no LoadActor in base.inc

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

global Scene;
global Keyboard;
global actor;
global jack;
global cyber_jack;
global real_room;
global x,y,actor_facing, attx;
global jack_from;

//loading_screen
global twirl;


//title screen
global new_game_h, new_game, load_game, load_game_h;

//jack's ship
global ship_lights, blackout, offPanel, offPanel_state, floor_hole, engine_wires;
global door_opened, door_closed, outer_light, ship_out;
//door panel
global cable_sp, switch_led_sp, l1, l2, l3, l4, l5, l6;
global sw1, sw2, sw3, sw4, sw5, sw1_0, sw2_0, sw3_0, sw4_0, sw5_0;
global led1, led2, led3, led4, led5, led6;
global switch1, switch2, switch3, switch4, switch5, cable_state, open_ship;

//outside ship


global intro;
global bar;
global indyk;

function indicator(xp)
{
  attx = (308 / 100) * xp + 308;
  indyk.SkipTo(attx,27);
}

Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re:Memory Problem
« Reply #3 on: June 07, 2012, 11:10:45 PM »

can you also post actor's definition and script?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: Memory Problem
« Reply #4 on: June 07, 2012, 11:22:09 PM »

this is jack.actor

Code: [Select]
; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\

ACTOR
{
  NAME = "jack"
  CAPTION=""
  SCALABLE = TRUE
  INTERACTIVE = FALSE
  X = 400
  Y = 460
  SCRIPT="actors\jack\jack.script"

  FONT = "fonts\Sansation_Regular.font"

  ANIMATION
  {
    NAME       = "idle"
   
    LEFT       = "actors\jack\ll\idle.sprite"
    RIGHT      = "actors\jack\rr\idle.sprite"
    UP         = "actors\jack\uu\idle.sprite"
    DOWN       = "actors\jack\dd\idle.sprite"

    UP_LEFT    = "actors\jack\ul\idle.sprite"
    UP_RIGHT   = "actors\jack\ur\idle.sprite"
    DOWN_LEFT  = "actors\jack\dl\idle.sprite"
    DOWN_RIGHT = "actors\jack\dr\idle.sprite"
  } 
 
  ANIMATION
  {
    NAME       = "walk"
   
    LEFT       = "actors\jack\ll\walk.sprite"
    RIGHT      = "actors\jack\rr\walk.sprite"
    UP         = "actors\jack\uu\walk.sprite"
    DOWN       = "actors\jack\dd\walk.sprite"

    UP_LEFT    = "actors\jack\ul\walk.sprite"
    UP_RIGHT   = "actors\jack\ur\walk.sprite"
    DOWN_LEFT  = "actors\jack\dl\walk.sprite"
    DOWN_RIGHT = "actors\jack\dr\walk.sprite"
  }

  ANIMATION
  {
    NAME       = "talk"
   
    LEFT       = "actors\jack\ll\talk.sprite"
    RIGHT      = "actors\jack\rr\talk.sprite"
    UP         = "actors\jack\uu\talk.sprite"
    DOWN       = "actors\jack\dd\talk.sprite"

    UP_LEFT    = "actors\jack\ul\talk.sprite"
    UP_RIGHT   = "actors\jack\ur\talk.sprite"
    DOWN_LEFT  = "actors\jack\dl\talk.sprite"
    DOWN_RIGHT = "actors\jack\dr\talk.sprite"
  }
 
  ANIMATION
  {
    NAME       = "talk_special"
   
    LEFT       = "actors\jack\ll\wakeUp2.sprite"
  }

  ANIMATION
  {
    NAME       = "turnleft"
   
    LEFT       = "actors\jack\ll\turn.sprite"
    RIGHT      = "actors\jack\rr\turn.sprite"
    UP         = "actors\jack\uu\turn.sprite"
    DOWN       = "actors\jack\dd\turn.sprite"

    UP_LEFT    = "actors\jack\ul\turn.sprite"
    UP_RIGHT   = "actors\jack\ur\turn.sprite"
    DOWN_LEFT  = "actors\jack\dl\turn.sprite"
    DOWN_RIGHT = "actors\jack\dr\turn.sprite"
  }
 
  ANIMATION
  {
    NAME       = "turnright"
   
    LEFT       = "actors\jack\ll\turn.sprite"
    RIGHT      = "actors\jack\rr\turn.sprite"
    UP         = "actors\jack\uu\turn.sprite"
    DOWN       = "actors\jack\dd\turn.sprite"

    UP_LEFT    = "actors\jack\ul\turn.sprite"
    UP_RIGHT   = "actors\jack\ur\turn.sprite"
    DOWN_LEFT  = "actors\jack\dl\turn.sprite"
    DOWN_RIGHT = "actors\jack\dr\turn.sprite"
  } 
}

and scirpt is empty

Code: [Select]
#include "scripts\base.inc"
Logged
Shadow Of Nebula fan page:

https://www.facebook.com/shadowofnebula

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re:Memory Problem
« Reply #5 on: June 07, 2012, 11:27:00 PM »

If you copy Molly (default actor from WME demo) to your project and load her instead, do you still get the same behavior?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: Memory Problem
« Reply #6 on: June 07, 2012, 11:33:19 PM »

with molly everything is ok. So what's wrong with my actor?
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: Memory Problem
« Reply #7 on: June 07, 2012, 11:54:20 PM »

I just noticed that when I'm walking with my actor, wme.exe memory size is growing. When my actor doesn't move memory size of wme.exe is the same (not droping, not growing) when I move my actor it is growing again :( Please help my, I'm fighting with the problem all day. I didn't see this strange behaviour earlier.
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: Memory Problem
« Reply #8 on: June 08, 2012, 03:02:48 AM »

frames of my actor are in indexed png but I have tried jpg, bmp with the same result. It looks like my actor generating some kind of memory leak... I don't know.

I'm depressed
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: Memory Problem
« Reply #9 on: June 08, 2012, 06:45:54 AM »

The important thing is the size of the PNG frames (width/height). Then you can do a simple math: each image will take width * height * 4 bytes of memory (possibly more if the image dimensions are not power of two and the video card requires it).
If your images contain lots of empty space, remove it.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Memory Problem
« Reply #10 on: June 08, 2012, 09:09:17 AM »

Oh! the size of main actor's png files is 53MB - not the actual size? Then it can easily lead to 900MB memory usage.

Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Memory Problem
« Reply #11 on: June 08, 2012, 09:46:14 AM »

Just a guess ( we did the same with an animation wondering about the memory usage ): Me made a litte animation, but simply forgot to crop it, so the animation was ... dunno... 100x100 px or so, but the frames all were 1280x720. Doesn't matter if transparent or not, memory usage is the same ;) ;)

Other thing is maybe you simply have too much frames? We have good results using 10 FPS for Characters (for our comic-style), it looks really good.

Our WME Process is always ~250 MB - ~300 MB with all needed stuff loaded.

Greets,

Spellbreaker
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Memory Problem
« Reply #12 on: June 08, 2012, 09:56:30 AM »

Also it's healthy to split certain stuff into several actors to reduce frames and load them on demand. Not all animations needed to be in one file and always loaded in the memory.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

hubertMichael

  • Regular poster
  • ***
  • Karma: 3
  • Offline Offline
  • Posts: 155
    • View Profile
    • Shadow Of Nebula - our point'n click adventure game
Re: Memory Problem
« Reply #13 on: June 08, 2012, 02:46:08 PM »

there is no difference if my frames are power of two or not. I have cropped frames and it didn't helped. After I cropped my process of wme.exe wasn't 900 MB but 300 Mb and it was growing again. Five minutes of playing and it was almost 400 MB and still growing. Thank you guys for your tips but still I got my problem. There is some leak and I don't know where.
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: Memory Problem
« Reply #14 on: June 08, 2012, 02:51:06 PM »

So... will you tell us how big are the images and how many are there?
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  All
 

Page created in 0.047 seconds with 24 queries.