# GMLscripts.com

Discuss and collaborate on GML scripts

You are not logged in.

## #101 2011-10-04 11:00:15

mike.dailly
Member
Registered: 2011-10-04
Posts: 10

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

Okay... this is a rendering issue with the browsers... but I don't think it's going to go away. I need to rewrite the full-screen part completely.

Offline

## #102 2011-10-06 10:47:32

OMGCarlos
Member
From: Haverhill, MA
Registered: 2011-10-06
Posts: 1
Website

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

Whoa this is a very informative thread! Looks like you covered everything I found. I've found quite a few issues, but have come up with workarounds or ways to take advantage of that:
* Uninitialized variables are not treated as 0. They also don't crash the game, instead they return "undefined". You can take advantage of this by comparing a variable to an undefined variable like "akjshdflajfs" and check if they are equal (ie, both are undefined). If true, then you can insert some initialization code which completely removes the need to have a separate script that initializes variables etc. You can't just do "if foo = 'undefined'" it has to be compared directly with an undefined variable. I wrote an article about it here: http://afoobar.com/gmdn/gamemaker/tuts/ … -existence

* For some reason, the canvas (window) size is limited to the size of the first room. You can shrink it all you want, but if you try to go to a room with a bigger size or change the views to a larger size than the canvas you get really strange results. I discovered a workaround to this which involves creating an empty room with a size of 2000x2000 which loads at run start, then immediately jump into the first "working" room. This prevents the weird canvas resizing quirks. Kinda hard to explain, but I'll write up an article about it soon.

* I've found some quirky behavior with ds_grid and ds_list which happens from time to time even after compiling. Sometimes you'll run the game fine and other times you'll get weird data. I'll try to create a very basic example to see if I can recreate this, and then report it to the bug tracker.

* The os_device, os_type, etc commands are definitely buggy. In fact, some of the constants return undefined! It would be nice if someone can find the numerical values for the constants instead of being forced to use something like "if os_browser = browser_firefox" for example and just do "if os_browser = 2", which to me at least, makes more sense.

* Just a random rant: What's up with the camel case and prepending some commands with YoYo_ - that's a little too much lol. And I hope they are kidding about taking out the "import/export" script functionality because A) not everyone will collaborate on a project, and B ) that would make it extremely difficult to import old scripts from previous version of GM that I still use. Especially groups of scripts which contain dozens of scripts!

Anyways, I'll post whatever I find here. This is an awesome list!

Last edited by OMGCarlos (2011-10-06 10:55:30)

Offline

## #103 2011-10-06 11:44:14

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

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

Welcome to the forums, OMGCarlos, and thank you for posting what you've found. I'm greatly looking forward to seeing GMDN grow!

Regarding import/export of scripts, they are indeed quite serious. I tried to get Russell to see reason, but he seems adamant. On the surface, the new project file system seems like a great idea (in fact, it is). But at the moment script importation is a complete mess. At first I thought I could copy scripts into a project's scripts directory, but that doesn't do anything unless the scripts are already referenced in the project's XML file. That means tediously using "Add Existing Script" from the script resource context menu and importing them one-by-one. At that level of inconvenience, one might as well copy-and-paste code -- it would be easier! Hopefully, multiple file support will be added, as well as remembering where the last scripts was imported from. That would make the feature marginally useful. It wouldn't be hard to make an utility to merge scripts into projects, but this is something GM:HTML5 should do out-of-the-box.

*sigh* I have to keep reminding myself this is beta software.

EDIT:

Russell tells me multiple file support will be coming in a future update.

Last edited by xot (2011-10-06 12:06:55)

Abusing forum power since 1986.

Offline

## #104 2011-10-06 16:30:56

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

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

wow nice that mike has found its way here ..

And really good you fixed the "/" issue, sorry for the incosistent bug report, but it was pretty hard to pin point the bug as I didn't expect it there.

Now I've got to find time again to use GM a bit more to test more, however with unobfuscated code: you should all try firebug it makes debugging (in firefox) of javascripts real neat.. Line by line execution (and pausing/entering of functions) breakpoints and keeping track of all silent errors. What else you need?

I might actually write a "tutorial" at the gmc about this in the weekend, though I'll first check gm's debugger.

Last edited by paul23 (2011-10-06 16:37:01)

Offline

## #105 2011-10-07 04:02:36

BlaXun
Member
Registered: 2011-09-26
Posts: 18

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

I am currently a bit confused by several things:

Will the new GM9 be limited by the LIMITATIONS of all GM Versions.

For example... the HTML5 version doesnt support dlls, doesnt support screen_redraw, ....

...will these Limitations also appear in the GM 9 for Windows edition?

Basicly the Studio Version will only work if you can really export to all systems (Win, iOs, HTML5, ...) ...but for this to work you must consider all functions that ONE of those platforms doesnt support and
then strip these functions from GM.

So, will the Windows Version of GM be influenced by the Limits of the Studio or HTML5 version? Is there anybody who knows bout this?

Offline

## #106 2011-10-11 12:42:55

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

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

Your speculation about GM-Studio is basically correct, and multi-platform limitations will apply to Windows as well. Some limitations are because of the way the engine is being restructured. By limiting the drawing functions to a single predictable event, overall performance can be improved. However, certain flavors of OpenGL require carefully controlled drawing. For instance, iOS doesn't allow drawing until the application is prompted to by an event generated by the OS. Attempting to draw outside of this event will terminate the application.

Abusing forum power since 1986.

Offline

## #107 2011-10-11 12:44:25

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

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

Updates here are going to slow down until I can get my internet service restored.

Abusing forum power since 1986.

Offline

## #108 2011-10-19 06:20:43

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

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

Variable handling has become much more weakly typed.. Even more weak than PHP it seems

var myvar;
myvar = 0;
myvar += " hello"; // now myvar is "0 hello"  a string!
myvar -= 1; //now myvar is NaN - an undefined (though considered a number)
myvar += "1"; //now myvar is "NaN1"

This even works with build in variables:

x = "I'm a string!";

When giving a string as argument for the position drawing will implicitelly fail, no error will occur and just the function will be omitted.

I'm going to love debugging in gamemaker now -.-

Offline

## #109 2011-10-19 11:53:48

mike.dailly
Member
Registered: 2011-10-04
Posts: 10

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

You can't have it both ways.... we can either validate EVERY variable access by going through functions for everything - which is dog slow, or you can go direct to the variables and get code as fast as JavaScript allows, but deal with stuff like this.

Most users would rather have the speed..... at least that's what they're always shouting about.

Offline

## #110 2011-10-19 15:19:59

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

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

mike.dailly wrote:

You can't have it both ways.... we can either validate EVERY variable access by going through functions for everything - which is dog slow, or you can go direct to the variables and get code as fast as JavaScript allows, but deal with stuff like this.

Most users would rather have the speed..... at least that's what they're always shouting about.

In this case? - That's like omitting exceptions & using arrays instead of vectors in C++ ><.

But at least in debug builds I expect these kind of checks

Offline

## #111 2011-10-20 11:25:36

mike.dailly
Member
Registered: 2011-10-04
Posts: 10

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

No it's not.... it's like putting an accessor on every class variable, and disabling inlining.  The slow down would be ridiculous! You lose SO much performance by doing calls all the time, rather than taking the extra time and care to write your code.

We can't check stuff that goes direct to variables, particually as in GML a variable can be "anything". It's typeless, so who are we to say that variable "X" is a number and not a string? Sure the built in ones are, but it may already be a NAN by the time you come to set the built in one and your still going to have to debug it yourself.

But at least you now have a full source level debugger built into most browsers so you CAN find out.

Really... if your coding in script, there's only so much we can do to protect you without crippling it for everyone else.

We have started to put in some "debug" specific code that swaps in extra checks at runtime, but there are well over 1,000 functions so these will take time to expand out.

If I had my way, I'd be forcing you to use "X" for numbers and "X\$" for strings. Basic had it right in my mind.... but we can't do that, mores the pitty.

Last edited by mike.dailly (2011-10-20 11:26:45)

Offline

## #112 2011-10-20 13:45:19

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

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

Hmm well "if you say so" - Once GM:HTML5 has stabilized and I know I have to watch out for these errors (as gamemaker no longer reports those back), you know what to hunt, so it might indeed be not too much trouble.

Anyways, I'm always a bit weary of implicit conversions as they might open the door to a point where 1 == "1" is true. Though as far as I can see conversion only happens implicitelly when used on conjunction with operators, and only from numbers to strings.

Offline

## #113 2011-10-21 14:46:48

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

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

This made me laugh and scratch my head at the same time. I'm exceptionally coordinated.

Mike Dailly wrote:

"image_single" added.............. I hate you all :) #gamemaker #html5

Of course, image_single was deprecated years ago, yet people insist on continuing to use it. I guess they get cranky when it's not available. Silly Luddites.

Abusing forum power since 1986.

Offline

## #114 2011-10-26 13:54:20

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

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

Just a couple of new observations to add today. Many more still need to be added but I just don't have time at the moment to sift through the bug tracker.

GM:HTML5 importer does not support extended ASCII characters. Those are characters with ordinal values greater 127, including characters with accents or other diacritical marks. Such characters will not appear within the imported project and will require manual replacement. GM:HTML5 supports these characters, but it does not currently import them.

In some cases, browsers may not correctly handle the SHIFT key in conjunction with keyboard_string and keyboard_char. Normally, the characters change case depending on whether or not the SHIFT key (or CapsLock) is enabled. Because not all browsers support this correctly, it may be necessary to make text parsers which rely of keyboard_* case-insensitive. Mike Dailly has reported on more than one occassion that keyboard handling for browsers is something of a compatibility nightmare. Apparently, IE9 is the only browser that really handles the keyboard well. Hopefully as HTML5 gains momentum hardware support in general will be improved for all browsers.

UPDATE: It appears the SHIFT key problem was corrected with release 1.0.155. The problem was apparently due to a complication caused by obfuscation.

Last edited by xot (2011-10-31 17:30:53)

Abusing forum power since 1986.

Offline

## #115 2011-10-28 13:09:55

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

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

Current release, 1.0.155, just went live. Some nice new features:

• The original GM8.x icons have now been added back in for when you disable skins.

• Icons can now be redefined for different skins.

• YoYo_OpenURL_ext( url, target) has been added.

• YoYo_OpenURL_full( url, target, options) has been added.

• set_application_title( title ) has been added.

• New audio dialog has been added. You can now set the MP3 bitrate, and the ogg quality. So it will no longer always convert the on running.

• You can now specify a root directory for the web server, as nginx does not allow unicode or utf8 in it's paths.

And over 140 problems addressed since 1.0.145. As usual, release notes can be found here:

Abusing forum power since 1986.

Offline

## #116 2011-11-04 13:02:45

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

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

GM-HTML5 does not fully support importation of Game Maker 5 projects (*.gmd). In particular, it has been observed that sound resources are not referenced correctly during HTML5 compilation. Manually reloading these resources into the project corrects the problem. There appear to be no plans to improve GM5 support.

Abusing forum power since 1986.

Offline

## #117 2011-11-04 17:11:15

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

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

xot wrote:

GM-HTML5 does not fully support importation of Game Maker 5 projects (*.gmd). In particular, it has been observed that sound resources are not referenced correctly during HTML5 compilation. Manually reloading these resources into the project corrects the problem. There appear to be no plans to improve GM5 support.

I'm honestly surprised GM5 is even used nowadays -.-.. Let alone that someone finds a bug here. It uses directdraw, that should indicate the out datedness of gm5.

Offline

## #118 2011-11-07 10:42:00

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

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

I can't blame them for only providing limited support (although the nature of the bug seems like it should be easily surmountable). However, there are people like me who have legacy shareware/freeware created with GM5 out there that they wish to support. Porting these old projects to HTML5 is desirable but not without some important obstacles. Obviously there are many other changes to the GM feature set and GML that need to be addressed when porting, but this audio issue is not normal.

It's an odd bug. The projects appear to import correctly, and they will function with the Windows runner, but the HTML5 linking step fails for some reason. The audio files are converted, but they are replaced with a dummy file during the last step.

Abusing forum power since 1986.

Offline

## #119 2011-11-09 13:54:16

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

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

Version 1.0.170 has been released.

Triggers are supposed to be fully supported now. I personally don't have any experience with them, but it is welcome news.

A new addition is a function called YoYo_GetDomain which is meant to return the URL (or at least the domain) from which a game is served. This can be used to ensure that a game only functions from a specific address, a simple form of network-based DRM. This info can be spoofed, but the check function should prevent casual copying and is probably required by most web portals.

Abusing forum power since 1986.

Offline

## #120 2011-11-12 05:12:10

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

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

Nice to se all major features be implemented now. Now it's probably waiting for better webGL & websocket support before we see big changes.

Hmm wondering now if I should (now that bugs seem to be start to get ironed out) report "annoying" incosistencies in the file format.. Though probably yoyogames doesn't want to get bothered - so I'm posting this here, waiting to be forgotten .

For example: each "resource" section is named after the resource name (in plural):
<objects name = "FOLDERNAME"> , <sounds name = "FOLDERNAME"> - which is also the directory name in which the resources are saved. (FOLDERNAME is the name of the folder in the resource tree).

Apart from extensions: those are positioned under <NewExtensions>.

Also for datafiles, the datafile-resource information is stored inside the main gmk (where all other resource information is always stored external in another file). The format of data-file tags is also very strange to my eyes:
<name>, <filename>, <origname> & <data> - name & filename seem to always be synonyms? & data seems to be simply "datafiles/" and then the filename. Original name seems to be an indication for if the data goes missing it copies from there. - But this seems to not work half the time?

further down the room-attributes I wonder strongly if they have any influence:

<rooms name="rooms" roommaxid="100003" room_maxtileid="10000000">

Offline