Jump to content

New to GameDev - Problems with Audio/Visual in Firefox


kinome79
 Share

Recommended Posts

Getting into game dev, wrote a snake game, and now a breakout game, all with just raw JS, CSS, HTML. The breakout game is the first where I'm implementing sound, and dev'd the game with Chrome just fine, but found some issues when I opened it in Firefox for the first time, wondering if anyone might know why.

1) Firefox doesn't support roundRect, which I found stupid, but even just re-implementing with rect I noticed typically it runs slower even though setInterval shouldn't be different between Chrome and Firefox.... does Firefox typically run slower?  Might just be my computer.

 

2) I made simple sound effects with .mp3 format. Worked nice in Chrome(still working on setting up something to prevent initial delay) but for some reason in Firefox, there is a static pop at the start of each sound... each wall bounce, paddle hit, block break, each first has this static noise POP at the start which doesn't occur in Chrome? Thoughts?

Note, for each sound I just run

new Audio(mysoundfile).play() 

when I want the sound to play.

Below is the link to SNAKE and BREAKOUT... will later add sound to SNAKE, and BREAKOUT still needs some tweeking, but curoius what people thing about the above two issues. Do other people hear that static pop when using in Firefox but not Chrome. I haven't tested with another computer yet.

 

Thanks,

 

https://www.gojta.com/snake

https://www.gojta.com/breakout

 

Link to comment
Share on other sites

  • 1 month later...

Hi, @kinome79!
1) I'm not sure if the firefox runs slower with your round-rect implementation than chrome, but what I can advise is that you shouldn't use setInterval. Instead, you should use RAF (requestAnimationFrame) and delta time. Read about it there:
https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
https://gameprogrammingpatterns.com/game-loop.html
In this way you'll be able to make your game look approximately the same on all devices and browsers.
2) It may be connected to .mp3 format. You can try using .ogg instead.
Hope this helps!

Edited by Yurii Bilas
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...