(Updated: v3.13.1 update released) Cocos2d-x v3.13 released!

appreciate it.

14 posts were split to a new topic: V3.13.1 and Design Resolution issues

Hello. Once more about my troubles:

I tested the following “bad” code. When built with 3.13.1 with commands
cocos compile -p android or cocos compile -p android --ap android-19

  • it freeze my device ARIES_101v2 on Android 4.4.2. Device is not rooted; “developer option” is turned on.

“null->” and “->null” code examples nicely close the app on most devices, but at ARIES_101v2 - they freezes the device.

At very first start (after install or device restart) “while-1” and “for-50M” code examples works fine, but at the second start - they freezes the device at once.

Code examples:
I create the new empty project, and add the “bad” code just after
bool HelloWorld::init() { if ( !Layer::init() ) { return false; }

the “bad code” lines (I tried them by one - not all together):

Label * label0 = 0; this->addChild(label0, 40); // closes the app on others devices, but on this - freeze the whole device == Android OS at first start;

Label * label0 = 0; label0->setVisible(1); // closes the app on others devices, but on this - freeze the whole device == Android OS at first start;

for (int t = 1; t < 50; t++) for (int r = 1; r < 1000000; r++) int eee=5; // 50 millions cycle - starts nicely, but at second start it freezes the whole device == Android OS at second start;

while (1); // always loop - freeze the app (it's ok); but at second start it freezes the whole device == Android OS;


On same ARIES_101v2 I’ve tested “null->null” code examples, compiled with 3.10 - they nicely stops the app and do not freeze the device.
Going to test them with cocos SDK 3.11.

I don’t think it is reasonable to expect either Cocos2dx or Android to continue working fine after passing in null values.

This is not a bug or a problem. In my opinion it is expected behavior to get unexpected behavior when we pass invalid parameters.

Neither cocos2dx, or the graphics drivers, or Android can check for null everywhere or cases like invalid typecasts or invalid texture ids etc… In theory it might be possible, but practically is not possible to verify everything and even if it was, there is no benefit of doing it.

On most devices “null->” and “->null” code examples nicely close the app. I agree it is expected behavior.
But on ARIES_101v2, the same code:

  • built with 3.10 - nicely close the app;
  • built with 3.13.1 - freezes the device. I think it almost impossible situation for Android OS, and not allowed situation for Cocos SDK.

I have tested all 4 versions of “bad code” with cocos 3.11.1 version: it runs not in full-screen, navigation bar is visible, so the app runs/stops/prompts about the error in app nicely, without freezing whole Android OS on my ARIES_101v2 device.

App created with Cocos v. 3.12+ runs in full screen (hiding navigation bar), so in “bad code” version the Cocos app freezes one of my device.

Cocos Developers, please fix that, please make Cocos to run the application in full screen properly (on any device). Thank you. Any questions are welcomed.

Also when I use cocos run -p android - it works fine with v.3.10-11, and looks like it freeze that device every second run, if built with v.3.12+ …if runned application is not active.

Aha… Looks like I’ve found back-door solution.
My code problem was: I had a cycle in bool HelloWorld::init():
for( 13 times) a_block_to_create_a_button; Due to some reasons it freezes the Aries device when app started the second time; even after it was changed to:
for( 50 millions times) int temp_var=0;

My solution: to move that code from bool HelloWorld::init() to a separate function, and call it later, after exit from init():

m_bl_init_done = 0; // class variable;
this->schedule(schedule_selector(HelloWorld::f_animation), 0); // function for animation drawing; called so often as possible;
return true; // and we should exit ASAP from HelloWorld::init();

then:

void HelloWorld::f_animation(float dt)
{
    if (0 == m_bl_init_done)
    {
        m_bl_init_done = 1;
        f_init(); // at this point it is safety to call long time taking initialization functions;
    }
}

At laaast! My app release mode start-up time:
Built with 3.10: ~3 sec.
Built with 3.13.1: ~4 sec; but in full-screen mode.
Had anyone made the same comparisons?

Hello,
First of all, thank you for the update !
However, I still find the new AudioEngine to be extremely slow.
Just using it drops my frame rate from 40 fps to about 15 fps…
What are the exact requirements to have no performance hits hen usign the new audio engine ?
I am using cocos v3.13, my device is running android v4.1.2 and I call AudioENgine::preload() for each sound I use at the start of the app.

Thank you !

What about to use SimpleAudioEngine::preloadEffect() ?

The SimpleAudioEngine can only play one effect at a time, while in my game there can be several at the same time, thats why I switched to the new audio engine

Hm… in c++ I play few mp3 at the same time; mainly with different start time; but they sound the same time. Cocos SDK versions 3.10 - 3.13.1.

Dear all,

I have a problem with SimpleAudioEngine in V3.13.1, but I don’t know if it is specific to this new version of cocos2d-x : my problem is very simple : the stopEffect method don’t work on android with one of my audio files : I thought it was due to the file type (mp3), but I tried with an ogg version of the same file and I got the same result : stopEffect has no effect on android !

Does somebody saw this problem ?
Or simply knows what I’m doing wrong ?

For information, my file stream has these characteristics : 320 kbps, 2 channels, 48000 Hz, Stereo.

Thanks,

Olivier.

Hey @oponsinet ,

Sorry about the work that you were going through getting VS and the new version of Cocos2d-x to work. I wanted to hit it earlier, but stuff has been a bit busy here at MS with a big Preview release and cppcon. Here is a version of the VS proj.VisualStudio project that should work with 3.13.1. I tested it out launching and debugging in ARM | Debug and ARM | Release configurations on my device. With this you should not have to tweak API levels at all or copy around old curl versions.

https://aka.ms/vscocosandroidsample3_13_1

I’ll update the VS android thread here as well with this link and more info. And I’ve already updated the main blogs.msdn.com blog post to have both the 3.13.1 and 3.12 versions available.

BTW. I’m asking around here as well about the VS LogCat window issue that you mentioned.

1 Like

Many thanks IanHu, I will compare with my android projects to see if there are some differences :slight_smile:

Dear all,

Finally I can explain my sound problem ! And there is no real problem on android, there is only a behaviour difference between Win32 and Android plateform with audio play / stop management : in fact, in my code, the sound effect I thought it can not be stopped were launched 2 times in 2 places in my code :tired_face:… And on Win32 plateform, I think that if a sound effect is already playing, it is not launched a second time, but not on android ! So on Win32 all was working as if I did not launched this sound 2 times, but not on android : that’s why I thought there was an android problem !!

Many excuses if somebody tried to analyze my problem :scream: !

But now I (and so we if somebody read my message :stuck_out_tongue_winking_eye:) learned that there is this behaviuor difference with sound effects between Win32 and android plateform !!

See yaa !

Olivier.

1 Like

Hello!

I started coding a cocos2d-js game using library version 3.12 and Visual Studio (ok, my game is a mix of C++ and JS).

Is there a “standard” way of upgrading the library? Do I have to create a new Visual Studio project using 3.13.1 standard templates and import my C++/JS files into it? Is there documentation somewhere about this process?

Many thanks in advance,

Mathieu

I am new to programming and developing on the Cocos2d platform.

I have downloaded the latest cocos from their official website (version: V3.13.1) and created the Xcode 8 project with cocos in the terminal. I opened the ios project and run the blank project, but it loaded like 200+ warnings. All warnings are all different:

> Unused variable "40differentvariables"
> "register" storage class specifier is deprecated and incompatible with C++1z
> "delegate" is deprecated: first deprecated in iOS 6.0

etc etc etc etc…

There are so many different warnings… Is there anyone else having the same issue? These warnings are just annoying.

Anyone knows what could be the issue here?

Thanks

Looking at this, a lot of these warnings are in projects that we use, but don’t control, like bullet

Dear IanHu,

I continue my debug on android, and about the LogCat window named “Android Device Logging”, I did not succeed in making it work, but I remarked something which could explain this problem : When you active the DDMS (Android Device Monitor), you can see the LogCat traces in the LogCat part of this application, but I remarked that this application intercept all the LogCat traces even when it was not “launched” ! I think this application is always active (or one of its service), so I think it could be this application / service which catch all LogCat traces and so we can not see them in the other window… Do you think it can be an explaination ?

You could reply me to use the DDMS to see traces… OK but there is another problem since when you launch an android debug session withe the DDMS “on”, the debugger can not connect to the application !

And for all other programers, I remarked another small issue : if you put any “special character” in a CCLOG traces call (like in french ‘à’), , the trace won’t appear in LogCat window :triumph: !

So in conlusion, I think LogCat is actually not very user friendly with VS 2015 :joy: !

See yaa