A solution of hybrid HTML5 + multi-platform support

0 favourites
  • 9 posts
From the Asset Store
Controller Support ,TouchScreen Support , Keyboard Support , Action Platformer, Lots of Animations
  • Hear me out on this and tell me if there is a solution:

    Currently, web games can be displayed on... well, almost any device that connects to the internet with a browser. So, generally game developers like me would build a game that can be played on all these platforms because isn't that the feature of HTML5?

    Nice idea, but a lazy thought. Devices that can run HTML5 games as you know, does not necessarily have a touch input and vice versa. With that in mind, how would my games even fit the criteria as play everywhere right? Generally, if you could make a game that fits to be played on a touch screen, console and mouse+keyboard, usually turns out bad, inconsistent and poorly designed, or does not fully utilised a device's inputs.

    Let's say I made a game but I maintain separate project files for the big 3 (touch, controller, mouse+keyboard). Each of these variations have their unique design and game play that caters to its platforms. Now, I have exported them to HTML5 only. Then I host them online with a URL. Next, I made all kinds of necessary empty browser app that would load the URL for their respective platforms. All of which are now published to their respective stores (Play store, App store, XBox, etc).

    Sounds great right? My games have to be played online but my players will always get the latest version. So, here's my problem. No one loves games that require online connection if the game doesn't even need an online feature to work. Is it possible that my games be able to work like how C3 works using something like service worker? C3 can be used offline, at the same time it is also a web app. Can my HTML5 game created with C3 do that too?

  • For PC you can use Electron or NW.js for offline play(Not sure if it works on Xbox), And if you wrap a game with Cordova for android and ios, it acts as an offline application

  • I've actually done something similar to this in the past, it didn't have different versions though. It was an iOS and Android app and was made with cordova. Last I checked it was in the app store and the update mechanism was working fine, although I obviously don't work at the company that owns it anymore so I'm not sure what the status is. As a disclaimer here I'm talking about a hybrid web app completely unrelated to Construct.

    You've probably seen native apps do something similar to this in the past, they have an "updating" screen that appears and it downloads some new art assets etc. So they can show you new content without having to go through with the fuss of publishing a new release through the app stores. However, because we're using html we can take it a bit further and update the main codebase at the same time!

    The basic app structure had 2 HTML pages; the first is a loader that deals with updates and the second is the single page application (SPA) that is the app. When you open the app it starts on the loader page, this then deals with the initial setup and queries the server for new files. When all that is done we can load up the main SPA. Ta-da! Auto updating application! There's quite a few hurdles to get it working correctly, although you can probably solve some of them by using newer web technologies. At the time I wrote it realistically I couldn't use Blobs, indexeddb or service workers. All of which are the obvious tech to use on it nowadays.

  • C2 and C3 exported games already work offline. In fact, the C3 editor itself uses the same Service Worker developed for C2 games to run offline, which we recently introduced as the replacement for AppCache.

  • C2 and C3 exported games already work offline. In fact, the C3 editor itself uses the same Service Worker developed for C2 games to run offline, which we recently introduced as the replacement for AppCache.

    In my recent test, the compiled APK using C3 does not "go to URL" using the browser object. I tried execute javacript such as

    "window.location.replace('...');"[/code:2fbojc19]
    
    and it didn't work either. Is this a security feature or am I missing something? I want to test if this app could load C3 games from my host and remember it offline.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not sure I understand. I was answering this:

    Is it possible that my games be able to work like how C3 works using something like service worker?

    This is already the case. C2 and C3 games already work offline using the same service worker the C3 editor uses. Of course making a Cordova app is another alternative to that. If you find a bug with that at any point, please just file a report as usual following all the guidelines.

  • I'm not sure I understand. I was answering this:

    > Is it possible that my games be able to work like how C3 works using something like service worker?

    >

    This is already the case. C2 and C3 games already work offline using the same service worker the C3 editor uses. Of course making a Cordova app is another alternative to that. If you find a bug with that at any point, please just file a report as usual following all the guidelines.

    Tested the offline ability using Firefox and it definitely works as you mentioned! My current test is to see if I could have it offline on a Cordova App that only links the URL of the game. But I guess I need to have the Cordova app to even "go to URL" properly to test this.

  • I think you might only be able to go to a URL in a new window to open the browser. Otherwise I think you'll need to specifically whitelist every URL or origin you want to be able to navigate to in Cordova.

    Come to think of it, I'm not sure if such apps are actually allowed on the app stores. I think iOS in particular has restrictions on this. If it loads from the web then there's zero guarantee that what the app reviewers see is what will actually be in the app when it's published, so they may block that.

  • I think you might only be able to go to a URL in a new window to open the browser. Otherwise I think you'll need to specifically whitelist every URL or origin you want to be able to navigate to in Cordova.

    Come to think of it, I'm not sure if such apps are actually allowed on the app stores. I think iOS in particular has restrictions on this. If it loads from the web then there's zero guarantee that what the app reviewers see is what will actually be in the app when it's published, so they may block that.

    I thought about using the "Add to Home screen" feature for my game on my android device. This way it would not have to go through the store. Unfortunately when I go offline, my game doesn't load and gives the offline dinosaur. What gives?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)