Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
How to publish webGL games on itch.io

Dieter
Guest
Quote
2023-09-19 16:58:49

Here's a little guide, in order for you to overcome the few yet mean hurdles, that you may encounter, when publishing webGL on itch.io.

Basically, you only have to put your game.html together with the whole copperlichtdata folder into a zipfile and upload the zip.

However, your game.html must be renamed to index.html.

Then there is a keyboard focus issue, that may or may not affect all users. I had this problem, and when browsing the forum for solutions, I've noticed other people had the same problem:

The keys simply don't reach the game. Your game has no keyboard focus, despite being focused by mouseclick. Worse: this happens inconsistently, but more often with than without the problem. It hsa something to do with a keys handler of the parent frame (if the game is in a iframe), that's messing around.

There is a solution, you must edit index.html accordingly

I tried to post my index.html here, but the forum thinks it's a hacking attempt. so I will only describe what needs to be altered.

After the line "startCopperLichtFromFile(...."
you would add this function:



function refocus_myself(){
var mycanvas=document.getElementById('3darea');
mycanvas.setAttribute('tabindex','0');
mycanvas.focus();
}


Furthermore, in the <canvas.... tag you would add an on-click handler that calls the function:
o-n-c-l-i-c-k='refocus_myself()'

(of course, remove the dashes from o-n-c-l-i-c-k)

Now on every click the function refocus_myself() is executed. This keeps the keys operational about 99% of game runs. If they don't work once in a while, a ctrl-r reload always works.

It's a bit of a brute force method, as it will focus on each click (imagine shooter game). I haven't noticed much impact tho. However, one could try to do that with a time lock, not more than once in a few seconds for example.

Keep a copy of your modded index.html, as CC may overwrite it during the next run. But basically that's it.

Hopefully I'll see a lot of webGL games by you guys.


Guest
Guest
Quote
2023-09-19 20:09:16

For keyboard fix, there used to be an extension on neophyte website. You can also try that if helps.
The info says you have to put it in before first drawing do something behavior.

https://vazahat.github.io/ccb_ac...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact