• 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!

GameMaker Running a GameMaker server on a Headless machine

brian

Member
GM Version: Studio 2+
Target Platform: Linux
Download: n/a
Links: video below

Summary:
In this tutorial we talk about running a networked server built in GameMaker on headless machines, whether it be on a Raspberry Pi sitting in a drawer or a dedicated Linux server halfway across the world.

 

brian

Member
Great work for the xvfb!
That's a valid solution.
Yeah, it's a tiny bit frustrating because this won't work on *most* VPS solutions, but covers a ton of use-cases outside of that!
xvfb can be a bit of a CPU hog if you don't disable the draw event in your project, but if you ever run into any issues, you can set the VFB to incredible small sizes by launching it with additional parameters like: --server-args="-screen 0 1x1x16"
 

Zhanghua

Member
Yeah, it's a tiny bit frustrating because this won't work on *most* VPS solutions, but covers a ton of use-cases outside of that!
xvfb can be a bit of a CPU hog if you don't disable the draw event in your project, but if you ever run into any issues, you can set the VFB to incredible small sizes by launching it with additional parameters like: --server-args="-screen 0 1x1x16"
Tks for the additional parameters trick.
 

Gatefiz

Member
Hey mate,

I just tried this, but I have an issue.
First, had an error with asound.conf, but I fixed it. Right now, this is:

Segmentation fault (core dumped)


I searched for a solution, and maybe you can help me ?

Thank a lot for your tuto, interesting !
 

brian

Member
Hey mate,

I just tried this, but I have an issue.
First, had an error with asound.conf, but I fixed it. Right now, this is:

Segmentation fault (core dumped)


I searched for a solution, and maybe you can help me ?

Thank a lot for your tuto, interesting !
Hi @Gatefiz ! What platform (CPU type) and linux distro are you running this on?
From what I've found, segmentation faults from GM projects on linux can come from a variety of different places - and it can be frustrating to nail them down, for sure.

One weird suggestion I have right off the bat is installing "libxfont1"
 

mako

Member
@brian,

I'm trying this on a Ubuntu 20.4 Digital Ocean server and I can't get it to work. I can get as far as firing up the "xvfb-run ./myproject" but then it hangs and never gets to the "Entering Main Loop" part.

It's giving me a lot of errors concerning a sound driver called "alsa".

If I intstall xorg, it runs fine, but I don't want a GUI running on this server (it eats resources and doesn't really provide a benefit).

Any thoughts?
 
Last edited:

brian

Member
@brian,

I'm trying this on a Ubuntu 20.4 Digital Ocean server and I can't get it to work. I can get as far as firing up the "xvfb-run ./myproject" but then it hangs and never gets to the "Entering Main Loop" part.

It's giving me a lot of errors concerning a sound driver called "alsa".

If I intstall xorg, it runs fine, but I don't want a GUI running on this server (it eats resources and doesn't really provide a benefit).

Any thoughts?
Hi Mako,

Can you dump the output of what happens after you execute the xvfb-run ./[project] command here? Or on pastebin and link it in?

The first thing I would try is what I found here: https://www.digitalocean.com/commun...em-with-audio-i-o-when-using-headless-firefox

Step 1. Install the package "alsa-base" - this should give you a dummy driver (as well as some legit drivers, haha)
Step 2. Enable the dummy driver by running modprobe snd-dummy

Hopefully that takes care of the issue for you - if not, I'd have to see the output to provide a better answer :)
 

AetherBones

Member
GM Version: Studio 2+
Target Platform: Linux
Download: n/a
Links: video below

Summary:
In this tutorial we talk about running a networked server built in GameMaker on headless machines, whether it be on a Raspberry Pi sitting in a drawer or a dedicated Linux server halfway across the world.

This is amazing I spent an entire night trying to get this to work on not only a pi, but various cloud services. A mear month before you posted this ha ha. Glad to finally have a solution though. Still need to test in the cloud though.
 

AetherBones

Member
So I've been experimenting with this and found one huge benefit (atleast to me) for running headless.

Normally game maker limits your gamespeed to your monitor refresh rate. I use a 120hz monitor so that's the max I can run my games. Even if you set the game speed higher, it will max at your monitor refresh rate. But not headless!
If you run your game with the setting draw_enable_drawevent(false); the max fps seems to be 600. If you set your gamespeed higher it seems to uncap the gamespeed and run at whatever your hardware can handle. For me on the game I was testing this with that happen to juggle around the 1700s.
 
Last edited:

mako

Member
@brian, Sorry for not replying sooner! I wasn't able to get this to work headless, but I was able to get the server running on DigitalOcean using "xorg" to give me a rudimentary GUI display. It's not optimal and I'll figure out the "headless" part one day, but for now, it less me do my development! Thanks so much for the help!
 

AIO1

Member
Bumping this up again.

@brian is there a way trick xvfb to use less resources (like for example emulating a smaller screen?)
 
Top