[Construct 2] Black Screen


#41

Physics used to work just fine in Canvas in the old cocoon. That’s why I developed the project with the confidence that the new Cocoon would be the same if not better. Webview+ just doesn’t work as well. It’s pretty much the same as Crosswalk.

@imanolm1
Is the issue at least being looked at?. The silence and lack of acknowledgement of the issue in this thread isn’t exactly giving me confidence that I can use cocoon for any physics based projects.


#42

No news on this problem? @imanolm1 @ludei give us some info please


#43

Hello,

Sorry for the delay. We are still working on trying to solve this issue. Hopefully this week we will be able to provide some more feedback.

Thank you for your patience.


#44

Good to hear. From your latest update, Webview+ seems to be working much better than before.More than 50% better. My physics based project is playable now in webview+. But that just makes me wonder how much more better canvas will be.


#45

@admi @imanolm1 Any new info?


#46

I have fixed the conflict between the classic CocoonJS Box2D binding and the Box2D Emscripten version that C2 Cordova exporter injects. Now if cocoon detects the Emscripten version it doesn’t inject the native bridge. Fox max performance select “Box2D web” in C2. But at least the Emscripten version will work now in Canvas+.

Please, try to compile again your projects and check if everything is ok.

Already deployed to npm. Here is the commit:


#47

Testing it right away.


#48

Seems like I get the same error. Canvas + when trying to start physics.


#49

@tony_vlahov I have deployed a new version, it solves the conflict with Box2D Web (yesterday I fixed the Box2D asm).

Unlike the classic Cocoon Exporter, the Cordova exporter doesn’t check the existence of other Box2D bridges anymore in C2 runtime code. Because of that C2 overrides the Cocoon Box2d bridge. You can select Box2d Web or Box2D asm in C2 but they are 100% javascript based. If you want to use the Cocoon C++ Box2D Bridge for better performance do the following changes:

  • Select Box2d Web in C2 Editor
  • Include cocoon_box2d.js in your project && index.html before c2runtime script:

<script src=“cocoon_box2d.js”></script>
<script src=“c2runtime.js”></script>

  • Add the marked line to the following function in c2runtime.js

(function ()
{
window.Box2D = CocoonBox2D;
var b2Vec2 = Box2D.Common.Math.b2Vec2,
BodyDef = Box2D.Dynamics.b2BodyDef,
b2Body = Box2D.Dynamics.b2Body,
b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
b2Fixture = Box2D.Dynamics.b2Fixture,
b2World = Box2D.Dynamics.b2World,
b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
b2DistanceJointDef = Box2D.Dynamics.Joints.b2DistanceJointDef,
b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef,
b2Transform = Box2D.Common.Math.b2Transform,
b2Mat22 = Box2D.Common.Math.b2Mat22;

We would like to make this changes automatically but we have to think a good way to do.


#50

It works now. Very grateful for your work. Thanks for the information on the Cocoon physics bridge, definitely will use it.


#51

Thanks a bunch. Physics finally works now with canvas+. If you or anyone don’t mind posting a tutorial with pics on adding Cocoon C++ Box2D Bridge.


#52

It works ok. Thanks for your work!


#53

I have just launched my game and met black screen. I have read about your fix, but I dont have any of these lines in my c2runtime.js:

(function ()
{
var b2Vec2 = Box2D.Common.Math.b2Vec2,
BodyDef = Box2D.Dynamics.b2BodyDef,
b2Body = Box2D.Dynamics.b2Body,
b2FixtureDef = Box2D.Dynamics.b2FixtureDef,
b2Fixture = Box2D.Dynamics.b2Fixture,
b2World = Box2D.Dynamics.b2World,
b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape,
b2CircleShape = Box2D.Collision.Shapes.b2CircleShape,
b2DistanceJointDef = Box2D.Dynamics.Joints.b2DistanceJointDef,
b2RevoluteJointDef = Box2D.Dynamics.Joints.b2RevoluteJointDef,
b2Transform = Box2D.Common.Math.b2Transform,
b2Mat22 = Box2D.Common.Math.b2Mat22;

Maybe, that’s because I dont use any physics in my game.
Where should I put window.Box2D = CocoonBox2D; then?

I used Cordova export (but wasn’t using any plugins). Here is console screenshot:

But it works great If I use CocoonJS export.


#54

Hi @Walt

What physic engine have you set in your Capx file? You must use Box2DWeb.
If you want I can check your project. Just send me your File in a private message.

Please note that button objects do not work in canvas+. Replace them with sprite objects and try to built it again. Maybe this is causing the issue.

Moreover check the Loader settings. The new c2 loader screen causes also a black screen. Set this to logo and percentage.

Regards


My game works in canvas+ but neither webview works
#55

I forgot to add configuration screenshot, sorry. Here it is:

I have removed all of my buttons and it didnt help! :frowning:


#56

Thanks for the reply @Walt. I’m checking your capx file now, maybe I find something causing that issue.

Regards
Andy


#57

Hi again, @Walt,

I just checked your capx file and it’s working perfect in my developer app (note attached screen shot).

can you re-compile your Developer App, please?

Regards
Andy


#58

Oh my… I feel so confused because of my stupidity.
I have found what the problem was. It’s so silly…

[That’s what I did][1].

And [that’s what I had to do][2].
It’s just a way of zipping your exported project.

Everything works fine now.

I’m so embarrassed. I’m sorry :pensive:
[1]: https://forums.cocoon.io/uploads/cocoon/original/1X/4a8f9520136f7dc075ad054bd4d2b4ff23f33a5c.gif
[2]: https://forums.cocoon.io/uploads/cocoon/original/1X/1180841ffc7c7c45af289d69bb21d6bf76f5ad1a.gif


#59

Don’t worry, that happens to the best, too :wink:
I’m glad that you found the issue.

I will close this topic then!
Edit: Just saw that this topic wasn’t started by you, so I let it open :slight_smile: Sorry!

Good success to your game project, @Walt!

Regards
Andy


#61