Jump to content

Common Phaser + CocoonJS issues


Videlais
 Share

Recommended Posts

@the music jumps problem:  

 

 so after an hour of testing i could pinpoint the problem:   

 

cocoonjs doubles the first 200ms of  EVERY sound.. no matter what.. AND cuts of the last 200ms of the audio file

 

 

 

 

i just didn't hear it because there is silence on every other audio file i own on the beginning for at least 500ms..

 

this is definitely a bug IMHO..  the solution is to add 200ms silence

 

i tried everything.. mono tracks, different sample rate, extreeeem high compression/no compression

i even played my music reverse ^^  adding 200ms of silence does the trick but breaks every loop :(

Link to comment
Share on other sites

Hi there, I´ve searching but I don´t find anything about this... I´ve a weird problem.

 

I have a game, working perfectly on my website. If I try this game with the cocoonJS launcher I get this results (cocoonJS launcher 2.1.1 and Phaser 2.1.3)

Tablet (Nexus 7)

  • Webview+ the game works perfectly.
  • Canvas+ the game is not working at all. Black screen and sometimes blinking, I can see some white pixels but they dissapear really fast. Also, I have red X top left, with the fps but if I check the console, no errors, messages or warnings.
  • EDIT -> webgl disabled, no black screen, rendered perfectly (buttons still not working).

Phone (Galaxy Nexus)

  • Webview+ the game works, a little bit slow but it works.
  • Canvas+ the game is rendered but the play button is not working at all so I can´t start.

 

I suposse nothing wrong here, but this is the code for the button:

FS.playButton = this.game.add.sprite(225, -335, "playIcon");FS.playButton.anchor.setTo(0.5,0.5);FS.playButton.inputEnabled = true;FS.playButton.events.onInputDown.add(this.gotoPlay, this);

Can anyone help me with this? Why isn´t working with canvas+? I have no errors...

 

Thanks in advance.

Link to comment
Share on other sites

Hello, 

 

 

cocoonjs doubles the first 200ms of  EVERY sound.. no matter what.. AND cuts of the last 200ms of the audio file

 

 

i just didn't hear it because there is silence on every other audio file i own on the beginning for at least 500ms..

 

this is definitely a bug IMHO..  the solution is to add 200ms silence

 

i tried everything.. mono tracks, different sample rate, extreeeem high compression/no compression

i even played my music reverse ^^  adding 200ms of silence does the trick but breaks every loop :(

 

Thanks a lot for your effort finding out the root of the bug, and sorry for the late response. We will have a look at it.

 

sorry for this "false" alarm concerning the black screen..  the "webgl" option was still turned on in the cloud compiler settings..    i can NOT use webgl otherwise the screen will be black but with webgl turned off canvas+ works quite well..  same thing in the launcher.. no errors in console..  phaser says it uses webgl..  but everything is black..  providing a testcase is very dififcult at the moment..  but when i find some time i'll provide one :)

 

We will have a look at it anyway. It should work fine even using WebGL. 

 

 

i tested ads (admob) and they work very well in the cocoonjs launcher (from the store) with canvas+  - the exact same app doesn't show any ads when being compiled.. but think i added my adunit id's correctly in the ad settings  (why else should they show up in the launcher ?  

 

We are not aware about any problem regarding ads. In fact, our demo works fine after compilation. Could you please tell us which ad networks you are using? It might be that there is trouble using a specific one and we didn't noticed when testing. 

 

 

Can anyone help me with this? Why isn´t working with canvas+? I have no errors...

 

Canvas+ is for canvas based projects and focused in the performance. It is really fast, but it has limitations. If it works as it should in Webview+, it can be a DOM access problem, as DOM access is limited in Canvas+. 

 

Regards. 

Link to comment
Share on other sites

@ludei:  the ogg file is added as attachment..  as i said.. the format doesn't matter.. wav has the same problem.. also i tried different ways of saving the file (mono, 22khz, 16bit, and so on)

 

also the phaser way of starting the sound doesn't matter..  

 

 

ad. ads)  the mopub website is very annoying when it comes to the userinterface..  many parts of the ui just don't show when you are using an adblocker..    oh the irony..     so i "suddenly" found new configuration options for my admob network and then after some time ads started to show up..   i just was confused because it worked in the launcher anyways.. this still doesn't make sense to me

 

 

thx for your answers !

 

 

one new question:  is it possible to get rid of the android bottom bar (hide it like the top status bar) - intel crosswalk does this and it's really nice to make use of the whole screenestate..   goFullscreen sais something about an error with the fullscreen api

froglegsrag1.ogg.zip

Link to comment
Share on other sites

Hi there, another problem/question with Phaser and cocoonJS,

I have a game running perfectly in firefox/chrome and android (with the launcher and as apk), I compiled it with Phaser 2.1.3 and cocoonJS 2.1.1 and the problem is that is not working in iOS.

 

The problem is this, it seems that a xml is not loading properly, this is the code

xmlPath = "xml/zapas_categoria_4.xml";$.ajax({    url: xmlPath,    dataType: "xml",    success: function(xml){        scope.xmlData = xml;        scope.scopeGlobal.launchGame(scope);    },    error: function(error) {        console.log(error);        alert("An error occurred while processing XML file. Reload the game, please.");    }})

It´s seems that it´s loading the xml, at least the error callback is not launching the alert, BUT, it´s not calling the launchGame function...

 

I´m trying to debug it with Xcode but it´s the first time that I use it and I don´t see any kind of alert with the problem, is this a common issue with cocoon? It´s working perfectly with Android...

Link to comment
Share on other sites

@Oliganti I spend all day yesterday grappling with that and don't have a fix.

 

Since the last version of my game (working fullscreen) I've updated cocoon launcher, phaser version, and android version so the bug could be anywhere in there :S

 

It's frustrating because every single one of my other issues with cocoon is fixed!

 

Edit: This is my setup code:

  var width = window.innerWidth    , height = window.innerHeight  var game = new Phaser.Game(width, height, Phaser.CANVAS, '')

I've tried using devicePixelRatio and other hacks from this thread, as well as various scaling and webGL options in the cocoon launcher...

 

It can be replicated by:

 

1. running the cocoon launcher

2. looks like this http://imgur.com/YhYw371

3. press the back button on android

4. confirmation popup appears, choose cancel

5. returns to game in fullscreen

Link to comment
Share on other sites

Hello, 

 

Sorry for the late response. 

 

@valueerror, I am sorry but I need to ask you the complete test case. We have been trying to reproduce your audio issue all this time and we still didn't have any success. 

 

@totallybueno , I need to ask you a complete test case too, I am sorry. I tried all the ones I had available and all of them worked perfectly on my tests. Unfortunately, they were quite simple, so it must be something related to your specific project. 

 

Regarding the Ajax call, are you using the Webview+? 

 

@patmood , I recommend you to test your project using the cloud compiler. If the issue persists, please, let us know. If you provide us a test case to reproduce the issue, we will have a look at it to see what can be the root of the problem and we will try to fix it. 

Regards. 

Link to comment
Share on other sites

Hi  @ludei, yes I´m, I´m using Webview+ because I´m using the DOM and I don´t need too much CPU, so Webview+ is my best option here.

 

The weird thing for me is that the same project is working perfectly in browsers, cocoonJS launcher and as an apk, but not on iOS, that´s what is driving me crazy.

 

So, do you want me to sendo you my project, I don´t know if you mean that...

 

 

Also, thanks for the answer.

Link to comment
Share on other sites

Hello, 

 

Hi  @ludei, yes I´m, I´m using Webview+ because I´m using the DOM and I don´t need too much CPU, so Webview+ is my best option here.

 

The weird thing for me is that the same project is working perfectly in browsers, cocoonJS launcher and as an apk, but not on iOS, that´s what is driving me crazy.

 

So, do you want me to sendo you my project, I don´t know if you mean that...

 

 

Yes, well, it is not required to send us your full game. We won't ask you that. It is enough if the project you send us is enough to reproduce the issue. 

If possible, better if you open a topic in our Community (http://support.ludei.com/hc/communities/public/topics) because we are not constantly at this forum and it will be easier for us to follow the issue. 

In addition, I recommend you to compile again your project, because some users suffering this blank screen problem in other frameworks confirmed us this morning that the problem were solved for them. The problem was regarding iOS and the Webview+ and only in very specific circumstances, so it might be related. 

 

Regards. 

Link to comment
Share on other sites

@LUDEI :

 

i attached a working example of my completely stripped down game including 2 audiofiles..  it will start just one state that does nothing but play the music in a loop..  you will hear the music jump on the beginning and on every loop (the first 4 times are in the audio file so the error will occur on every 5th replay of the melody - that's where the the audio file is looping and the last 200ms are cut off and the first 200ms are played twice.. .every time)

 

i even created an apk file out of this example to test on my tablet to find out if the loop error will be there in this stripped down version...  answer:  yes ! it's there...

 

thx in advance!

test.zip

Link to comment
Share on other sites

Hello, 

 

@valueerror, I've been looking at this problem, and it's not gonna be an easy one to solve. It is definitely a bug on our side, but it's a high-level one, regarding how the pause, stop and play operations should behave. This, combined with how OpenAL handles buffering (already committed chunks of audio cannot be stopped from our side) means we have big trouble handling calls to pause and play in rapid succession.

 

In this case, we have 2 audio buffers of 100ms each which as I said we cannot manually stop once committed to OpenAL, so when you call pause it will take 100-200ms for the sound to actually stop playing.

 

However, if you call play right after that, the audio will start playing immediately from the next point in the audio file, which is 200ms in the future, as those next 200ms will be in-flight inside OpenAL at this point. This creates the effect you're experiencing where you miss 200ms of audio, as Phaser does a pause/play combination in the same frame to handle audio looping (probably to support audio sprites).

 

This would unfortunately be quite difficult for us to solve without re-writing half of our audio system, as it affects other parts of how it is structured.

 

To fix this issue in Phaser, I'd recommend finding a way to avoid doing pause+play to do the looping, and instead rely on the loop property of the audio objects. I understand this won't work for audio sprites, but for typical background music scenarios it should work fine.

 

Sorry for the inconvenience. 

 

Regards. 

Link to comment
Share on other sites

Huh.. THX for the reply ludei.. I'm going to look into it and search for a workaround..

I use the chance to reach you here.. Could you please answer my question about the android bottom bar.. Is it possible to "really" go full screen and hide it like its done in other apps.. So you need to swipe from the bottom to make it appear.. ?? Thx again..

Link to comment
Share on other sites

  • 2 weeks later...

I don't know how to record my iphone screen , so this movie is recorded via  my chrome.

 

Phaser v2.1.3 "Ravinda" have same problem (chrome、cocoonJS)、

when i updata to Phaser v2.2.1 "Danabar" ,only on cocoJS have this problem.

 

 

New updata:

on my iphone~




===============================

oh  Safari made this happen , Not cocoJS. 

 

 

https://github.com/photonstorm/phaser/issues/1439

Link to comment
Share on other sites

  • 4 weeks later...

Hi guys!

I've been having some struggles with memory as of late. At first I loaded everything in preload.js which worked fine in my other smaller games, and I use shutdown() for the first time and clear every object when leaving a state which certainly makes the game smoother.

But then when making my third world for the game I recieved memory warnings.

 

So I decided to load the necessary parts of each world in their preload-functions, now the problem I'm having is removing them when entering a new one. Say when I'm done with world 1 and enter world 2, I want to clear the loaded assets only used in world 1.

 

I've tried cache.removeImage(key), which alone did not quite work as I'd like, since it doesn't quite clear it right away. Then I've read about cocoons feature .dispose() which I then tried like this:

 

cache.getImage(key).dispose()

cache.removeImage(key)

 

I've tried in some other orders too, and a little with PIXI(but since that's part of removeImage I didn't look that much into it), but long story short(er); what's the best way to clear assets from memory, using cocoon and phaser, since I want to load them every time I enter each world. I don't want to do it in an incomplete way like I did with removing objects from states before.

Link to comment
Share on other sites

Whenever I try to play the game all i get is a black screen and i don't know the error,

I know the game isnt complete but i should still be able to see the objects.

<!doctype html> <html lang="en"> <head> 	<meta charset="UTF-8" />    <title>The Voltrob Pair</title>	<script type="text/javascript" src="js/phaser.min.js"></script>    <style type="text/css">        body {            margin: 0;        }    </style></head><body><script type="text/javascript">// Setup gamevar game = new Phaser.Game(800, 600, Phaser.AUTO);game.state.add('game', GameState, true);var GameState = function(game) {};GameState.prototype.preload = function() {// Load Voltorb image	this.game.load.image('Voltorb', 'assets/Voltorb Circle.png');	// Load Block	this.game.load.image('block', 'assets/block.png');};GameState.prototype.create = function() {// Background	this.game.stage.backgroundColor = 0x333333;// Add 2 Voltorbs to the game	var offset = this.game.width/4;	this.Voltorb1 = this.game.add.sprite(offset, 0, 'Voltorb');	this.Voltorb2 = this.game.add.sprite(-offset, 0, 'Voltorb');// Center the voltrobs (their coordinate reference)	this.Voltorb1.anchor.setTo(0.5, 0.5);	this.Voltorb2.anchor.setTo(0.5, 0.5);// Make a group for the voltrobs	this.voltrobpair = this.game.add.group();// Center Pair so they should be at the center of the stage	this.voltrobpair.x = this.game.width/2;	this.voltrobpair.y = this.game.height/2;// Add Voltrobs To the group	this.voltrobpair.add(this.Voltorb1);	this.voltrobpair.add(this.Voltorb2);// Add blocks to game	this.blocks = this.game.add.group();	this.blocks.createMultiple(5, 'block');// Add Height to blocks	this.blocks.setAll('scale.y', 6);// Enable arcade physics 	this.game.physics.arcade.enable(this.blocks);// Timer to respawn blocks	this.timer = this.game.time.events.loop(3000, this.addblock, this);};GameState.prototype.update = function() {// Keyboard Movement Left and Right	if(this.input.keyboard.isDown(Phaser.Keyboard.LEFT))		this.rotate(-1);	if(this.input.keyboard.isDown(Phaser.Keyboard.RIGHT))		this.rotate(1);};GameState.prototype.rotate = function(angle) {	this.voltrobpair.angle += angle;};GameState.prototype.addblock = function(angle) {	var block = this.blocks.getFirstDead(),	nth = Math.floor(Math.random()*3);	block.reset(this.game.width, nth * this.game.height/3);	block.body.velocuty.x = -150;	block.checkWorldBounds =true;	block.outofBoundsKill = true;};</script></body></html>
Link to comment
Share on other sites

  • rich unpinned this topic
 Share

  • Recently Browsing   0 members

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