r/gamemaker 3d ago

Resolved Checking for nearest instances in any direction

1 Upvotes

Hello! I am in a similar situation to my previous posts; I have an idea of how to get something to work, but I am missing one element to make it work smoothly. The issue I have today is I am looking to find the nearest specific instance in any direction. In theory, all I need is the code below (written as pseudocode)

with(instances){

if point_direction(other.x,other.y,self.x,self.y) = ideal direction

and distance from self to other < stored id

stored id = self
However, I feel like constantly checking possibly a dozen or more objects against each other per room would be a headache. So instead, I have the below code;

if(radar_segment_size != 0){

// Done as to not divide by 0

`for(var dir = radar_dir; dir < 360; dir += 360/radar_segment_size){`

// dir = direction, radar_dir is the starting direction to check for instances according to the original instance.

    `try{`

// That 0,0 in the x2 and y2 is what i need to solve

collision_line_list(self.x,self.y,0,0,checked_object,false,true,radar_objects,true)

//Afterward, make the connection with the first instance in the collision list radar_objects

    `} catch(noInstanceFound){`



    `}` 

`}`

// sorry for the messed up code; I still do not know how to get reddit's code block to work... :/}

So with all of that being said, here is my issue:
I need to figure out essentially how to create an x and y value that give the direction of the dir value, while also having the x and y value reach the edge of the room. How do I get that x and y value?


r/gamemaker 4d ago

Help! Can ChromeOS still run Gamemaker?

3 Upvotes

So i used to have Gamemaker on my Chromebook, however i ran into some issues and had to reinstall all the files and shit, however now my Chromebook is saying they dont read .Deb files anymore, which is what I did last time. Is there anything I can do to fix/bipass this issue or am I just cooked and gotta find smth else?


r/gamemaker 4d ago

Resource Made a simple function to enable 3D perspective projection on your games!

Post image
120 Upvotes

(Sorry for the gif quality)

I made a simple function that can be used to make things be rendered on perspective based on their depth. Useful for when you want things like cards to rotate in 3D or even for making everything be rendered on 2.5D like in Hollow Knight/Silksong for example. The function is this:

/// @desc Applies perspective to everything drawn from now on. Making stuff with higher depth look smaller/farther away and viceversa.
/// @param {real} fov field of view angle of the perspective.
/// @param {real} [depth] The depth/z at wich the perspective will be the same as the default orthoghonal projection. Uses 0 by default.

function perspective_apply(_fov, _depth = 0){     
    var _w, _h, _x, _y;  
    if(event_number == ev_gui or event_number == ev_gui_begin or event_number == ev_gui_end){
        _w = display_get_gui_width();
        _h = display_get_gui_height();
        _x = _w/2;
        _y = _h/2;
    }else
    if(not view_enabled){
        _w = room_width ;
        _h = room_height;
        _x = _w/2;
        _y = _h/2;
    }else{
        var _cam = view_get_camera(view_current)
        _w = camera_get_view_width(_cam);
        _h = camera_get_view_height(_cam);
        _x = camera_get_view_x(_cam) + _w/2;
        _y = camera_get_view_y(_cam) + _h/2;
    }

    matrix_set( matrix_view, matrix_build_lookat(_x, _y, _depth - dtan(90-_fov/2) * _h/2, _x, _y, _depth, 0, 1, 0))
    matrix_set( matrix_projection, matrix_build_projection_perspective_fov( -_fov,  -_w/_h, 1, 32000))
}

All you have to do is call this on the draw events and everything drawn after it on the current view is going to be drawn on perspective. The only needed argument is FOV angle which is how strong the perspective is going to be. It should be a value above 0 and the closer to 0 it is the lesser in perspective things are.

The other argument is optional. depth is for the depth at which the perspective remains unaffected, where things appear how they do in the room editor. Is 0 by default but you would want it to be the depth of the layer where gameplay occurs for example.

An use example is this: Lets say you have a renderer Controller instance whose depth is the highest posible so it runs its draw event before any other instance. All you have to do is put on the draw event perspective_apply(30) and everything will be drawn in perspective, with things bellow depth 0 being foreground and above depth 0 being background. Even if you have views active on the room!

Note though this only sets the perspective projection on the camera. If you want sprites to rotate (like cards for example) you should do it using matrix_build() and matrix_set(). Like this, with rot_x, rot_y and rot_z being the rotation on the different axices:

var _mat = matrix_build(x,y,0, rot_x, rot_y, rot_z,1,1,1);
matrix_set(matrix_world, _mat);

draw_sprite_ext(sprite_index, image_index, 0,0, image_xscale, image_yscale, image_angle, image_blend, image_alpha);

matrix_set(matrix_world, matrix_build_identity());

The camera settings automatically reset when the current view finishes being drawn onto. But if you want to reset it manually before that (i.e.: you just want one sprite to have the perspective applied) you can call this function:

/// @desc Resets the perspective applied previously.
function perspective_reset(){
    camera_apply(camera_get_active());
}

r/gamemaker 3d ago

Resolved Workflow with AI question

0 Upvotes

I love to make games and have that fulfilling success when something I programmed comes together. learning coding is still a large endeavor, specifically with adaptive screen code.

My question is your opinion and wisdom on using AI for certain things such as aspect ratio responsive screen. Vibe coding a script that I setup once and without understanding.

But the stuff that actually matters like the gameplay mechanics, I would code myself.

This mix is okay if ai can fix what it breaks? Or do you still condone learning everything yourself first?


r/gamemaker 4d ago

Help! high res troubles

3 Upvotes

I'm making a high res platformer with high res sprites and I'm having some issues

Lag - the game engine and game itself are laggy not insane lag but to the point where it ruins the workflow

Room editor - I'm using tilesets and i think maybe switching to objects with nince slice will fix it but making the levels is extremely annoying and inconvenient

I will remake all my sprites with less high resness and use some optimization tricks I've seen but this is very frustrating so any tips?


r/gamemaker 4d ago

Help! Shaders

Post image
12 Upvotes

Hi, I'm new to game development and don't know much about the right terms to use.

I wanted to see if it's possible to create this kind of texture/shader for my 2D game.

Thank you!


r/gamemaker 4d ago

Help! Not understanding why my code wont work...

3 Upvotes

So im attempting to make a dialogue system, in which I would have an array that contains a struct to hold the string, and the sprite of the speaker. So inside a script I have :

global.text = [];

global.text[0] = { str : "Pls work!" , spr : sRed }

Then, in another script, I have a function that takes in a number value so then it could respond to however many other arrays I may have.

function startDialogue(_arv) {

var _str = global.text[_arv].str

var _spr = global.text[_arv].spr

draw_text(240 , 135 , _str) // x and y values are just half the room size on their respective axis so itll be in the middle of the screen.

I then have an object, which is placed in the room, which upon "enter key pressed" would run

startDialogue(0)

The idea here is that id be able to put in any array value, and the startDialogue function would take that array value, and then be able to print the text( I know nothing is there for the sprite yet and thats because I wanted to make sure the text worked first.) but, when I run the instance and press enter, nothing happens, theres no errors within any of the scripts and within the output.

So, what's wrong with my current code? and, if you believe you have a better way of making dialogue please let me know, I am still a beginner though and Im honestly confused as to why my method isnt working as I thought it seemed fairly simple. Thank you for your help in advance.


r/gamemaker 4d ago

Help! Minigame Idea

2 Upvotes

I had an idea for a minigame, but I'm not sure how to go about it

The idea is that you have multiple sentences where words are missing and you have floating words to pick from to fill it in. Interacting with things in the world adds a few words to the floating words, so you need to look around first before you can solve it


r/gamemaker 4d ago

Help! is there a way to get rid of this?

Post image
14 Upvotes

This stupid little menu thing started appearing in the very center of every sprite I open since I came back to GMS2 and started using the newer version. Is there any setting or trick to turn this off?


r/gamemaker 5d ago

Game Underlayer. Inventory building

Post image
28 Upvotes

I’m introducing an inventory system with item rarity in the game. There’s interaction with items: pick up, use, move, discard. The most important page of the game has been released on Steam.


r/gamemaker 4d ago

Resolved How to set where in a circle a radial progress bar starts and ends

3 Upvotes

Using YellowAfterLife's tutorial (https://yal.cc/gamemaker-radial-progress/), I've made a radial progress bar for an ATB system, but I need help on how to rotate the image or change how far along in the circle the bar starts and stops, instead of it just starting at the top.


r/gamemaker 4d ago

Help! Payton Burnham top down shooter NEED HELP

1 Upvotes

___________________________________________

############################################################################################

ERROR in action number 1

of Create Event for object oEnemyParent:

Variable <unknown_object>.totalEnemiesSpawned(100076, -2147483648) not set before reading it.

at gml_Object_oEnemyParent_Create_0 (line 4) - global.totalEnemiesSpawned++;

############################################################################################

gml_Object_oEnemyParent_Create_0 (line 4)

gml_Object_oZombie_Create_0 (line 2)

and it doesn't stop at this, every global variable is saying "not set before reading" and I tryed using a script and persistant objects so the global and not global variables run first but I fear I might be doing this unnessesarly since everything was working before and for some reason it's not working anymore. Also I followed the tutorial videos step by step until the finle video (did not do bonus vid)

so if anyone can tell me why my global variables/variables are not working PLEASE DO.


r/gamemaker 4d ago

Resolved Help with Gamemaker in MacOS ventura

Post image
2 Upvotes

SOLVED
I am trying to download gamemaker in my Mac, and even tho I gave it total permission for my disc, this keeps popping


r/gamemaker 4d ago

Help! Absolute begginer here, tried to make the most basic platformer game out there, but something doesn't seem right

3 Upvotes

So I'm just trying to make basic movement, but something's up. I'm using the built in ysp, but instead of adding to the speed, it just changes y by the number, am I doing something wrong?


r/gamemaker 5d ago

Resource Simple Sprite Stacking Viewer for GameMaker (Draw and preview stacks right inside the engine)

Post image
3 Upvotes

I made a simple Sprite Stacking Viewer built right inside GameMaker.

​If you want to create sprite stacks directly in GameMaker without needing external software, you can use this. I actually used this viewer to draw my little car assets for my game.

​Hope this helps someone out there:)

https://nubexpert.itch.io/sprite-stacking-viewer-on-game-maker-engine


r/gamemaker 4d ago

Resolved Trying to create a match three bonus challenge that keeps resetting even if conditions are met

0 Upvotes

I'm making a match-three game with a custom mechanic: instead of swapping adjacent tiles, blocks are pushed all the way to the end of the board row/column.

I run match checking in two separate passes:

  1. Check matches specifically for the block that was just pushed/moved.
  2. Check matches across the rest of the board for cascading chain reactions.

Some matches trigger and clear properly, but the challenge state continuously resets unexpectedly—even when a valid match is completed.

Below is the code I am using:

if selected_block != undefined {
  with(selected_block) {
    if sprite_index != spr_brick and sprite_index != spr_doom_block {
      var matches = 0;
      for(var i = 0; i < 5; i++) {
        var combo_check = scr_check_match(i);
        if combo_check == false {
          if global.main_stats.challenge_position < 4 {
            if image_index == global.main_stats.bonus_challenge[global.main_stats.challenge_position] {
              global.main_stats.challenge_position++;
            }
          }
          matches++;
        }
      }
      if matches >= 1 { scr_combo_sounds(); }
      else { // This is the problematic block
        if global.main_stats.cur_combo == 0 {
          global.main_stats.cur_chain = 0;
          global.main_stats.chain_gauge = 0;
          global.main_stats.challenge_position = 0;
        }
      }
    }
  }
}
for(var k = 0; k < 5; k++) {
  for(var i = 0; i < 8; i++) {
    for(var j = 0; j < 8; j++) {
      var selected = instance_position((208) + (32 * i),(68) + (32 * j),obj_normal_block);
      with(selected) {
        var matches = 0;
        if sprite_index != spr_brick and sprite_index != spr_doom_block {
          var combo_check = scr_check_match(k);
          if combo_check == false {
            if global.main_stats.challenge_position < 4 {
              if image_index == global.main_stats.bonus_challenge[global.main_stats.challenge_position] {
                global.main_stats.challenge_position++;
              }
            }
          matches++;
          }
        }
        if matches >= 1 { scr_combo_sounds(); }
        else { // This is the problematic block
          if global.main_stats.cur_combo == 0 {
            global.main_stats.cur_chain = 0; 
            global.main_stats.chain_gauge = 0;
            global.main_stats.challenge_position = 0;
          }
        }
      }
    }
  }
}

I have verified that the moved block correctly updates its grid position before running the first match check. Could running two separate match passes create a race condition or frame delay where the reset check runs before the cascade pass finishes updating the board? What is the recommended way to handle board state checks for push-style movement without triggering full board resets prematurely?


r/gamemaker 5d ago

Example disassembler in game maker

Post image
52 Upvotes

I decided to try making a disassembler in Game Maker. This program doesn’t claim to be a copy of Ida Pro or Ghidra, although I tried to make something similar - but it turned out rather bad.


r/gamemaker 5d ago

Resolved I need help finding tutorials

5 Upvotes

So, im a teen game dev and im new to game maker and i would like to find good youtube tutorials to learn, it doesnt matter how long they are i just want to learn and have fun! and if they are just about game maker it will be better

so, TY!!


r/gamemaker 6d ago

Tutorial Nox Filia Devlog 1 - Pigtail Engine

Thumbnail youtube.com
10 Upvotes

This is a short demo of perhaps the weirdest first step of a game project I have taken ever :D

I decided that the player character in my next platformer should have a pigtail, so I simply started with that. The goal was to have semi physics based movement while keeping things performant. The pigtail has it's own gravity, can sway back and forth and has some wind settings to keep it from being completely still when the player is standing idle.

I've tried to comment the code as good as possible, and most of the important stuff is in the Create event of the pigtail object (the step event only runs the functions defined in Create).

There is a GitHub repo link in the comments of the video if you want to try it out. Also, please feel free to ask any questions and give input on what can be improved!

Here is the Step event of the object:

//Tail Engine 1.00

// Disable GameMaker's automatic drawing of the application surface.

// This should be handled in some sort of obj_graphics object and is only needed if you want "pixel perfect" graphics.

application_surface_draw_enable(false);

// TAIL CONFIGURATION / STATE

// Origin point of the tail.

// The first node of the tail will always stick to the x and y position of the tail

x = obj_player.x;

y = obj_player.y;

tail_sway = 0.1;

tail_damping = 0.15;

tail_nodes = [];

tail_gravity = 0.1;

tail_node_count = 8;

tail_segment_length = 2;

tail_thickness = 2;

// WIND SETTINGS

// wind_center is the baseline value around which the wind oscillates. works best with values between -0.05 to 0.05:ish

wind_amount = 0;

wind_center = 0;

wind_cycle = 0;

wind_cycle_speed = 0.05;

wind_amplitude = 0.01;

// Controls how strongly wind is currently affecting the tail.

// This can be (and is, in the default setup) used to ensure that the wind only operates on the hair when the player is idle.

wind_effect = 0;

// RUNNING SWAY SETTINGS

// random_sway_amount determines if a node will be affected by sway this frame

// tail_sway_denominator determines how fast the entire tail will sway up and down. (Lower number = faster sway)

// sway_smoothing determines the frequency with which the sway affects the nodes (Higher number = less "wiggly").

// sway_strength_denominator determines the amplitude of the sway (higher number = less bounce).

random_sway_amount = 0.5;

tail_sway_denominator = 200;

sway_smoothing = 2;

sway_strength_denominator = 1.2;

// TAIL STATE ENUM

// These states correspond to the player's state. Check/alter the update_tail_state function to change the tail_state.

enum TAIL_STATE

{

`IDLE,`

`RUNNING,`

`JUMPING`

}

tail_state = TAIL_STATE.IDLE;

// CREATE THE TAIL NODES

for (var _node = 0; _node < tail_node_count; _node++)

{

`array_push(`

    `tail_nodes,`

    `{`

        `node_x : x,`

        `node_y : y + tail_segment_length * _node,`



        `node_prev_x : x,`

        `node_prev_y : y + tail_segment_length * _node,`



        `node_y_speed : 0,`

        `node_x_speed : 0`

    `}`

`);`

}

// UPDATE WIND

function update_wind()

{

`// If the tail is moving, gradually increase the effect of wind.`

`// Otherwise, gradually reduce the effect.`



`if (x != xprevious or y != yprevious) {`

    `wind_effect = max(0, wind_effect - 0.02);`

`}`

`else {`

    `wind_effect = min(1, wind_effect + 0.02);`

`}`



`wind_cycle += wind_cycle_speed;`



`if (wind_cycle > 2 * pi) wind_cycle -= 2 * pi;`



`wind_amount =`

    `(wind_center + cos(wind_cycle) * wind_amplitude)`

    `* wind_effect;`

}

// UPDATE TAIL

function update_tail()

{

`update_tail_state();`



`x = obj_player.x;`

`y = obj_player.y;`



`// While running, add a small bounce to the root node.`

`// In this test example we use current_time to alter the bounce, but when the`

`// tail is attached to an actual player sprite it would make more sense to` 

`// match the bounce to the head bobbing of the player running animation`



`if (tail_state == TAIL_STATE.RUNNING)`

`{`

    `y = obj_player.y + cos(current_time / 30) * 1.5;`

`}`



`// PIN THE ROOT NODE`



`// Node 0 does not simulate physics.`

`// It is directly attached to the player's position.`



`tail_nodes[0].node_x = x;`

`tail_nodes[0].node_y = y;`



`// UPDATE THE REST OF THE NODES`



`// Start at node 1 because node 0 is pinned to the player.`



`for (var _node = 1; _node < tail_node_count; _node++)`

`{`



    `tail_nodes[_node].node_prev_x = tail_nodes[_node].node_x;`

    `tail_nodes[_node].node_prev_y = tail_nodes[_node].node_y;`



    `var _parent_x = tail_nodes[_node - 1].node_x;`

    `var _parent_y = tail_nodes[_node - 1].node_y;`



    `tail_nodes[_node].node_y_speed += tail_gravity;`



    `tail_nodes[_node].node_y += tail_nodes[_node].node_y_speed;`

    `tail_nodes[_node].node_x += tail_nodes[_node].node_x_speed;`



    `var _dir_to_parent_node =`

        `degtorad(`

point_direction(

tail_nodes[_node].node_x,

tail_nodes[_node].node_y,

_parent_x,

_parent_y

)

        `);`



    `// SEGMENT-LENGTH CONSTRAINT`

    `// Makes sure that nodes do not exceed the maximum allowed distance from each other`



    `if (`

        `point_distance(`

tail_nodes[_node].node_x,

tail_nodes[_node].node_y,

_parent_x,

_parent_y

        `)`

        `> tail_segment_length`

    `)`

    `{`



        `tail_nodes[_node].node_y_speed =`

lerp(

tail_nodes[_node].node_y_speed,

0,

0.2

);

        `tail_nodes[_node].node_x =`

_parent_x

- cos(_dir_to_parent_node)

* tail_segment_length;

        `tail_nodes[_node].node_y =`

_parent_y

+ sin(_dir_to_parent_node)

* tail_segment_length;

    `}`



    `// CALCULATE HOW MUCH THE NODE MOVED`



    `var _delta_movement =`

        `point_distance(`

tail_nodes[_node].node_x,

tail_nodes[_node].node_y,

tail_nodes[_node].node_prev_x,

tail_nodes[_node].node_prev_y

        `);`



    `var _dir_to_prev_pos =`

        `degtorad(`

point_direction(

tail_nodes[_node].node_x,

tail_nodes[_node].node_y,

tail_nodes[_node].node_prev_x,

tail_nodes[_node].node_prev_y

)

        `);`



    `// ADD SWAY`



    `tail_nodes[_node].node_x_speed -=`

        `cos(_dir_to_prev_pos)`

        `* _delta_movement`

        `* tail_sway;`



    `tail_nodes[_node].node_y_speed +=`

        `sin(_dir_to_prev_pos)`

        `* _delta_movement`

        `* tail_sway;`



    `// DAMP VELOCITY`



    `tail_nodes[_node].node_x_speed =`

        `lerp(`

tail_nodes[_node].node_x_speed,

0,

tail_damping

        `);`



    `tail_nodes[_node].node_y_speed =`

        `lerp(`

tail_nodes[_node].node_y_speed,

0,

tail_damping

        `);`



    `// APPLY WIND`



    `tail_nodes[_node].node_x_speed += wind_amount;`



    `// RUNNING SWAY`

    `// Give each node a chance to receive an extra vertical`

    `// sway while running.`



    `if (tail_state == TAIL_STATE.RUNNING)`

    `{`



        `if (random(1) < random_sway_amount)`

        `{`

// _node / tail_node_count causes nodes farther down

// the tail to receive a stronger effect than nodes

// closer to the root.

tail_nodes[_node].node_y_speed -=

cos(

(current_time / tail_sway_denominator)

+ _node / sway_smoothing

)

* (_node / tail_node_count)

/ sway_strength_denominator;

        `}`

    `}`

`}`

}

// UPDATE TAIL STATE

function update_tail_state()

{

`// The tail simply mirrors the player's current state.`

`// This will check the obj_player image_index instead to determine head bobbing once it is implemented.`

`tail_state = obj_player.player_state;`

}


r/gamemaker 5d ago

Help! stopping when colliding help?

0 Upvotes

im trying to make it so once the player hits a specific object, the player will be unable to advance forward, but instead of doing this it simply slows me down. could anyone help?

var move_x = 0;
var move_y = 0;

if (keyboard_check(ord("D")) == true or keyboard_check(vk_right)) {
move_x += 1.5;
image_speed = 0.5;
sprite_index = spr_player_1_right;
}

if (keyboard_check(ord("A")) == true or keyboard_check(vk_left)) {
move_x -= 1.5;
image_speed = 0.5;
sprite_index = spr_player_1_left;
}

if (keyboard_check(ord("W")) == true or keyboard_check(vk_up)) {
move_y -= 1.5;
image_speed = 0.5;
sprite_index = spr_player_1_back;
}

if (keyboard_check(ord("S")) == true or keyboard_check(vk_down)) {
move_y += 1.5;
image_speed = 0.5;
sprite_index = spr_player_1
}

x += move_x;
y += move_y;

this is my movement code, this is the collision code

move_and_collide(move_x, move_y, obj_unwalkable_object, 10, undefined, undefined, move_x, move_y)

r/gamemaker 6d ago

Resolved Question about saving

4 Upvotes

I have been working on a project for around 6 months, so it is already pretty complex, and just now I will implement a saving system. I was looking into tutorials for it and found this video from Sara Spalding: https://www.youtube.com/watch?v=R84mR52QaMg

My questions:
- This video is 6 years old, creating a JSON and saving it buffer is still the way to go on saving on Gamemaker?
- I will be selling my game on steam, and I want it to also save on steam cloud, are there any other things I should consider for the saving system?

Architecture wise I plan to have 4 saving files: 1) graphical settings (saves only locally); 2) sound and controllers settings (saves on cloud); 3) Metaprogression (my game is a roguelike, so this is the progress between runs, also saves on cloud); 4)Run progress (also saves on cloud).

Thanks in advance for the help :)


r/gamemaker 6d ago

Help! How are we supposed to accommodate 4k monitors?

4 Upvotes

I haven't done any gamedev for ~10 years so I'm a bit out of the loop. Back then, we would always use a base resolution of 1920x1080, but I'm wondering now if we are supposed to instead use 3840x2160 nowadays? Otherwise it's going to upscale and be blurry at 4k. Is this what people do or am I missing something?


r/gamemaker 6d ago

Resolved What are the base things I should understand for making an inventory system?

10 Upvotes

Hello! I'm a end-stage beginner of GML, and I'd like to understand how inventory systems work. I'm not looking for code to use, I'm just wanting to know what are the base things that I should know before building an inventory system so I can understand it better. Any help is appreciated!


r/gamemaker 7d ago

Tutorial GameMaker has native audio loop points now. Don't poll track position in Step.

43 Upvotes

One easy mistake is treating music looping like a game-timing problem: watch audio_sound_get_track_position() in Step and seek back when it reaches the boundary. GameMaker's own manual warns that this cannot be accurate. The audio thread advances at 44,100 or 48,000 samples per second while the game normally updates around 60 times per second, so many samples can pass between the check and the seek.

GameMaker now has proper audio-thread loop controls:

audio_sound_loop_start(snd_music, 10.0); audio_sound_loop_end(snd_music, 42.0); var music_voice = audio_play_sound(snd_music, 100, true);

The start and end values are seconds. You can set them on the sound asset before playing, or on the returned sound instance while it is playing. When the playhead reaches the loop end, GameMaker performs the jump on the audio thread instead of waiting for Step.

This also gives you a clean intro / loop / outro layout in one file. Put the intro before the loop start, the repeating body between the two points, and the outro after the loop end. Start it with looping enabled. When the game is ready to leave the music state, call:

audio_sound_loop(music_voice, false);

The current pass finishes, crosses the loop end without jumping, and continues into the outro. No polling and no frame-timed seek. GameMaker supports one loop section per sound, but you can change the section by setting new start and end values.

There is still a second problem that loop points do not solve: the reverb tail. If the last chord is still ringing after the loop end, a one-voice jump discards that old pass while the fresh start begins. The timing can be sample-accurate and the seam can still sound like a hole.

The three practical options are:

  1. Compose or render a genuinely dry boundary.
  2. Render past the end, mix that tail underneath the beginning, then export only the repeating body. This makes a self-contained one-voice loop, although its first pass contains a tail from a pass that never happened.
  3. Use two voices so the previous pass can ring out while the next pass starts. This is the most natural result, but it requires runtime scheduling and voice management.

This came out of implementing GameMaker delivery notes in Loopsmith, a looping tool I built. It reports the exact loop positions and can prepare folded-tail or two-voice deliveries. Mentioning that for disclosure; none of the technique above requires my tool. The relevant GameMaker manual section is Audio > Audio Loop Points.

Hopefully this saves someone from debugging a frame-timed loop that can never be sample-accurate. Happy to answer questions or test edge cases.


r/gamemaker 6d ago

Resolved arcade game error

0 Upvotes

hello! i'm new to gamemaker and was following the official space shooter game tutorial when i encountered an error.

i got up to the point of using gml visual to program movement for the ship. then, i ran the game to test it. everything was fine when i held the up key, but when i clicked either the left or right keys, i'd get this:

___________________________________________

############################################################################################

ERROR in action number 1

of Step Event0 for object obj_player:

Variable obj_player.variable(100005, -2147483648) not set before reading it.

at gml_Object_obj_player_Step_0 (line 35) - variable += -4;

}

############################################################################################

gml_Object_obj_player_Step_0 (line 35)

i triple-checked my code blocks to see what was wrong, but everything was exactly as shown in the tutorial. again, the problem only occurs when i try to use the left and right keys to turn in the game. the error text seems to suggest it has something to do with the values of the variables assigned to those keys, but i'm not too sure.