Jump to content

Announcing our new website

To find out the latest about our new website, visit Game Dev Unlimited

- - - - -

se_play causing frame skips


  • You cannot reply to this topic
7 replies to this topic

#1 WoohaDude

    Newbie

  • Member
  • 7 posts

Posted 09 October 2011 - 04:56 PM

My question's fairly simple. I'm using a script that lets you play a sound on each "footstep." Very very simple script, but I get a slight delay or skip every time a SE is played. I'm assuming this is a RPG Maker issue, and that there's nothing you can do about it.

On a related note, anybody know what's up with windows 7 and playing midi files? I get like a 10 second delay while it's .. buffered? Fairly annoying. Good thing I'm mixing all the midi files I'm using into symphonic orchestra mp3 versions xD.


Edit: Got it figured out. Needed to be playing .wav instead of .mp3. Not sure why, but frame delay is now completely gone.

Edited by WoohaDude, 14 October 2011 - 12:29 AM.


#2 Kiriashi

    Activity Whore

  • RMXPU Legend
  • PipPipPipPipPipPipPipPipPipPip
  • 4,486 posts

Posted 09 October 2011 - 10:27 PM

Well when you have a question with a script, it's always a good idea to post it.

Use the following tags:

[spoiler][code]
Insert script here
[/ code][/spoiler]

As for the footsteps problem, Kevin.ds has a nice system setup in his game, so see if you can get him to tell you how he did it. I'll direct him to this topic if I see him online. :3

#3 Kevin.ds

    Pervert

  • Member
  • 227 posts

Posted 09 October 2011 - 11:39 PM

I evented my step sound thingie by making use of terrain tags , if you would like to know how let me know.

Edited by Kevin.ds, 09 October 2011 - 11:40 PM.


#4 WoohaDude

    Newbie

  • Member
  • 7 posts

Posted 10 October 2011 - 01:14 AM

Hey guys. Alright, I'll post the script. It's def the Audio.se_play that's causing the frame skip .. and it is fairly minor, but I can foresee the slight delay giving me a headache after a while lol. Also, having NPCs also make sounds is def going to add lag. I just added it, for now, to see "how" much lag it'd make.

Spoiler

It basically just seems like the Audio.se_play is calling a check for the file every time it's called, and the slight delay is just engine seeking the file, then playing it. If you could buffer sounds, and then have them stay in ram or something, that'd fix it. But uh ... lol. Don't think RPG Maker can do that :(

#5 kellessdee

    mrrow ~!

  • Moderator
  • 902 posts

Posted 10 October 2011 - 01:35 AM

I agree with kiri, post the script. There should not be a delay with a sound effect--consider that every time you move the cursor or confirm it calls se_play with no delay, which is essentially the same as "footstep" sound effects.

EDIT: oops, looks like you posted while I was posting, checking script out now

#6 WoohaDude

    Newbie

  • Member
  • 7 posts

Posted 10 October 2011 - 01:38 AM

Just did :). Also, one thing I just thought of, is that it may be due to me having put the game's FPS to 60, instead of default. The skip maybe would be less noticeable on lower framerates.

#7 kellessdee

    mrrow ~!

  • Moderator
  • 902 posts

Posted 10 October 2011 - 02:07 AM

View PostWoohaDude, on 10 October 2011 - 01:38 AM, said:

Just did :). Also, one thing I just thought of, is that it may be due to me having put the game's FPS to 60, instead of default. The skip maybe would be less noticeable on lower framerates.

lol yea, you were too quick for me ;)

Anyways, I tried out the script... well first off it kept giving me a bunch of errors :( was there any other parts of this script?

I had to change:
if $game_player.moved?
  @tsswait -= $game_player.move_speed != $game_player.dash ? 1 : 1.5
in Scene_Map#update
to
if $game_player.moving?
@tsswait -= 1
I am assuming the dash part was added for a dashing system, and move_speed in a new project is not a public instance variable (which I assume is part of the running/dashing system).
also, Game_Player#moved? does not exist in a new project--but #moving? does...so I just switched it up

also,
Tilesets[1] = []
Tilesets[1][0] = "Sound"
Tilesets[1][1] = ["sound", 75, 50]
Gave me an error, so I just commented those lines out because I am pretty sure that's just for specifying different sound files for specific tilesets...

anyways, with those changes I got the script to work ( I used the system sounds "001-System01", "002-System02", "003-System03", "004-System04" ) and I did not experience lag...and the frame rate should not make a difference.
(I tried with both 60 fps and 40/20 fps(whatever the default is xD))

So I dunno, maybe there is an issue with your sound card/drivers? You also said midi files have a long delay for you? I have windows 7 and it does not give me a delay when playing midi files...

OR perhaps another script you are using is causing the lag? Try using the script in a fresh project and see what happens. If you still get lag (and you feel comfortable about sending me your project) you can send your project and I can test it to see if it causes lag on my pc. (or you could even try it yourself on another pc) If it doesn't cause lag on another system, then it must have something to do with your computer...

hmmmmmmm....

#8 WoohaDude

    Newbie

  • Member
  • 7 posts

Posted 10 October 2011 - 02:44 AM

It's most likely either my sound card and/or sound drivers, and the .. fairly high quantity of scripts I have in my project. I think the best way to test that is to just send you my project. I'll PM you the link.





0 user(s) are reading this topic

members, guests, anonymous users