• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

HTML5 All Your Canvas Are Belong To Us - The HTML5 Module

ZeDuval

Member
Hello everyone!

The HML5 Module is beyond awesome! Learn why, just continue reading…

This thread shall be a meeting place for all users of the HTML5-module - and of course for everyone else, who's interested! I would like to see this as a possibility to have some great discussions, have a place to ask for and offer help and share module-related experience in general.


Why this thread? - I think the HTML Module is a bit special, compared to (most of) the other modules. The user base is also rather small, that's at least my impression. While the module offers, more or less, the same functionality as the Windows export for example, …it’s something entirely different in terms of handling, possibilities, distribution, performance and the things you might want to have knowledge about. This is all of course only my opinion, feel free share yours! Because of the different nature of the module, I think it might be a good idea to have our own little HTML fireplace to gather around! :)

I never thought about working with the HTML module, why should I? – Well, let me tell you why I decided to purchase and focus on it! All modules target a specific system to run on. Of course you can own several of them and use the opportunity to export to these different systems, which is awesome. But the HTML5 module is, in my eyes, THE allround module itself. Everyone does have a browser and not only on windows, mac and linux, but also in their pockets, on Android, Windows and iOS smartphones. On desktop, browsers are all hardware accelerated and that’s also true for the average smartphone – and not only the expensive ones. I’ve got a Lumia 640XL, which isn’t exactly the upper class. I bought it not long ago for about 170€ I guess. This thing got power!
The traditional distribution way, meaning uploading your game to one of the big websites, is only ONE way. There are many ways of “wrapping” html games to essentially make an app for iOS, Android or WinPhone of it, which you can then upload to the specific app-markets. Another possibility is to make a desktop application of it, which would be the necessary for the distribution on Steam, I guess. I have my current project as an app on my WindowsPhone since the very beginning of development and thanx to the universal app approach, I have the app on my desktop pc, too. I made a desktop application of it using a wrapper, too. Just wanted to try it out. I will offer links to everything I mentioned here in the near future, right now I’m not at home.

Is there a downside or is the HTML-module perfect? – Of course not. You will never have the performance of a native windows game, where it’s actually quite difficult to get performance problems at all. You just have to know how to handle the HTML-module, how to optimize for it and what mistakes to avoid. If you accept this and embrace it, you get the module with the biggest potential, in my opinion. I’m btw not related to yoyogames in any way. :D

/*#############################################*/

A little bit more in-depth from here on! This is about my current project. I'd like to hear about yours, too!

I’m working right now on a quite ambitious framework for the HTML module, which I will later use myself to develop games. Sooner or later, I will also put it on the marketplace, I guess. While there is yet a lot to do, many things are also already in a working state. My approach is to fill gaps, providing functionality that the HTML-module is lacking in its core. What I mean: There are many game dev frameworks based on the HTML canvas. The gamemaker HTML-module is basically exactly this. While I don’t have any experience with those other frameworks, I can barely imagine a better way of controlling and manipulating the canvas object than using gamemaker. The canvas object is just one object of the HTML DOM(Document Object Model) and I aim to extend the HTML-module with a easy-to-use system to control and manipulate everything around the canvas. For example: It will be very easy to complement the canvas-based game with a HTML DOM user interface. This is for example especially handy when dealing with text-heavy UIs or any kind of user input. This part is WIP but also my current construction site and I'm making good progress.



Here you can see a test-login i recently built in gamemaker. The logo and the whole background is the canvas. On top are two input fields and one button. The input fields are styled with a css file, which got included using a function of my framework. The button uses an externally loaded Material Design css library, which is also included via function. The change of focus between the canvas and the DOM objects gets managed, you can guess, via a function. And the input values are getting transfered into the game, to then use them to login to my Firebase Account. All of ths works already completely. The positioning of of all objects is managed by a set of scripts based on the panel system (https://msdn.microsoft.com/de-de/library/ms754152(v=vs.110).aspx). I'm using here the stackPanel and I plan to implement the Grid next.

Another important thing is to have ways of saving game-data for a longer period of time than one game session. Here I already implemented two ways with the usage depending on the kind of game. If the game is for example a singleplayer economy simulation with a progress, that should be saved for future game sessions, then the local storage(+session storage for data related to only the current game session) of the browser will probably be enough. I implemented functions to make use of everything there is.

For more complex data-handling and even online games including of course an account system I implemented a complete set of wrapper functions to use a Google Firebase database. Complete means: I included all important functionality the Firebase API provides. Firebase is a non-sql database which is all JSON. It is widely used for web-apps with lightning fast data synchronization between ALL users of the specific app. I stumbled upon Firebase a few month ago, thought it was awesome and still think it is. Don’t quote me on this, but I guess you could potentially use Firebase to build any kind of multiplayer game, excluding Shooter or something like this.
There is more about javascript callbacks, promises and generator functions, but I need to find an end, I guess. ;)

Well, if anyone actually read all of this and is interested in any kind of discussion or if there are questions, I’m looking forward to it!

- SD
 
N

N8Games

Guest
Hi, @ZeDuval . I too mainly purchased GameMaker Studio because of the HTML5 module. I've been wanting to make browser games for a long time a lot because of the reasons you've given how it's accessable to everyone. I figure I will start with a browser game then I can always create a PC or App version after.

I am having one difficultly at present. I can't seem to figure out how to make text boxes work on mobile safari. Any tips?

Thank you in advance.
 

ZeDuval

Member
Hey @N8Games ! :) Disclamer: I don't own any apple device and never developed for ios.
First: You should have been a little more explicit about your actual problem. At this point I'm gonna throw just some Infos at you. :p

After some googling I found out that there seems to be a general problem regarding touch-input in safari. If your problem is a control-issue, this might already be it. Find current infos here!

If your problem is actually about textboxes - as in show_message() - you'd need use show_message_async() instead. Short explanation: show_message_async() doesn't block the whole system-process(including the OS) like the synchronous function show_message() would do. Check out the other(eG for user input), related async functions, too. These are all ok for a start, but ugly and non-dynamic. Depending on your answer, we could focus on some alternatives here.

Or, ...some entirely different problem? :D
 
T

Takagi

Guest
It's fortuitous for me to run into this thread at this time! I'm getting back into Game Maker, and had an ambitious project in mind. I needed the screen real estate that a desktop computer or laptop provided, but also cross-platform compatibility. I think exporting the project to HTML5 lets me target both Mac users and PC users without having to buy two export modules and worry about any platform-specific issues.

Your framework seems really cool and ambitious. I was looking for something like this a few years back, but sadly, that project fell by the wayside. Good luck!
 

sylvain_l

Member
Is there a downside or is the HTML-module perfect?
never used really the HTML5 module -I have enough trouble finishing any project for windows only :p -, but I have two
apprehensions:

first, the very wide range of screen size/input methods you get to handle with, from the smallest smartphone with touchscreen, to tablet through the widest 4k (or more?) monitors with superduper gamers mouse and the analog gamepad.

the other is database server side (and it's security); that is an incovenient & an advantage if you are into community/multiplayers oriented games; but actually feels that GMS doesn't offer an out of the box solution. (I didn't make an extended research of what's available in the marketplace, so. But my impression is that most are just about basic highscore and simple things like that)

your framework looks promising :)
 
N

N8Games

Guest
@ZeDuval thank you so much for your response. Sorry it took me a while to reply my day job takes a lot of my focus during the week.

I did have an issue with the touch controls earlier but that was resolved in the latest hot fix in the EA version of GMS.

The show_message() I have been able to use and can even do an input pop up box in safari. The issue I'm having is trying to create a HTML like form text field that you can highlight in mobile safari & bring up the native keyboard to fill type in it. This may be a canvas issue from the what I understand.

There are some Marketplace extensions that help build input forms for Android and iOS, I'm not sure if they solve the issue with mobile safari.
 
Top