Here what I have to say. First about the hard parts, the next post in this topic - for requests on WEB platform.
Do not use MessageYesNo and probably all other dialogs/dialog functions from CastleMessages unit, they contain Blocking of app flow with Application.ProcessMessages, also don’t use ProcessMessages itself, it hangs the Web-page, you even have troubles to close the page. I was using it for sample questions to the user, but had to switch to my custom view-based dialog approach: Remade messagedialog to custom one · phomm/Towerfight@cf6f623 · GitHub
Do not use Keyboard key like Escape, Space, Tab, PgUp, PgDn, maybe even arrow keys, they switch the focus of html-canvas or scroll the page, which makes playing uncomfortable, I knew about Escape, but others I had myself to bump into , for example I added a Backspace to duplicate “exiting” function, which on desktop is done by Escape
Use ApplicationProperties.ShowUserInterfaceToQuit from CastleApplicationProperties unit everywhere you can to hide various controls, it make sense not only on mobile, but web as well, I use it to disable Exit button and corresponding controls, also Fullscreen selector, as on Web it is controlled outside: by canvas.requestFullScreen if you use castle standard html-template, or by Itch special fullscreen button, if you post game to itch.
I have a thing that bothers me on Android build, you need to disable orientation-lock to be able to rotate cge-window to landscape. But if you post the game to itch , there is a setting to setup landscape-always, which works even in mobile browser and you don’t need to disable lock.
The standard html-template of cge-web project is not compatible with itch (iframe shows only part of canvas, and in itch-fullscreen-mode the button from castle html template for fullscreen isn’t working), I had to adjust the template, I think @michalis would add such a template as an option. The changes you need - remove the style attribute from canvas element, comment/remove all other elements (button and hrefs), except canvas, bc they could capture the focus from canvas and break the gameplay. Itch kinda requires bare canvas for 100% of iframe and controls fullscreen by its own mechanism and button. for this you need CSS (separate or embedded into style attribute) :
obviously I wait WebAudio as a game without it is really different as designed
Also would be nice to have UserConfig flow to store basic settings in user’s storage in browser
My personal (maybe not so important for other devs) is TCastleDownload, because one of soon to be implemented features for the web-game is leaderboard based on server and requests from game-app
As a lazy programmer, I’m always down for automations and really love CI templates provided by Castle to automatically build and publish artifacts to castle releases, and I use this feature for both my games. And even more - I have a custom step in pipeline to upload artifact to google drive. So AFAIK, Itch supports automation, and uploading new build is doable thru the pipeline, which I would love to have. But as I know it is not yet fully prepared in CI template (as requires updating docker image with crossfpc and pas2js). Would be cool to have it eventually.
Those are my expectations/favorites Let’s maybe discuss
From my side - I’m not a JS developer (i’m a .net backend), however I have some experience with JS, and I think with the help of AI something could be achieved. Or , for example the Docker part seems doable to me, as I work with docker from time to time, and also building fpc stuff from sources sometimes.
Note that you can still use our dialogs, by using views:
You can use unit CastleDialogViews (which define views, which are the underlying things inside MessageXxx) and create related views yourself. Like this:
var
Dlg: TViewDialogOK;
begin
// open new view with dialog
Dlg := TViewDialogOK.Create(Self);
Dlg.Caption := 'Some content to display';
Container.PushView(Dlg);
end;
You can set MessageOKPushesView to actually make MessageOK(...) do something like above. But naturally it cannot work for routines like MessagesYesNo, so my simpler advise for iOS and web is just to not use CastleMessages unit at all, and not use MessageXxx at all.
Indeed, browsers capture various keys for their purpose. Our control still receives (some) of them, but the UX is bad when both our game and the browser do some action on these keys.
Also confirmed ShowUserInterfaceToQuit is false on web and one should honor it, by not showing the UX (buttons etc.) to user to “Quit” the application, since on web → there’s no quit, users just close their tab / browser window etc.
Hm, you mean in a web browser on Android? There is a way to request that full-screen is forced to landscape? Thank you – added to TODO, we should find it and use too. We could then make screen_orientation from manifest work on web too, so using screen_orientation="landscape" would work on the web.
Thank you – we should indeed introduce some way to provide custom templates, and maybe just provide a ready template to do out-of-the-box something proper for itch.io as you show.
Your post is a great reference for people who want to upload their web games on itch.io, thank you!
I have 2 of above, WebAudio and a TCastleDownload-web backend already in progress
They work – but WebAudio needs review (parts of it have been generated by Claude Code) and TCastleDownload-web needs rework to be cleaner (here also Claude Code helped, but what it did must be now fixed). You will like our next update :), hopefully this weekend.
Indeed, exactly as you say. Itch.io has butler to upload builds from the command-line (so also from any automated work, CI/CD). We use it e.g. to upload platformer to itch.io.
I want to solve it by zipping the prerequisites in castle-fpc releases. Then the “web prerequisites” could be:
placed in Docker image,
downloaded by castle-build-ci scripts,
but also downloaded easily by CGE editor, so that building for web is just “a simple button press from our editor”.
I agree 100% with all your feature requests. I think they actually match perfectly the things I see as “most priority” for web! So, this makes me happy, we’re going in a good direction.
This is my observation. I configured the game config panel (on itch) , among others there is a selector for Forced landscape mode. When I opened the game on Android inside browser in fullscreen mode (via itch fullscreen button), it preserves landscape despite phone setting to enable/disable rotation of orientation.
Great ! Lovely ! I will proceed with my features so maybe even in sync with cge updates