Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Game freezing on playing animations  (Read 3995 times)

0 Members and 1 Guest are viewing this topic.

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Game freezing on playing animations
« on: April 10, 2006, 07:57:40 PM »

Hello again,

I'm having some annoying problem with my game, and can't find any possible reason for it happening.

I have one room with 5 or 6 characters in it, all of them playing some animations at random time to make them look "more alive" (one picking his glasses, another one drinking from a cup of tea, etc.). The problem is that whenever their animations are played, my game gets a short but noticeable freeze and then goes back to normal.

First I thought the problem might be that I'm using too many characters with two many animations,  so I tried reducing the count to two characters just in case, but it's still happening: whenever one of my second characters "loads" its animation to be played, the game freezes for less than a second, and then runs fine. I've tried on several computers, from a Duron 950 to an Athlon 64 3200+, so I don't think it's a matter of hardware.

It's not a critical problem, I know, but it's still annoying and I haven't seen any of this in any other WME game.

Just in case it's useful, I'm using PNG files for the animation frames, their size being somewhere around 150x200.
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: Game freezing on playing animations
« Reply #1 on: April 10, 2006, 07:59:56 PM »

I think it's the matter of disk access. Are you using sounds bound with it too? In that case you can try
to preload sounds in Scene_init.script (this was my problem).
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Game freezing on playing animations
« Reply #2 on: April 10, 2006, 08:05:14 PM »

No, I don't have any sound for the characters at this moment.

But I hope it doesn't get worse if I eventually use them!  ;D
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game freezing on playing animations
« Reply #3 on: April 10, 2006, 10:25:01 PM »

How many frames do the animations have? Loading very large animations can freeze the game for a brief moment. To avoid this, you'd have to preload the animation frames.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Game freezing on playing animations
« Reply #4 on: April 11, 2006, 09:09:51 AM »

The animations have something around 32 different frames, although I repeat some of them up to 64 in some of them. e.g. a character turning his head (32) and then turning it back (+32).

If I preload the animations, won't it freeze the game in the moment I do it? Or should I do it right before the game is started?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game freezing on playing animations
« Reply #5 on: April 11, 2006, 05:21:31 PM »

Or should I do it right before the game is started?
Yes, that's what I meant. Either preload them when starting the game or when changing the scene (if the characters only "live" in one scene). The loading delay won't be noticeable then.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Game freezing on playing animations
« Reply #6 on: April 13, 2006, 02:57:37 PM »

I was just trying to preload my anims just on starting my game, but haven't found the proper method in the language reference (I found LoadSound to preload the sounds, but no similar for animations).

Could you point me to it  :)?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game freezing on playing animations
« Reply #7 on: April 13, 2006, 05:50:31 PM »

There's no direct way of preloading graphics. The trick is to create a sprite containing all the images you want to preload, attach the sprite to some entity and load that entity. It doesn't need to be visible, but it will hold the graphics in memory. All other animations using the same graphics should load really fast then because they'll reuse the images.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

kelmer

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 20
    • View Profile
Re: Game freezing on playing animations
« Reply #8 on: April 14, 2006, 10:19:29 AM »

Seems to be working fine now (although I coulnd't use the active attribute to make the bogus sprite not visible, so I had to move it off-screen), thanks :D
Logged
 

Page created in 0.031 seconds with 20 queries.