• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion GMS2 as a website editor?

S

Storyteller

Guest
Im looking at using GMS2 to basically build, display and run a website or two.
While this is certainly possible, consider older 'flash' based websites where the HTML just loaded a swf and everything was done internally to that, I'd like to discuss, get pointers and address pitfalls to this method.

Has anyone done this?
What are the key functions used to integrate buttons, scripts and APIs from outside of the HTML runner to content within it?
What methods are used to interface with an SQL database or websockets, like for logins and chat boxes?

While this is broad, I'd like to get a handle on it and develop some best practices.
 
S

Storyteller

Guest
This is not a good idea, you're gonna have zero accessibility and SEO on your site if its all built in gms
Ok, thats a great caveat to bring up, but accepting that and moving forward, let's talk about ease of use, building the site visually in GMS2 and intergration to the rest of the site.
To address SEO, you can fill in with metadata and a fallback site for text only browsers and similar limitations. Can you think of ways to address accessibility within a GMS2 webgame or app?

again, if one accepts those things, what are some other considerations for a project like this? Im also looking at games in GMS2 that integrate external buttons and databases or login screens. The rules of thumb here for a website built in GMS2 will be immediately applicable to 'regular old html5 games'
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Same as with Flash websites, if you can, it doesn't mean you should - I'm sure that most people do not miss not being able to do basic actions like selecting text or opening an image in a new tab just because the website author decided to get fancy.

To add here, the reason Flash initially had some popularity was because browser support was limited and it was hard to do even remotely fancy effects in HTML+CSS+JS. Nowadays, however, you can do a lot - from standardized video support to tweening to keyframe animations to even things like 2d/3d transformations of elements.

Unless your website is a literal videogame, there's very little reason to use a game engine.
 
S

Storyteller

Guest
Unless your website is a literal videogame, there's very little reason to use a game engine.
That's kinda the point, a game integrated to a website. For instance, having different parts of the game on different pages with different modes.
Like a browser based town building strategy game. You might have different villages with different things built, battle screens, overall site management, a chat box on every screen, a built in forum or trading system between players, etc. the difference between a 'website element or menu' and a 'game element or object' is blurred and negligible.

now I get people's opinion is that its a 'bad idea', but thats not really what Im asking. Great idea or not, how can it be made to work?
 

Dmi7ry

Member
You can't embed something into your game (not 100% true, see surface_create_ext() as example), but you can embed the game into your web page. Then connect them via an extension (JS).
So, show your game "in background" and place other frames (chat, etc) over it.
 
Last edited:
J

jcop

Guest
I've done this to create interactive animated header logos for websites and it works nicely. You can use javascript to communicate in and out of the GameMaker "game" on the web page to pass anything you want. I didn't use it to create the entire site but the same principles apply.
 
S

Storyteller

Guest
so given the above answers have been considered, I'll ask again:

What are the key functions used to integrate buttons, scripts and APIs from outside of the HTML runner to content within it?

What methods are used to interface with an SQL database or websockets, like for logins and chat boxes?
 

FrostyCat

Redemption Seeker
What are the key functions used to integrate buttons, scripts and APIs from outside of the HTML runner to content within it?
The extensions mechanism and the option for swapping out index.html under the HTML5 tab in Global Game Settings.

What methods are used to interface with an SQL database or websockets, like for logins and chat boxes?
Client-side JS NEVER interacts directly with an SQL database, it is always done through requests to a server-side interface. This is usually done through HTTP using http_request() on the GMS side and any web programming language or framework (e.g. PHP, Node, Rails) on the server side.

Chat boxes and other real-time features are typically done with WebSockets in client-side JS, which you can access with extensions. I have made one myself. Some cloud vendors for chat boxes allow iframe embeds, in which case the only thing you'd care about is simply inserting the element.
 
S

Storyteller

Guest
The extensions mechanism and the option for swapping out index.html under the HTML5 tab in Global Game Settings.


Client-side JS NEVER interacts directly with an SQL database, it is always done through requests to a server-side interface. This is usually done through HTTP using http_request() on the GMS side and any web programming language or framework (e.g. PHP, Node, Rails) on the server side.

Chat boxes and other real-time features are typically done with WebSockets in client-side JS, which you can access with extensions. I have made one myself. Some cloud vendors for chat boxes allow iframe embeds, in which case the only thing you'd care about is simply inserting the element.
Those seem like great answers, that went right over my head.
Like, what does swapping out index.html in the game settings have to do with changing a page with GM?
Do I really need an extension to make a series of 'pages', which are really just GUIs in GM and display them?
Do I need an extension to control (send a signal) from an HTML menu outside of the runner to switch a page inside the runner?

I get that JS doesnt talk to SQL. You mentioned http_request(), is this the core GML function needed to make GM talk to webpages?
Hey, Websockets seem really cool! does GML have functions to use them?

You seem really smart and capable Frosty, and clearly you are accomplished, but your answer just raised a lot more questions and didnt really point to the GML functions, or parts of the manual one would need to read. You make it seem like you would have to 'write an extension' to do much of anything in GM, which defeats the purpose of using GM to do much of anything. Im more confused now than when I started. Again, you seem really smart, but your answer was too good, maybe if I was better at GML/GM they might have made sense, as is I haven't the foggiest idea what you are talking about. I just wanted to make some screens in a <canvas> on a webpage so I could use GM's features and code to build some little websites and website pieces.
 
T

T-bond

Guest
Just don't even think about it.
It is the WORST idea I have ever heard. (And I heard a lot)
GMS for making games (and programs). Not for making websites.
If you want to make one, you have to learn HTML, PHP (etc.)
I have been developing websites for years, and I have a game made with GMS on Steam, and mobiles, I know what am I talking about, and what these tools are for.

You would loose responsiveness, and everything which is a browser for.
If you don't even know GML you are just way under the floor than you think.
Don't even try to make a complete website in GMS.
You would have much more harder time, than learning a web language, than doing this.
And in the end you would just throw it away. Waste of time.

,,DON’T USE A HAMMER WHEN YOU NEED A SCREWDRIVER"
 
Last edited by a moderator:
S

Storyteller

Guest
Just don't even think about it.
It is the WORST idea I have ever heard. (And I heard a lot)
GMS for making games (and programs). Not for making websites.
If you want to make one, you have to learn HTML, PHP (etc.)
I have been developing websites for years, and I have a game made with GMS on Steam, and mobiles, I know what am I talking about, and what these tools are for.

You would loose responsiveness, and everything which is a browser for.
If you don't even know GML you are just way under the floor than you think.
Don't even try to make a complete website in GMS.
You would have much more harder time, than learning a web language, than doing this.
And in the end you would just throw it away. Waste of time.

,,DON’T USE A HAMMER WHEN YOU NEED A SCREWDRIVER"
this is not an answer to a question I asked and is off topic.

I did not ask 'should I make a website in GMS2', I asked 'how to make a website in GMS2'

consider the questions 'should we colonize mars?' versus ''how do I build a ship that will get there?'

these are different questions and you have derailed my topic. If you dont have an answer, kindly do not disrupt the conversation. I believe one of the core developers once made an emulator for a vintage computer (one I owned I might add) and was successful. The notion of building an entire computer emulator must be preposterous to perform in GML, yet it was done. Had he listened to this kind of commentary, he might never have demonstrated the power and flexibility of GML or its new (at the time) engine.

Really, Im just looking for a few links to the basics in the manual and maybe some advice on setting up menu screens and displaying text.
For the record, to repeat myself, thousands upon thousands of websites were built completely inside of Flash, a plugin designed for basic animation on the web, that was never intended for advanced projects like games. Yet thousands of complete websites and games were built in flash, which in turn helped shaped the web we know today.

Also, why would you prevent Yoyo from reaching other markets and making more money?

So in short, I find your answer to be off-topic and disruptive. I didnt ask for our opinion on if I should, I asked about how to make a 'website like menu and text display system that leverages GMS2's power, flexibility and toolset and integrate that to some external web page elements like buttons or sql access scripts'. (that one Frosty I get, I used PHP as a go between on a chatbox and forum in flash and a login in unity)

Now can anyone actually help?
 

FrostyCat

Redemption Seeker
Like, what does swapping out index.html in the game settings have to do with changing a page with GM?
It allows you to customize what belongs in the space that's normally blank outside the main game canvas. Normally this is done by exporting once, bringing the resulting index.html back in as an Included File, setting it as the index.html in GGS and then editing that included copy.

Do I really need an extension to make a series of 'pages', which are really just GUIs in GM and display them?
If you're just building GUIs and screens in GM, then just use objects and rooms within GM. For a game that just needs somewhere to sit, having it as a single-page application isn't a problem.

Do I need an extension to control (send a signal) from an HTML menu outside of the runner to switch a page inside the runner?
If you want simple buttons outside the main canvas, use clickables or edit them into the index.html. It probably won't be responsive if you do it with clickables, though.

I get that JS doesnt talk to SQL. You mentioned http_request(), is this the core GML function needed to make GM talk to webpages?
http_request() is the main way for GML to make requests to server-side HTTP-based APIs, not other client-side elements on the page.

HTML5, CSS, browser-side JavaScript, and the HTML5 export on GMS are examples of client-side technologies. PHP, Node.js and Rails are examples of server-side technologies. So stop thinking of "talking to webpages" as a singular skill or category. You do not talk to client-side elements the same way you talk to server-side elements, and you need to know which side you are dealing with before making a move.

Hey, Websockets seem really cool! does GML have functions to use them?
WebSockets isn't built into GML, but I've written an extension that provides a GML interface of my own to it. A link to it is in my previous post.

You seem really smart and capable Frosty, and clearly you are accomplished, but your answer just raised a lot more questions and didnt really point to the GML functions, or parts of the manual one would need to read. You make it seem like you would have to 'write an extension' to do much of anything in GM, which defeats the purpose of using GM to do much of anything. Im more confused now than when I started. Again, you seem really smart, but your answer was too good, maybe if I was better at GML/GM they might have made sense, as is I haven't the foggiest idea what you are talking about. I just wanted to make some screens in a <canvas> on a webpage so I could use GM's features and code to build some little websites and website pieces.
I really don't know what to make of this statement from you. On one hand you seem to be reassuring me that it's still a cordial conversation, and on the other hand you seem to be accusing me of obfuscating the information on purpose. I'm not, I'm being straight with you as to what's involved.

You're going to need to write and use extensions a lot because you insisted on interacting with a lot of things outside the main canvas. That's mediated through JS, not GML. If you're willing to bring them into the canvas, you don't need anything that isn't already standard GML, just do buttons and text the same way you would in an otherwise native project. If you need them outside the canvas, look up clickables or learn some basic HTML5 and JS to edit the index.html. Scripts starting with gmcallback_ remain unobfuscated and can be called from external JS on the same page.

For interactions with server-side resources, http_request() and Websockets (which my extension can access) are the main entry points from GML. If you then decide to write your own API, learn a web programming language or framework like PHP, Node.js or Rails. If you decide to integrate with an existing API, read its documentation and work out what requests it accepts.

Everyone who has worked out the HTML5 export has at least a basic web development background. They know what's OK and what's banned on browsers and how to adapt APIs for their own use. You just need to give up this hope of doing it all in GML and start learning what's needed.
 
Last edited:
S

Storyteller

Guest
It allows you to customize what belongs in the space that's normally blank outside the main game canvas. Normally this is done by exporting once, bringing the resulting index.html back in as an Included File, setting it as the index.html in GGS and then editing that included copy.
If you're just building GUIs and screens in GM, then just use objects and rooms within GM. For a game that just needs somewhere to sit, having it as a single-page application isn't a problem.
If you want simple buttons outside the main canvas, use clickables or edit them into the index.html. It probably won't be responsive if you do it with clickables, though.

http_request() is the main way for GML to make requests to server-side HTTP-based APIs, not other client-side elements on the page.

HTML5, CSS, browser-side JavaScript, and the HTML5 export on GMS are examples of client-side technologies. PHP, Node.js and Rails are examples of server-side technologies. So stop thinking of "talking to webpages" as a singular skill or category. You do not talk to client-side elements the same way you talk to server-side elements, and you need to know which side you are dealing with before making a move.
WebSockets isn't built into GML, but I've written an extension that provides a GML interface of my own to it. A link to it is in my previous post.
This is totally what I needed, a set of GML api functions to get me started. I don't mind reading the manual, I just wanted to know what chapter to start with!
I really don't know what to make of this statement from you. On one hand you seem to be reassuring me that it's still a cordial conversation, and on the other hand you seem to be accusing me of obfuscating the information on purpose. I'm not, I'm being straight with you as to what's involved.

You're going to need to write and use extensions a lot because you insisted on interacting with a lot of things outside the main canvas. That's mediated through JS, not GML. If you're willing to bring them into the canvas, you don't need anything that isn't already standard GML, just do buttons and text the same way you would in an otherwise native project. If you need them outside the canvas, look up clickables or learn some basic HTML5 and JS to edit the index.html. Scripts starting with gmcallback_ remain unobfuscated and can be called from external JS on the same page.

For interactions with server-side resources, http_request() and Websockets (which my extension can access) are the main entry points from GML. If you then decide to write your own API, learn a web programming language or framework like PHP, Node.js or Rails. If you decide to integrate with an existing API, read its documentation and work out what requests it accepts.

Everyone who has worked out the HTML5 export has at least a basic web development background. They know what's OK and what's banned on browsers and how to adapt APIs for their own use. You just need to give up this hope of doing it all in GML and start learning what's needed.
I just thought it went way over my head. Like Im trying to figure out how to turn the headlights on and you are talking about wind shear from landing gear being down. No worries!
 
Top