How to develop a GameMaker game for both desktop and mobile

For a few months I have been creating a game using GameMaker Studio 2 Desktop.

It turns out that I would like to launch it also for cell phones, and for that I bought GameMaker Studio 2 Mobile.

That's when my doubt arises.

In GameMaker Studio 2 Mobile, you have the option to open the projects made in GameMaker Studio 2 Desktop, and its interface is the same as in GameMaker Studio 2 Desktop.

There are 2 shortcuts on my computer:

Two versions of GameMaker

Now I don't know if GameMaker Studio 2 is a new program, or works only as a license that allows me to launch the game on another platform (like a plugin extension).

I remember that in GameMaker Studio 1.4, there was just one version of the editing software, and each version of the game (desktop or mobile) had its own code.

I basically had to copy the game project and edit the copy with its equivalent features.

I remember that one of the adaptations is at the time of clicking on the screen, because on the cell phone you don't use mouse_x or mouse_y.

What I would like to know is if I will need to adapt the code for this mobile version or, when exporting the game for the mobile platform, will the code be adapted automatically?

Before coming here I looked for solutions in these links:


https://www.reddit.com/r/gamemaker/comments/dgmkld
https://www.reddit.com/r/gamemaker/comments/5mn0p5
https://www.reddit.com/r/gamemaker/comments/5g2ej2
At one point I realized that maybe I was using the wrong term in the search, because the results I was finding revealed different things than what I was looking for: stuff about whether desktop and mobile players can play together, which is not useful for me since the game I am producing is not online.
 

curato

Member
It really depends on the game, but I did two titles for android that basically were just touching tiles on the screen and I didn't have to change anything the mouse click events work just find on the mobile and desktop. I am sure a lot of the touch screen specific things would both ways too(assuming a PC touchscreen). The real issue is you need to think though the interface you will not have a mouse and keyboard most likely on a mobile app so you will need to be able to do do everything by left clicking the mouse. Unless you are going to require extra hardware but that would limit your audience.

Edit: also beware of compatibility of any outside extensions you might be considering.
 

kburkhart84

Firehammer Games
The two biggest quirks are going to be input and screen resolution.

Input---Smartphones in general only have touch screens...you can generally count on at the least a few touches being available on the modern smartphone. If your game is basically mouse and click stuff, you are probably fine with minimal changes. If you have inputs like keyboard keys to move your character, etc... you will want to handle that with touch versions, which typically happen using on screen spaces designated for that(virtual buttons and pads). Your code will have to have something that makes that difference, checking what export you are on, to avoid drawing those virtual buttons on PC, and to react to the correct thing in either case. I designed my input system to have the actual game actions separate from the inputs that drive them. This let's the input system handle saying whether the jump button is pressed(whether it is from a keyboard key, gamepad button/axis, or even driven by code that checks something like a virtual button. Then the game object that does the jumping only checks that one central place to see if the jump button is pressed and doesn't care what happens behind the scenes. This type of organization is helpful for developing for multiple platforms IMO.

Screen Resolution---you will want to see how games handle different resolutions. Each game does it differently based on what it needs, if black bars(whether actually black or filled by something) are acceptable, and if you are willing to show more/less of the game world on different resolutions. Scaling/positioning the GUI based on this is also important. Note that handling screen resolution is something you would likely do even if you were only exporting to desktop, though mobile makes the issue more important as there are that many more different resolutions/ratios to make sure work acceptably.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Starting off by making your game entirely mouse-controlled (only the left mouse button, and with no functionality for hovering something with the mouse) is a good start.

There's some fundamental limitations on mobile games that are worth keeping in mind:
  • Session length is usually much shorter (a few minutes)
  • Games can be interrupted at any time (phonecalls, etc) so you should account for that (save often, have short content chunks that can be aborted without considerable loss, etc)
  • VRAM is at a premium, so large surfaces might not be available, texture swaps can quickly start eating up a lot of performance, etc
  • Screens are much smaller, so GUI elements (and in-game objects!) need to be disproportionally large to be readable... and the player will might have finger(s) covering a large part of the screen depending on how your interface is laid out.
 
I posted this because the game I just released will still receive a lot of updates (content addition). Basically I will have to copy the updated desktop version to the mobile. I will have to make this adaptation to each version, or at least paste what is new. Anyway, it will almost be a double job.
 

curato

Member
yeah it is a lot better if you have that in mind up front, but isn't undoable to have it check which os you are running and setting up the correct interface is practical.
 

kburkhart84

Firehammer Games
I posted this because the game I just released will still receive a lot of updates (content addition). Basically I will have to copy the updated desktop version to the mobile. I will have to make this adaptation to each version, or at least paste what is new. Anyway, it will almost be a double job.
This is why you use if statements, and you can check what export the build is during execution, and therefore run different code accordingly. If you organize things into separate objects it can be even easier. See the following example for input handling.

1. Make an object(or use global variables if you really want to). It would track the status of input actions, like JUMP or SHOOT, or MOVE LEFT. Note that it doesn't directly check anything, it only tracks the action itself. Then, your game's objects, like the character, will check that object(or global variables) to see if it should jump, shoot, move, etc...

2. Create multiple objects to handle the direct input. One would be for PC, where you would check keyboard, gamepad, whatever. Another would handle touch input, drawing the virtual gamepads on the screen, checking the 5 possible touches to interpret, etc... You could even have a third for example for HTML5, where both keyboard and touch could be available. Note that these objects would be responsible for updating the variables(or object) you created in step 1.

3. When your game starts, check the variable to see which export you are on, and create the appropriate object from step 2 for the platform. If on PC, create the PC version, if on mobile, create that one.

The idea(which applies to anything, but is especially handy here), is to separate object responsibilities into separate objects. My player object should never have to check gamepad inputs...it should only be responsible for jumping when it is told to, and drawing itself. Another object would handle input, allowing you to create whichever object is needed based on the platform. If you start your game in this manner(which can be an advantage of having the exports all purchased from the start), it is easy to switch platforms even as you keep adding more game content.
 
Top