I am working to upgrade my project to v4.0, I create a simple hello world project and run it on ios simulator. It’s working well in which simulator support metal (i.e, iphone 6s-ios13.2.2) but it’s crashing in which simulator doesn’t support metal (i.e iphone 5s-ios12.2).
Is it a bug in cocos2d-x v4.0 or I am missing something?
@yinjimmy
But I was read an article about v4 where someone told Metal will work alongside OpenGL, If device does not support Metal then engine automatically switch to OpenGL rendering.
If Cocos2d-x v4 is deciding at compile time whether to include OpenGL or Metal, then that is, IMHO, a serious oversight.
It’s not like developers can have multiple versions of their app on the AppStore, one for metal and another for OpenGL, since that, at the very least, would be confusing to users, who wouldn’t have the slightest idea which to choose. This would also cause issues with app rankings on the store, and I can imagine a lot of other problems associated with that too. Also, if I recall correctly, Apple had issues with allowing the same app on the store under a different name, but this may no longer be the case.
The decision of the game engine using Metal or OpenGL should have been done at run-time, and if that isn’t possible, then the Cocos2d-x team should consider adding support for this. The check should be based on the iOS version, since that seems to be the safest to use.
if you are on iOS/Mac, your game is rendered by Metal and therefore the device it is running on has to support metal. This means something like an iPhone 5 and above.
If you are on something else, OpenGL. This was a mostly drop in upgrade, minus a few things that were OpenGL specific and these are covered in the Upgrade Guide.
I cannot find the actual source I am referring to, but few months ago I remember reading about how supported is metal on most devices that currently users use.
Long story short, less than 2% of the devices do not support metal or have an OS version that does not support it. I assume this will be less than 0.5% within a year.
So, the bottom line is, using metal only does not rule a lot of users out.
cocos2dx supports iOS 8+ according to the documentation, with this the following devices are dropped due to the switch to metal-only: (these all support iOS 9+)
Percentage of devices are very different from app to app. I assume Guykun refers to his rhythm game so iPads usually have larger user base (since such genre is better played on a larger display).
But, at least in my opinion, anything that has less than 10% can be taken into account as “calculated loss”, as long as it does not provide a significant revenue % on its own (which is rarely the case).
Putting all this aside, I guess that those who want 100% coverage should stick to 3.x branch until Apple decides it is mandatory to use metal. I have not checked how easy would it be to implement runtime render switch so there is still a chance that we might see that in 4.1 or such.
Sure, it does vary per app and there’s no official statistics on this. We also won’t be disclosing revenue distributions.
But, at least in my opinion, anything that has less than 10% can be taken into account as “calculated loss”,
10% is however definitely not an acceptable loss in device support, especially when there is no notable gain to be made in performance or in revenue (performance gains for a well-running apps would be negligible)
For applications with large userbases I’ve seen 1% treated as unacceptable. Just like crash rates you wouldn’t accept a 90% crash-free metric, accepting 90% device support just for the sake of ‘possible future-proofing’ is unacceptable.
At this time unless OpenGL is added as a fallback or Apple removes OpenGL support fully, it seems unadvisable for anyone with a production application to update to v4.
It is a business decision in the end. To me, if that 10% of devices bring less than 5% of total revenue, and if that means I do not have to support and debug 2 different render backends, I would take that loss as I can compensate it with more free time to do something else.
If I were to start a fresh mid-size game now, I would go with 4.x as metal will be vastly supported or even mandatory by the time the game hits release. For current games built on OpenGL, yes there is no significant gain currently unless you want to future-proof yourself sooner than later.
EDIT: just to make myself clear here, I am talking about percentage, but 10% of 10000$ and 10% of 1000000$ is obviously something that should be taken into account differently.