Development Servers question

Jihl

Member
Hey there!

I need to make a mobile app, it has to communicate with a server in real time and I need this server to be online with a Google VPS virtual machine. Someone in the forum told me that, to run a GM's game executable (the server would be a desktop executable) you need a video card.

So the question is: do anyone know if there are any well-known servers that can execute the game so I can have the server running and communicating with the app?
Otherwise I'm guessing that I should just ask to the VPS distributor about their virtual machines... But something tells me that I shouldn't even bother... since the application is so simple and not-demanding

Thanks!
 

The-any-Key

Member
I know someone made a game maker game run on a VM, but I don't know how they managed that. I tested a bunch of host providers like google, amazon, digital ocean, papercloud... and all refused to run as they lack a real GPU. But I might have missed something.

But if you want a server you can always create one in nodejs, java... that works as a communication center. This is often the best case anyway as these languages are way faster compared to GM. Ex nodejs is event based while GM is frame based that makes the ping for GM at least 30ms and nodejs can give you way less ping (as you want a real time server go as fast as possible). Also you will need a middle man server to allow bypassing firewalls and symmetrical nats (as you plan using the mobile platform I guess you want people to play via their cellproviders network that use heavy network protection).
 

Jihl

Member
Hey, thanks for you feedback.
The fastness in which the servers runs isn't really that important, since it is an "job application" where you see a calendar, offer and take turns. If it takes 1 second for them to see eachother's actions it is absolutely no problem.
I was thinking about all the things that needs to be done in order to communicate the android app with the server. But I've noticed that it would be just like hosting a game, it needs to have the ports opened, the public IP address and let the game communicate through the firewall. So... I hope that the transaction system works independently so that way I can manage to do the application with game maker fairly easy!
 

Jihl

Member
But I might have missed something.
That was what I was thinking too, I'm not sure if you are in the same position but my "game" will be a real simple aplication with almost no animations and other things whatsoever, so that GPU is something that an integrated graphics card can do with no problems.

But there goes another question, perhaps those servers don't have any kind of GPU, perhaps they are made ONLY for transmitting data and that would make them unable to run this very simple game.

I personally chose to not bother with those servers for now, I will try to reach some VPS with GPU
 

The-any-Key

Member
will be a real simple aplication with almost no animations and other things whatsoever, so that GPU is something that an integrated graphics card can do with no problems.
I tested with an empty app with one room, one object and no sprites. And the app still wont run. So no graphics and no animations has little to no effect if the app will launch on a VPS.
 
Why does the game need to be on Google's VPS? Can you use Google Firebase for multiplayer? Or set up some simple PHP scripts on a server to talk to a database to manage communication?
 

DukeSoft

Member
I think you mean running "headless" GM instances on a linux server environment - not specifically Google.

You do not need a videocard for that, but you do need a "virtual frame buffer". Since they don't have a real GPU, actual drawing operations are terribly inefficient and slow, so you will need to disable that.

I've managed to get GM instances to run on Windows VPS's by installing DirectX and disabling drawing events. It runs > 3000fps if you don't do any drawing. With drawing it drops to 20 fps. Here's some of my experience with that: https://forum.yoyogames.com/index.php?threads/running-gm-on-a-windows-server-2016-machine.27576/

In regards to hosting GM servers on Linux - that works good too, as long as you disable any drawing events, and you will need a virtual frame buffer - there is no real framebuffer / display available because you're not running a windowmanager - thats where your errors are coming from.
Luckily Ubuntu comes with some nice packages to solve this issue;

Here's the packages I install on an empty Ubuntu 18.04 Server VPS: xvfb xorg openbox libopenal1

Example:
Code:
sudo apt-get install xvfb xorg openbox libopenal1
And put this in a "runserver.sh" script (opens a display if its not there and runs the game on it):
Code:
#!/bin/bash
export DISPLAY=:10
if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
    echo "Display $DISPLAY is up and running"
else
    echo "Cant connect to display $DISPLAY"
    Xcfb :10 -ac -screen 0 1024x768x24 &
    sleep 3
    if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
        echo "Display $DISPLAY is up and running"
    else
        echo "Could not spawn display!"
        exit 1
    fi
fi

#Now run your executable game on the background
./gamefile -noaudio &
You might want to add some more flags in your own code (i use -dedicated) to not load sprites / textures, and disable all drawing events:
Code:
draw_enable_drawevent(false);
                application_surface_draw_enable(false);
                draw_texture_flush();
If you get high CPU usage on Ubuntu / Linux builds, you might want to use this extension as well: https://forum.yoyogames.com/index.php?threads/cpu-mercy-lower-cpu-usage-100-to-10.57293/


I actually use this way to run multiple dedicated servers on multiple ports on Amazon EC2 instances :)

If you need help, please ask in this topic so it can help others as well.
 
Last edited:

Homunculus

Member
Hey, thanks for you feedback.
The fastness in which the servers runs isn't really that important, since it is an "job application" where you see a calendar, offer and take turns. If it takes 1 second for them to see eachother's actions it is absolutely no problem.
Are you sure that in this scenario a "simple" web server running a PHP or whatever WEB API wouldn't be enough to accomodate your needs? It's definitely cheaper and easier on the server side, as long as you don't need some real time features that go way beyond what the HTTP protocol is capable of.
 

The-any-Key

Member
I think you mean running "headless" GM instances on a linux server environment - not specifically Google.

You do not need a videocard for that, but you do need a "virtual frame buffer". Since they don't have a real GPU, actual drawing operations are terribly inefficient and slow, so you will need to disable that.

I've managed to get GM instances to run on Windows VPS's by installing DirectX and disabling drawing events. It runs > 3000fps if you don't do any drawing. With drawing it drops to 20 fps. Here's some of my experience with that: https://forum.yoyogames.com/index.php?threads/running-gm-on-a-windows-server-2016-machine.27576/

In regards to hosting GM servers on Linux - that works good too, as long as you disable any drawing events, and you will need a virtual frame buffer - there is no real framebuffer / display available because you're not running a windowmanager - thats where your errors are coming from.
Luckily Ubuntu comes with some nice packages to solve this issue;

Here's the packages I install on an empty Ubuntu 18.04 Server VPS: xvfb xorg openbox libopenal1

Example:
Code:
sudo apt-get install xvfb xorg openbox libopenal1
And put this in a "runserver.sh" script (opens a display if its not there and runs the game on it):
Code:
#!/bin/bash
export DISPLAY=:10
if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
    echo "Display $DISPLAY is up and running"
else
    echo "Cant connect to display $DISPLAY"
    Xcfb :10 -ac -screen 0 1024x768x24 &
    sleep 3
    if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
        echo "Display $DISPLAY is up and running"
    else
        echo "Could not spawn display!"
        exit 1
    fi
fi

#Now run your executable game on the background
./gamefile -noaudio &
You might want to add some more flags in your own code (i use -dedicated) to not load sprites / textures, and disable all drawing events:
Code:
draw_enable_drawevent(false);
                application_surface_draw_enable(false);
                draw_texture_flush();
If you get high CPU usage on Ubuntu / Linux builds, you might want to use this extension as well: https://forum.yoyogames.com/index.php?threads/cpu-mercy-lower-cpu-usage-100-to-10.57293/


I actually use this way to run multiple dedicated servers on multiple ports on Amazon EC2 instances :)

If you need help, please ask in this topic so it can help others as well.
Glad to hear that someone got this working. Will use this in the future :)
 
I think you mean running "headless" GM instances on a linux server environment - not specifically Google.

You do not need a videocard for that, but you do need a "virtual frame buffer". Since they don't have a real GPU, actual drawing operations are terribly inefficient and slow, so you will need to disable that.

I've managed to get GM instances to run on Windows VPS's by installing DirectX and disabling drawing events. It runs > 3000fps if you don't do any drawing. With drawing it drops to 20 fps. Here's some of my experience with that: https://forum.yoyogames.com/index.php?threads/running-gm-on-a-windows-server-2016-machine.27576/

In regards to hosting GM servers on Linux - that works good too, as long as you disable any drawing events, and you will need a virtual frame buffer - there is no real framebuffer / display available because you're not running a windowmanager - thats where your errors are coming from.
Luckily Ubuntu comes with some nice packages to solve this issue;

Here's the packages I install on an empty Ubuntu 18.04 Server VPS: xvfb xorg openbox libopenal1

Example:
Code:
sudo apt-get install xvfb xorg openbox libopenal1
And put this in a "runserver.sh" script (opens a display if its not there and runs the game on it):
Code:
#!/bin/bash
export DISPLAY=:10
if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
    echo "Display $DISPLAY is up and running"
else
    echo "Cant connect to display $DISPLAY"
    Xcfb :10 -ac -screen 0 1024x768x24 &
    sleep 3
    if xdpyinfo -display "$DISPLAY" > /dev/null 2>&1; then
        echo "Display $DISPLAY is up and running"
    else
        echo "Could not spawn display!"
        exit 1
    fi
fi

#Now run your executable game on the background
./gamefile -noaudio &
You might want to add some more flags in your own code (i use -dedicated) to not load sprites / textures, and disable all drawing events:
Code:
draw_enable_drawevent(false);
                application_surface_draw_enable(false);
                draw_texture_flush();
If you get high CPU usage on Ubuntu / Linux builds, you might want to use this extension as well: https://forum.yoyogames.com/index.php?threads/cpu-mercy-lower-cpu-usage-100-to-10.57293/


I actually use this way to run multiple dedicated servers on multiple ports on Amazon EC2 instances :)

If you need help, please ask in this topic so it can help others as well.

Hey @DukeSoft I wanted to know how far you managed to get in terms of research with this regarding running a GM2 server on Linux with no Window/graphics?

My main questions are:
1. Does it use up a ton of resources? Is it actually capable of running as a dedicated server? How many instances would you say it could hold on your average AWS free-tier Ubuntu instance?
2. I noticed you made your own CPU asset to use less CPU, is this still required would you say in 2020?

Thank you!
 

DukeSoft

Member
Hey @GhostlyImprints :)

So far I've actually been running GMS2 executables on AWS. I've rented a light EC2 machine and I seemed to be able to run 3 game instances on there (with multiple bots, so a lot of pathfinding and all), while each process stayed under 10% CPU usage - this way the CPU credits were increasing so I'd never have to pay more.

I haven't followed GMS2 development for a while so I'm not sure how far YYG improved the buggy Ubuntu builds - but its an easy check (Ubuntu build with empty room has 100% CPU usage -> not fixed)

If by free tier you mean the Lightsail instances, I've not yet managed to run a GMS2 server on there and keep the costs low (you pay for CPU usage, and my game was pretty heavy).

I did use the lightsail instance for another game, but that server was written in NodeJS.
 
Top