# GMLscripts.com

Discuss and collaborate on GML scripts

You are not logged in.

## #1 2011-09-22 10:26:40

xot
Registered: 2007-08-18
Posts: 1,201

### GameMaker:HTML5 - Things that work differently

The public beta of GameMaker:HTML5 has begun. There are no doubt many things GameMaker users are accustomed to that are not available in HTML5. GM:HTML5 also introduces new features to GameMaker's existing feature set. This topic is a catch-all place to comment on differences between GameMaker:Standard and GameMaker:HTML5.

The IDE has undergone changes of varying magnitude. The most immediately obvious are the wizard-like start-up page and the light-on-dark color scheme. The new skin cannot be fully disabled. Cosmetic changes to the icons remain and leave the legacy interface looking rather dismal and in some places unreadable. It is being looked into.

While the IDE remains largely functionally unchanged from GM8.1, there will be some changes to the way you work. One of the important new features is improved collaborative work flow. If you create extensions you'll be interested to know that they can be created within the IDE now, and of particular interest is the ability to add Javascript libraries such as Paper.js to your HTML5 projects (probably with no small amount of syntactical duct tape). A drop-down menu on the tool bar selects the target platform you desire (Windows .EXE or HTML5). A docked window displays status messages during HTML5 compilation. It can be torn free if desired. Sadly (but not surprisingly) the trusty GM debugger is unavailable during HTML5 testing, but advanced Javascript debugging is available for browsers that natively support it. Start-up information and limited debugging (debug_show_message) are also supplied by a status panel toggled with F9.

Aside from its new core features, the most materially significant change is easily the help file, the GML reference in particular. Each function is now individually documented, fully and properly in a consistent and clear format, including syntax, arguments, return, example code, and even illustrations. The initial release had some ruinous problems with the index but they have now been largely resolved.

So far there seem to be a number of surprising differences and limitations to the GM:HTML5 engine and its GML support. You'll find more about those in following posts. Below is a summary of what has been learned so far. This post will be regularly updated with new information as it is uncovered. One should also keep an eye on the official GM:HTML5 FAQ as well as the GMC GM:HTML5 forum.

• GM:HTML5 does not support splash videos and that will probably remain the case.

• show_info and Game Information have been more-or-less removed. There is some functionality for Windows, but editing it from the IDE is no longer possible.

• variable_local_* (and variable_global_*) are no longer supported due to obfuscation, although it would appear that they work under certain circumstances.

• Dynamic code is not supported. Code can not be created at run-time (execute_string, execute_file, object_event_add, timeline_moment_add) or queried (script_get_name, script_get_text, script_exists). Side note: it will not be support in GM9 either.

• Although dynamic objects are supported, adding events to them is not because dynamic code is not supported. A workaround for many cases would be to construct a parent object that could selectively call existing scripts (script_execute) for predefined events.

• Dynamic timelines are not support, again because of the lack of dynamic code support. Mike suggested that in the future timeline "moments" could point to scripts instead.

• Precise collision checking is now off by default for performance reasons. This seems to be causing some confusion for people expecting it to be automatically enabled.

• Motion planning (eg. mp_potential_step) is not currently supported. It is coming in a future update.

• image_single is no longer supported. It was deprecated years ago. Use image_index and image_speed instead. Update: It appears this may have been reimplemented. Why?

• Color blending is not well supported (eg. draw_text_color, image_blend, part_type_color3). Clever caching allows some blending, but WebGL* will enable them completely in "the very near future" when it is integrated into the HTML5 runner.

• Textured primitives and shapes with gradient color are not supported, at least until WebGL* is integrated into the HTML5 runner.

• sprite_save is not supported because local storage is limited (typically 5MB per domain or subdomain, depending on the browser).

• Image resources are limited to dimensions no greater than 2048x2048 pixels. Larger images will be automatically shrunk at your peril.

• screen_redraw is not supported for HTML5. It's not clear if WebGL will change this. YoYo are ultimately intent on limiting ALL drawing to the draw event for performance reasons, and as a concession to the requirements of some portable OSes and their implementation of OpenGL ES.

• Draw order for instances of the same depth is not guaranteed. Previous versions behaved consistently in these cases, but draw order should never be assumed.

• Rooms (or view_ports if using views) should all be the same size. Rooms/view_ports of differing sizes will be automatically scaled to match the first room. This capability will be entirely removed from future versions of GameMaker.

• Room transitions are currently not supported. Custom transitions will certainly never be supported. YoYo have indicated a desire to eliminate the (dubiously useful) transition engine in the future.

• Message boxes have very limited support. Only very basic browser-supplied Javascript alerts are available.

• show_menu is not supported in HTML5.

• sound_pan is not support for HTML5.

• Box2D physics are coming to HTML5 and Windows executables. It will be a standard feature for future versions of GameMaker. It will not be coming to GM8 Lite or Standard.

• mplay_* functions are not supported. Multiplayer networking relied on deprecated DirectX functionality (DirectPlay). New netcode is coming in a future update.

• YoYo_AddVirtualKey and its kin manage the use of rectangular regions of the screen for the firing of keyboard events. This is for creating on-screen controllers and multi-touch features. I have to question the wisdom of introducing CamelCase into GML. Does this indicate a new direction for GML in GM9?

• It is now possible to select a keyword in a script and press F12 to display its entry within the help file.

• Resource names are no longer allowed to be the same, as it should be. You could get away with it in the past, but no more.

• A new way of managing projects and associated files allows for proper collaboration. Projects are no longer "monolithic" unless exported as *.gmz files. Essentially, projects are stored as multiple files within a project directory; assets are stored as individual media files (images, sounds) and definitions (objects, rooms) are stored as individual XML files and scripts are stored as individual *.gml files. Exporting a *.gmz file bundles all of the required assets, definitions, and scripts into a single compressed file. Files within the project directory that are not referenced will be ignored. When an resource is removed from a project with the IDE, it is not removed from the disk. To cull these files, export the project and then import as a new project.

• New collaboration features mean the script importing and exporting will be removed because "there is no need now". Not sure I agree with that opinion.

• Certainly one of the most powerful features provided by HTML5 is the ability to utilize Javascript extensions.

• Web events are a new class of event used to track the status of resource changes. When a resource is requested (eg. sprite_add), the function will complete before the resource is actually ready due to inherit internet latency.

• Games must be run from a web server. It would appear this is to support file operations and image caching operations performed to support limited color blending (image_blend, text color, etc). Browsers only support web storage for domains, not for pages served from the local file system. GM:HTLM5 includes a web server for these reasons.

• A Javascript debugger is available to HTML5 projects for browsers that support them.

• GM:HTML5's DRM doesn't have an installation limit, but it does limit the number of actively running copies to three. Installations are tracked and can be "remotely blacklisted or questioned if they're being installed too frequently".

• Importation of Game Maker 5 projects is not fully supported, particularly for HTML5 delivery.

* It must be noted that not all browsers support WebGL and some popular browsers, including Internet Explorer, may never support it. If a desired feature requires WebGL, it is a good idea to consider alternatives.

There are also (as expected) many bugs popping up. Those should be posted to the bug tracker. Bugs have been squashed and new releases pushed out at a phenomenal rate so far.

The latest release version of GameMaker:HTML5 should always be available here: Windows Installer

Previous releases are each linked within the release notes, should one wish to downgrade.

The current release notes of GameMaker:HTML5 can be found here: Release Notes

Release notes may be found locally within the GameMaker:HTML5 application data directory.
%APPDATA%\\GameMaker-HTML5\\release-notes-html5.html

Tool for building new skins for GameMaker:HTML5 can be found here: SkinBuilder

Last edited by xot (2011-11-04 13:06:02)

Abusing forum power since 1986.

Offline

## #2 2011-09-22 10:27:39

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Mark Overmars just mentioned something about limited color blending and gradient support.

Mark Overmars wrote:

You cannot use color blending in particles. It will make them very slow. The reason is that HTML5 does not support blending an image with a color. GameMaker: HTML5 does some neat trick to still make this possible (e.g. for colored fonts) but it is slow when you need many different colors. For the same reason you e.g. cannot draw triangles or texts with color gradients.

alexfislegend wrote:

Will GM:HTML5 ever support image_blend?

Mark Overmars wrote:

As long as blending is not supported by HTML5 I don't think we will be able to support it, unless Mike comes up with something extremely clever.

Presumably this will eventually be supported through WebGL, but it's unclear when WebGL will be integrated into GM:HTML5. The YoYo site suggests it is "coming soon", whatever that means.

UPDATE:

See post #5 below for more details from Mike Dailly.

Last edited by xot (2011-09-22 13:48:25)

Abusing forum power since 1986.

Offline

## #3 2011-09-22 11:20:15

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Andrew McCluskey (NAL) had this to say.

NAL wrote:

Things like any 3D functions, view_angle, registry features, some text reading, motion planning and mplay are not supported by HTML5 at this time (not that they'll never be). Some of them may cause the game to not appear.

Nothing really surprising there except one important and inexplicable morsel: motion planning

If true, I'm genuinely baffled by this omission.

EDIT:

Confirmed. Should be coming but skipped due to time constraints.

Last edited by xot (2011-09-22 12:10:39)

Abusing forum power since 1986.

Offline

## #4 2011-09-22 13:23:27

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

In a similar thread at the GMC, @Alex@ reports this (unconfirmed).

@Alex@ wrote:

action_execute_script() is not supported. The demos are likely using execute_script or calling the script directly.

I've noticed these when randomly porting things.
motion planning does not work
draw_set_blend_mode() is not supported
collision_line functions differently (returns true / false )

The change in the behavior of collision_line() (if confirmed) is somewhat shocking in light of YoYo's repeated appeals for backwards compatibility.

I wish I could investigate this stuff myself, but I can't seem to get GM:HTML5 downloaded despite having a key for it.

EDIT:

Russell Kay has come to my rescue. Thanks, Russell!

Last edited by xot (2011-09-22 13:45:20)

Abusing forum power since 1986.

Offline

## #5 2011-09-22 13:30:05

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Mike Dailly clarifies the color blending limitations here.

Mike Dailly wrote:

image_blend should work just fine. However, as HTML5 does not support this natively I cheat a little in order to get it working. Each sprite has a "cache" of different blended versions (up to 4 by default). This means you shouldn't "fade" through many colours as this will be very slow.

You can change the NUMBER of the cached images on a PER sprite or PER image basis.

sprite_set_cache_size(ind, max) // All subimages
sprite_set_cache_size_ext(_ind, _index, _max) // Set a specific sprite+subimage cache size.

Of course... the more images you allow, the more memory you will burn, so use with care...

When we do WebGL (soon), all the normal blending and colour tinting will work as expected.

Interesting stuff.

Abusing forum power since 1986.

Offline

## #6 2011-09-22 14:21:09

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Holy Moley!

The Help File has undergone a massive upgrade. Need to get this online ASAP.

Not ready for prime-time just yet though. The index is wrecked (fix is coming) and there are some bad links here and there. One of the other changes to the GML reference is that there are new duplicate sections for each kind of resource. While you can still find font usage functions under GML > Resources > Fonts, and font manipulation functions under GML > Changing Resource > Fonts, all these functions appear in a new GML  > Fonts section. It is in the new Objects section that I encountered link problems and I would not be surprised if there are others. Sections of the GML reference are now alphabetized in the table of contents rather than ordered by sophistication. In the table of contents above you can see an improperly handled page called Backgrounds_main_page_index. Suffice to say the help file still needs a lot of work.

Although the Joystick section has vanished from the help file, the functionality still exists for Windows projects.

Last edited by xot (2011-09-22 18:20:14)

Abusing forum power since 1986.

Offline

## #7 2011-09-22 16:03:36

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Here are some new tidbits:

Miscellaneous YoYo Functions

These functions are new and exclusive to GameMaker:HTML5, and deal with browser information, information about the OS the game is being run on, virtual keys and other multi-platform things.

browser_heightbrowser_widthos_browseros_deviceos_typeos_versionYoYo_AddVirtualKeyYoYo_DeleteVirtualKeyYoYo_GetTimerYoYo_HideVirtualKeyYoYo_OpenURLYoYo_ShowVirtualKey

Most are self-explanatory. Some seem oddly redundant.

Here's an interesting illustration regarding how windows are treated in HTML5.

Abusing forum power since 1986.

Offline

## #8 2011-09-22 16:17:10

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Russell Kay writes regarding one of GM:HTML5's most powerful features: Javascript Extensions

Russell Kay wrote:

Create an Extension.... Just right click on the Extension node of the Resource Tree this will create a new Extension node, right click that and then select Add a File, this will bring up a dialog to select a file (create a new file using notepad and save it as a .js) once you have the .js file then you can right click that node and select Create Function or Create Constant.

Basically we have added the Extension Create mechanism into the Maker itself and you can use that to interface with Javascript libraries.

We will be writing this up properly next week...

Russell

Being able to create extensions within the GM IDE seems kind of great. It also seems kind of bugged, as the extension node does not appear in the resource tree. When I add an extension it becomes a child of the Global Game Settings node (definitely not the intended behavior). The problem seems to be triggered by importing old projects. Enough about that, bugs don't go here.

Abusing forum power since 1986.

Offline

## #9 2011-09-22 16:57:48

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

NakedPaulToast posted a good development tip.

NakedPaulToast wrote:

Want to convienantly try your latest HTML5 creation from another computer, phone or tablet?

GM:HTML5 starts a Web server, specificly nginx. From GameMaker:HTML5 you can configure a list of "allowed" hosts that can access the webserver while it's running your game.

For example:
If your development machine's IP is 192.168.1.100, from within GM:HTML5 goto File/Preferences/GM:HTML5, then in the IP allowed list enter 192.168.1.0/24. Make sure Windows firewall is turned off.

Now any machine on your home network can test your game by going to http://192.168.1.100:51268

Very convienant for testing games from your Laptop, iPad, phone, any HTML5 compatible device.

You can also enter IP addresses of your friends, they can then test your game from their own homes. To do so enter their IP in the allowed list and port forward to your dev machine.

Cycododge replied with this.

Cycododge wrote:

There is also a very helpful tool for testing on mobile devices. The Ripple Mobile Environment Emulator by tinyHippos

Last edited by xot (2011-09-22 17:14:36)

Abusing forum power since 1986.

Offline

## #10 2011-09-22 17:33:25

paul23
Member
Registered: 2007-10-17
Posts: 110

### Re: GameMaker:HTML5 - Things that work differently

Meh as expected variable_local_* functions no longer work. I've already typed a few times, but that's really a lackluster. No more pass-by-reference or any structure possible.
Also drawing is now only possible during the draw event, and manually calling the draw event is not possible.

Offline

## #11 2011-09-22 17:58:31

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Here is a peek at the GM:HTML5 welcome screen.

The default "Welcome" tab is largely redundant, but it provides quick access to recent projects.

The "News" tab requires Internet Explorer to function. If your security settings are [not] correct, or you are using an outdated version, expect to receive an error message instead of news.

Although it would appear from the "Create" tab that GM:HTML5 can only import GM8.1 projects, it can load projects going as far back as GM5. Like previous versions of GM, it does not magically update incompatible code.

The "Tutorials" tab features some new integrated tutorials. Selecting one of these will load a tutorial project as well as utilize the familiar tutorial sidebar seen in GM8.

The "Demos" tab works like the tutorials minus the instructional sidebar. They aren't elaborate, and there's not much to look at here, but it's still miles better than Catch the Clown. Still, this tab should be a showcase with proper games in it. Right now the tutorials provide a more compelling gaming experience.

Closing the welcoming screen closes GM:HTML5 entirely. Annoying, especially if you accidentally cause it to appear by clicking the "Create"  icon on the toolbar.

Abusing forum power since 1986.

Offline

## #12 2011-09-22 18:42:56

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Bizarre omission: Game Information

I only use it in every project, no big deal. Game Information is an easy way to provide the user with important information. YoYo has decided to make this much more difficult. It is also good place to jot down a TODO list. A dummy script can serve this secondary purpose but with significantly reduced formatting capability.

The GML function show_info() still exists and works for Windows projects almost correctly (the panel is not displayed with the correct background color). When the information is imported from older GM projects it is preserved within the new GMX file format. There appears to be no way to edit this information now. It is not clear if the background color problem is a problem with the function or the resource handling, but I'd guess it is the latter.

EDIT:

That wasn't totally correct. Once imported, the Game Information data is export to a RTF file in the project directory. I do not know if it is possible to set the background color of an RTF document. When I view the file with WordPad the background color does not appear to be set. WordPad doesn't appear to have a way to change it.

Last edited by xot (2011-09-22 20:20:19)

Abusing forum power since 1986.

Offline

## #13 2011-09-22 20:57:52

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

paul23 wrote:

Meh as expected variable_local_* functions no longer work. I've already typed a few times, but that's really a lackluster. No more pass-by-reference or any structure possible.

That is very disappointing. I'm often using an explode script in my projects.

For those wondering why it was expected, it is because of the obfuscation that GM:HTML5 performs on the code it generates. Even if it were possible to somehow divine the obfuscated variable names, it is doubtful the variable manipulation features of GM have been implemented for HTML5.

Abusing forum power since 1986.

Offline

## #14 2011-09-23 00:58:37

icuurd12b42
Member
Registered: 2008-12-11
Posts: 303

### Re: GameMaker:HTML5 - Things that work differently

I hope they add in the select text hit F1 to go to the help file once the fix the help...

Also, raise your hand if anyone here has ever encountered a help file white on dark (damned is the guy who want to print it...)

Anyway, we are not going to win on the color issue.

My big discontent is the Resource compiler crapping out. Absolutely none of my projects could be compile to html5. Even the cheap ass ones.

I guess if you are planning to convert any descent game, you would be bettor of re-writing it anyway. and hit run every 10 minutes to make sure you did not break anything along the way

That collision_line problem, probably all other collision functions that should return the id are affected? I absolutely almost NEVER use that return as a true or false, only a noob does that

Last edited by icuurd12b42 (2011-09-23 01:03:53)

Offline

## #15 2011-09-23 02:11:02

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

My goal tomorrow is to port a game to HTML5 and post it. I hope to learn a lot about what does and does not work. My other goal is to test some of these supposed alterations, such as the collision functions.

So far my project compatibility has been exceedingly low. It took me 16 tries to find an old project that ran in the browser without changes. It turned up some HTML5 runner bugs in the process. With one exception, everything else would freeze after filling the loading bar. The exception loaded and ran, but it didn't work correctly.

EDIT:

I tested the collision_* functions and all of them return a Boolean instead of an id. This would break almost anything I've made. I've encountered several other bugs that are not worth working around. I'll port a game during the coming week with any luck.

Last edited by xot (2011-09-25 01:03:29)

Abusing forum power since 1986.

Offline

## #16 2011-09-23 06:34:01

paul23
Member
Registered: 2007-10-17
Posts: 110

### Re: GameMaker:HTML5 - Things that work differently

Freezing can be a case of using wrong "code format". IE draw codes during step events. Using the variable_*_get() simply always returns an "empty string" it seems through testing. Doesn't crash the game. But even if you setted the variable by variable_*_set() it still doesn't work.
Furthermore, blend modes don't work, d3d_transformations don't work.

For the time being (at least untill they "fix" the variable-issue) I can't port anything yet.

Offline

## #17 2011-09-23 12:52:06

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

According to Mike Dailly's reply to a bug report, there's been an internal change to the way instances are enumerated.

Mike Dailly wrote:

This is not a bug. Instance numbers have now changed to instance constants! The instance constant is not "inst_XXXXX" so to get that in your script you do this:

myinst = inst_XXXXXX;

So basically, they are no longer just "numbers".

Not sure how this would ever effect me, but it might be a problem for people who use or manipulate literal instance ids.

Abusing forum power since 1986.

Offline

## #18 2011-09-23 15:08:46

paul23
Member
Registered: 2007-10-17
Posts: 110

### Re: GameMaker:HTML5 - Things that work differently

Just noticed another thing: keyboard_wait() seemed to be not working...

As well as pop-up menus are only half working: they cancel the gameplay, however if you tab-out of the game the game continues to run again.

Ow and firebug is giving me a shitload of errors about undefined variables & array out of bounds. *gains a headache trying to understand the obfuscated code*.

Offline

## #19 2011-09-23 17:45:26

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

GMC member JacksonYarr posted a mini-tutorial about making Javascripts extensions. I believe YoYo will be posting something more in-depth next week.

http://gmc.yoyogames.com/index.php?showtopic=520070

Abusing forum power since 1986.

Offline

## #20 2011-09-23 18:06:27

xot
Registered: 2007-08-18
Posts: 1,201

### Re: GameMaker:HTML5 - Things that work differently

Mike Dailly posted some brief instructions for configuring GM:HTML5's web server to accept requests from external devices such as a mobile phone or tablet.

http://gmc.yoyogames.com/index.php?show … &p=3835434

Abusing forum power since 1986.

Offline