Headless Support for Game Maker: Studio 2

Attachments

zbox

Member
GMC Elder
If we can get a few thousand votes, YYG will give us proper headless support.
citation needed??

there's a whole topic about the size of a small textbook discussing this, this is a bad idea kill it with fire

GM is pointedly an end-user Game product. There are already lots of other, more appropriate, ways to do a server.

IMHO. ;)
 

zbox

Member
GMC Elder
you know what I've actually seen so many petitions (in general, not this specifically) that I don't like or think are bad but don't have an easy way to express my dissatisfaction. I think it's very unfair that you get Change.org to filter and show only positive support

Every time I see one, I look and see if I can buy a domain in the region of "dont-change.org", and create a website in which every time someone creates a petition on change.org, it auto generates an "anti" petition to each one that people can sign. I reckon it would be great, maybe I'll do it one day ;P
 
I'd say that an official open source C# framework -with only the parts of GMS2 needed to interface & make devs life easier like string/math/file/buffer/network functions etc.- to compile a server for use with GMS games would be more useful, than complicating the runner codebase for this
 
I'd say that an official open source C# framework -with only the parts of GMS2 needed to interface & make devs life easier like string/math/file/buffer/network functions etc.- to compile a server for use with GMS games would be more useful, than complicating the runner codebase for this
Because simulating collisions, physics, and everything else would be totally easy in C#.
 
Because simulating collisions, physics, and everything else would be totally easy in C#.
Like I said, it could have anything needed to do that stuff and be ready for compilation. If you're building an online game of that sorts, I'd assume you're somewhat versed with programming, and C# is rather easy to work with
 
Like I said, it could have anything needed to do that stuff and be ready for compilation. If you're building an online game of that sorts, I'd assume you're somewhat versed with programming, and C# is rather easy to work with
This is true but since Game Maker is meant as an all-in-one solution, it would only benefit us to have this feature as well. :)
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Because simulating collisions, physics, and everything else would be totally easy in C#.
Because writing server software in a single-threaded dynamic language without compile-time checks and exception handling is a good idea. Seriously, I applaud the enthusiasm.

Late last year I was hired to port ~10 000 lines worth of GML because someone too thought that it's a good idea, only to realize half of year later that they are screwed.

That said, if your server is ridiculously small or you absolutely desire self-harm, it is of no trouble to run GameMaker-Ubuntu applications on headless Linux servers (e.g. DigitalOcean units) - you only need to install dependencies and set up a fake screen driver so that GLUT is not upset about not being able to open a X11 window before you disable drawing permanently.
 

slojanko

Member
What other benefits does headless support have besides not having a UI? What's the difference between me minimizing my program and having headless support?
 
Because writing server software in a single-threaded dynamic language without compile-time checks and exception handling is a good idea. Seriously, I applaud the enthusiasm.

Late last year I was hired to port ~10 000 lines worth of GML because someone too thought that it's a good idea, only to realize half of year later that they are screwed.

That said, if your server is ridiculously small or you absolutely desire self-harm, it is of no trouble to run GameMaker-Ubuntu applications on headless Linux servers (e.g. DigitalOcean units) - you only need to install dependencies and set up a fake screen driver so that GLUT is not upset about not being able to open a X11 window before you disable drawing permanently.
I spoke to someone about doing this but didn't have confirmation as to whether or not it worked. Still though, wouldn't it be nice just to add a "-headless" and have the executable run headless on Windows? Can't say that wouldn't be nice. I'm not writing a massive MMO or anything crazy and most people shouldn't do such a thing in GM. But even for a small server, it would be nice to have the option.
 
T

ThunkGames

Guest
single-threaded
@Seabass (The Human) I forgot to mention this bit to you when I replied to your blog post about GM:S servers. Multithreading is imperative when deigning a half decent server. For your sake I am begging you not to use GM for your server (spoken as someone who used to use GM for servers). Using GM for your back-end is, to me, akin to using GM to build a AAA 3D game: while much of the underlying technologies are there, GM is an entirely inappropriate tool.

Edit:
I made a framework for communication between GM/Java clients and a Java server if you are interested in it.
 
@Seabass (The Human) I forgot to mention this bit to you when I replied to your blog post about GM:S servers. Multithreading is imperative when deigning a half decent server. For your sake I am begging you not to use GM for your server (spoken as someone who used to use GM for servers). Using GM for your back-end is, to me, akin to using GM to build a AAA 3D game: while much of the underlying technologies are there, GM is an entirely inappropriate tool.

Edit:
I made a framework for communication between GM/Java clients and a Java server if you are interested in it.
I don't disagree with you at all on this matter but the server only needs to support (at most) 64 players. I've tested it with 16 (in my case) and I still have loads of overhead. If I was making something that required a lot, then I would use something else. As of right now, the server updates player positions and a few basic loops run. With YYC I'm sure it'll be ok for my current project.
 

Roa

Member
@Seabass (The Human) I forgot to mention this bit to you when I replied to your blog post about GM:S servers. Multithreading is imperative when deigning a half decent server. For your sake I am begging you not to use GM for your server (spoken as someone who used to use GM for servers). Using GM for your back-end is, to me, akin to using GM to build a AAA 3D game: while much of the underlying technologies are there, GM is an entirely inappropriate tool.

Edit:
I made a framework for communication between GM/Java clients and a Java server if you are interested in it.
Gamemaker is multi threaded, you just don't have control over how its split up, and its split up well enough for general use. If you have the CPU time to run the game with other clients in general, then the server is also in the ability to run those clients data. There isnt some massive over head on a server if its just going to be a few packets and an exact copy of the game mechanics and world, the only change being authoritative measures. If you don't worry about drawing time and passing graphics, you actually have more CPU time than the clients, so idk what the issue is. Aside from that, its not even hard to make multiple servers that run dependently and just add load balancing features.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Still though, wouldn't it be nice just to add a "-headless" and have the executable run headless on Windows? Can't say that wouldn't be nice.
If you do
Code:
draw_enable_drawevent(false);
on game start, DirectX will not be initialized, and no window will appear. If no sound assets are added to the project, OpenAL will not be initialized either, leaving it "headless" by your definition.
 
If you do
Code:
draw_enable_drawevent(false);
on game start, DirectX will not be initialized, and no window will appear. If no sound assets are added to the project, OpenAL will not be initialized either, leaving it "headless" by your definition.
As long as it can run on a Window Server without a GPU, then I'd be more than satisfied.
 
T

ThunkGames

Guest
Gamemaker is multi threaded, you just don't have control over how its split up, and its split up well enough for general use. If you have the CPU time to run the game with other clients in general, then the server is also in the ability to run those clients data. There isnt some massive over head on a server if its just going to be a few packets and an exact copy of the game mechanics and world, the only change being authoritative measures. If you don't worry about drawing time and passing graphics, you actually have more CPU time than the clients, so idk what the issue is. Aside from that, its not even hard to make multiple servers that run dependently and just add load balancing features.
I misspoke. I realize that Gamemaker is multi-threaded automatically, but I mean support for concurrency (which you can control).
 
K

Kenjiro

Guest
Yes! Signed. This would be awesome!

If you do
Code:
draw_enable_drawevent(false);
on game start, DirectX will not be initialized, and no window will appear. If no sound assets are added to the project, OpenAL will not be initialized either, leaving it "headless" by your definition.
This information is false.

Yes, no window will appear. But DX will still be initialized, ready, and waiting.

You can test this yourself

Game Start - draw_enable_drawevent(false);
Create - show_debug_message("Window device: " +string(window_device()));
show_debug_message("Window handle: " +string(window_handle()));

InitGraphics()
Finished PrepareGame()
Run_Start
Window device: 0733BBC0
Window handle: 00110B36

Total memory used = 296395(0x000485cb) bytes
**********************************.
Entering main loop.
**********************************.
Pause event has been registered for this frame
Pause event has been unregistered
This would return 0 if there was no valid window device. There is even a valid hidden window here also.

draw_enable_drawevent(false) merely disables the drawing of the window. Your project will still crash if you attempt to run it on a machine that has no DX capable graphics device (i.e. a terminal server, etc..).
 
Last edited by a moderator:

Rusky

Member
It shouldn't matter whether GM initializes Direct3D. Even Windows Server supports the API, and you can create a software device on machines with no GPU. The only reason YYG would need to touch anything for this is if they're creating the device in such a way that they prevent D3D from using that fallback.

Whether GM is a great fit for a server is another question ;)
 
K

Kenjiro

Guest
It shouldn't matter whether GM initializes Direct3D. Even Windows Server supports the API, and you can create a software device on machines with no GPU. The only reason YYG would need to touch anything for this is if they're creating the device in such a way that they prevent D3D from using that fallback.

Whether GM is a great fit for a server is another question ;)
DirectX doesn't have a software device, out of the box. To use the 'software device' you have to write the implementation yourself and hook that into DirectX.

Maybe you are thinking of the 'Ref' device, which does everything in software. But, you can't use this in Release mode.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb219625(v=vs.85).aspx

Essentially, it is hardware accelerated or nothing.
 

Rusky

Member
DirectX doesn't have a software device, out of the box. To use the 'software device' you have to write the implementation yourself and hook that into DirectX.

Maybe you are thinking of the 'Ref' device, which does everything in software. But, you can't use this in Release mode.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb219625(v=vs.85).aspx

Essentially, it is hardware accelerated or nothing.
DirectX does have a software device out of the box, which works in release mode and can even be force-enabled on existing binaries: https://msdn.microsoft.com/en-us/library/windows/desktop/gg615082(v=vs.85).aspx
 
K

Kenjiro

Guest
Ah, right you are. I was stuck in the DX9 mindset. Totally forgot about WARP.

Well yeah, if WARP fallback was (is?) enabled then there shouldn't really be an issue.

I might do a test on a terminal server and see what happens. Will keep you posted.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
Is there a time limit? It's not looking good for headless support

So if you can call it from the command line with parameters, can Gamemaker spit output back out to the command line?
IIRC show_debug_message outputs into the command line. If not, making a DLL for that is trivial.
 

andev

Member
I have written a GML "library" in python, that includes ds_lists, ds_maps, buffers, networking and instance scripts using exactly the same syntax as in game maker. I am in the process of testing it at the moment, but so far it can successfully communicate with game maker on a digitalocean linux server (so it will run on any VPS). I am going to do a public stress test soon with it, and if all goes well I will publish the full sourcecode and documentation to go with it here.

That might be of interest to anyone reading this topic and feeling their heart sink lower and lower with every post :)
 
T

ThunkGames

Guest
I have written a GML "library" in python, that includes ds_lists, ds_maps, buffers, networking and instance scripts using exactly the same syntax as in game maker. I am in the process of testing it at the moment, but so far it can successfully communicate with game maker on a digitalocean linux server (so it will run on any VPS). I am going to do a public stress test soon with it, and if all goes well I will publish the full sourcecode and documentation to go with it here.

That might be of interest to anyone reading this topic and feeling their heart sink lower and lower with every post :)
That's really freaking cool! I've always been forced to do GM server stuff with Node or Java (for VPS reasons), but this seems intriguing. Is it legal though? I guess @YellowAfterlife made this, so it probably is.
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
That's really freaking cool! I've always been forced to do GM server stuff with Node or Java (for VPS reasons), but this seems intriguing. Is it legal though? I guess @YellowAfterlife made this, so it probably is.
It is not illegal to mimic APIs, as such people have made multiple attempts of such things (with varying accuracy - there's a lot that's hidden from the plain eye).

GMLive in particular does not mirror APIs, however - it has a custom GML[-like]->JS compiler that generates sets of functions that can call the built-in GML functions much like the code generated by GM itself does. That has it that on average code works exactly the same as it does when written and compiled to HTML5 in GMS itself.
 

andev

Member
Well if it was illegal (or at least frowned upon), I could tweak it so instead of ds_map_*, it could be like pm_* for python map or something. (typing ds_map_* is tedious anyway!)
 

Spasman

Member
Sorry for the bump, but I've also wanted this feature but I found something with hosting GM apps on a Windows virtual environment. I hope it helps someone.

I managed to get GM games to run a virtual Windows environment, however you need to make sure the VPS can support 3d acceleration, or your VMWare instance has it enabled. This feature will simulate a GPU through the server's CPU, however 1 GM instance can eat your entire CPU if it has a display. I resolved this by adding a "minimalism" server mode to my game, where the game will run in a room with a 1x1 room size, and undraw absolutely everything. My game with 16 player support maybe peaked at 5% CPU usage when it was the most demanding. Naturally, the downside to this is you can't see the game but I got around this with logging and implementing RCON features if you need to keep an eye on things.

So while I have found something that works for me and I don't really have a need for the feature as much anymore, I still don't understand why some people are so openly hostile towards this adding this feature. Isn't Game Maker designed to be a tool for convenience? Headless support would make multiplayer games very convenient for developers. It's simple as that to me, efficiency or laziness doesn't really factor in because if you cared deeply about those traits you wouldn't be here. I highly doubt this feature being added will stop you from writing something yourself. Maybe YYG could charge for an headless export? I'd buy it day one, and I'm sure others would too.
 
Top