Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: InCreator on Mon 27/12/2004 23:43:29

Title: Game lags when playing sound
Post by: InCreator on Mon 27/12/2004 23:43:29
Well, problem lies in sounds. Sounds lag!
Like if character has footstep sounds added to his walking animation, game stops for about 1/4 second to play each sound.

I know it's not related to AGS version, different games compiled with different versions do this.
Now, I know that this isn't mainly AGS problem, but should be connected to my computer somehow.Ã,  It's just strange because it didn't exist before.

Now, as far as I remember, the major changes I made - and so which could be "guilty" in this are:

* Switched from DirectX 9.0b to 9.0c
* Replaced Geforce 440MMX 64M card with GeForce 5700LE 128MB

All other things are like they were before problem, for any case I list my hardware setup:

* 1,8Ghz Athlon XP 2200+
* 256MB RAM
* C-Media AC-97 compatible onboard audio
* the video card & DirectX I named before
* Windows XP professional

So system requirements can't be too low for DX9.0c.
I personally suspect DirectX. New version incompatible with soundcard maybe? Or AGS with DX? But other games (non-AGS) play sound normally...

Does anyone have any ideas or suggestions about this?

Title: Re: Strange problem with AGS games
Post by: strazer on Tue 28/12/2004 00:08:29
Haven't you installed SP2 recently? Was this before or after the problems started?
Title: Re: Strange problem with AGS games
Post by: InCreator on Tue 28/12/2004 00:17:47
No sp2 problem here. Problem existed few days before that.
After all, I can't imagine SP2 affecting AGS any way.
Title: Re: Strange problem with AGS games
Post by: strazer on Tue 28/12/2004 00:24:10
Have you tried playing around with the game setups? Audio output and the like?
Also, try closing programs in the background, virus scanners and the like, just to be sure.

Just trying to rule a few things out before CJ gets here. ;)
Title: Re: Strange problem with AGS games
Post by: Proskrito on Tue 28/12/2004 19:54:18
this might be the same problem as the one in this thread:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=16356.0
Title: Re: Strange problem with AGS games
Post by: InCreator on Wed 29/12/2004 16:01:50
About this footstep lag...

- it won't be better if game is windowed
- it won't disappear is swithing between "default directx sound device" and "default wave output"
- it WILL disappear if "no sound" is set from setup
- it is not affected by DirectSound acceleration. I tried all levels, from "no acceleration" to "full acceleration", also testing both DX sound device and default waveout device. Lag was there.

This is quite weird.
Why only AGS? With WAV sounds?

Other games use wave format too. And many have sounds packed into resource file too. They don't lag!
Title: Re: Strange problem with AGS games
Post by: strazer on Wed 29/12/2004 16:13:57
Actually sound effects are packed into the exe file.

Thanks for providing such a detailed analysis.
Does it only happen to wave format files?
Title: Re: Strange problem with AGS games
Post by: Pumaman on Sun 02/01/2005 15:42:08
Does it seem to lag and wait for the sound to finish playing, or is it a 1/4 second lag before the sound actually starts playing?
Title: Re: Strange problem with AGS games
Post by: InCreator on Tue 04/01/2005 00:46:18
I'll call frames with assigned sound as a "sound frames"...

Character reaches sound frame, lags, then both sound plays and animation continues. So next frame is drawn along with sound. It's quite short moment, very hard to measure. But I'd say that lag is even longer than 1/4th a second. maybe half a second or a bit more.
Anyway, enough to ruin a walk.

I tried with 22Khz and even 11Khz (both 8 and 16-bit) wav's, lag still stays. PCM signed 8-bit stereo was exactly like 44KHz/16-bit. No change there.

I also tried to

- changing between anti-glide/not AG
...without antiglide, character moves very fast even with walkspeed 3, anim speed 6, delay 0 for each frame (in view editor) and AGS won't play footstep in each loop somehow. Though it should!
-  changing between not/uniform walkspeed - no change there

:(


Title: Re: Strange problem with AGS games
Post by: Pumaman on Tue 04/01/2005 18:13:16
Well, before playing the sound AGS has to load it into memory, so it's possible that if you had a very slow hard disk or were playing the game over a network, you might notice a slight pause ... but it sounds like your computer is quite modern so that shouldn't be an issue.

I'm not really sure what to make of this ... has anyone else experienced a similar problem?
Title: Re: Strange problem with AGS games (Solved!)
Post by: InCreator on Wed 05/01/2005 00:32:45
Well, I finally found the source of the problem, though I'm still helpless with the games made by other people, such as Apprentice 2, etc.

The sound itsself. I tried to assign different sound to footsteps and some did not lag at all.
Yet, some others do and they are same length and format/quality.

It's just paranormal.
But at least I can continue work on my game.

Title: Re: Strange problem with AGS games
Post by: Pumaman on Wed 05/01/2005 20:13:55
Strange ... what file format are you using for the sounds? WAV, MP3 or OGG? Does trying one of the others make any difference?