Page 1 of 1

Games that won't load because of using new JS constructs

Posted: 28 May 2021, 05:53
by ExpendableEnsign
Until fairly recently, BGA's individual games would work for pretty much any user. Some games don't work perfectly for users with older browsers, but it's usually just display related and may not be significant. (I've only come across two games whose visual positioning issues on older browsers are so bad that they are unplayable.)

However, there have been some recent javascript language additions that totally break old JS interpreters with syntax errors. In particular, there are devs using the ES2020 optional chaining operator (?.) as part of the setup code which defines "bgagame". We are now seeing a cycle of games doing that and getting through alpha (and sometimes even beta!) and then a pile of users of iPads, phones, etc, reporting that the game won't load. (The most recent being Lost Ruins of Arnak.)

Is there any intended base level of JS to be used on BGA?

If not, maybe a standard should be set, such as not using ES2020 constructs? Alternatively, has has there been any thought of using Babel, which should make all these issues go away?

Re: Games that won't load because of using new JS constructs

Posted: 28 May 2021, 11:32
by thoun
Developpers are supposed to keep as much compatibility as possible. But it's not always easy to test all browsers, and most of us are volunteers :)

Except IE, most browser now accept es6, so it could maybe be accepted as the new base, but es5 level would be better until BGA admins set the minimum level.
In my opinion `?.` if too recent to be used in the games without a transpilation.

Re: Games that won't load because of using new JS constructs

Posted: 30 May 2021, 13:10
by BaronFraser
A quick recommendation to developers is to check out Browserstack. This is paid service which lets you view your website on physical devices running every browser version that ever there was, with the results streamed to you via a web page - so it's great a) to test in old browsers, and b) on mobiles and other devices, and c) if somebody reports a bug and specifically says "I'm using Chrome version x.x.x.x on Windows 7" - you'll be able to view your game on that very combo.

When I say "paid service", they offer free subscriptions to open source developers, and I was able to easily obtain one specifically for a game I develop here. You'll need your game to be on a public project on GitHub or similar, though (they didn't accept the public nature of BGA as proof of open source, but were very happy when I pointed them to the GitHub).

If you start sharing with a public repo for this, make sure that none of the hidden settings files from VSCode (or whatever you use) are being included in it - particularly sftp.json which has your BGA upload credentials. #LearnFromMyFail