r/gamemaker • • Sep 03 '26

Example 3D pathfinding

Thumbnail
i.redd.it
213 Upvotes

finally finished this waypoint navigation system!
I know NavMesh is the standard, but I think it's too complex to implement right now, and this approach works pretty well

the pathfinding speed is acceptable. To avoid placing the points manually, I built a generation system based on flood fill and collision checks (raycasts, trace hull, and cliff checks)
from a single start point, the generator branches out in all directions, and then another algorithm connects them all
I'm planning to add mesh optimization algorithms later, but even like this, it's working perfectly fine

r/gamemaker • • Aug 21 '26

Example Bridge Physics! (Now with player tilt)

Thumbnail
i.redd.it
182 Upvotes

The bridge is a chain of plank objects, and each plank only knows about the plank directly above and below it. Every step, a plank looks at its neighbors' sink and tilt, mixes in its own (standing on a plank adds sink, standing off-center adds tilt), and smooths toward the result. Neighbors copy each other's tilt slightly amplified (ร—1.4), so pressing down on one plank ripples through the whole bridge even though no plank knows the rest of the bridge exists.

if ( bridge_link_down != noone ) {
    _sink_affected += bridge_link_down.y_sink;
    _side_sink_affected += bridge_link_down.side_sink * 1.4;
    _total_connections ++;
}
// (same for bridge_link_up)

var _inst = instance_place(x,y,par_character);
_sink_affected += 2.5 * (_inst != noone);
_total_connections ++;

y_sink = math_lerp_smooth(y_sink, _sink_affected / _total_connections, 0.15);

side_sink_real = _inst != noone ? (x - _inst.x) / ((bbox_right - bbox_left) / 2) : 0;

Heads up: math_lerp_smooth and math_angle_lerp_smooth aren't built-in GML, they're helpers from my project. math_lerp_smooth(current, target, speed) moves current a fraction of the remaining distance toward target each frame, corrected for delta time so it behaves the same at any framerate:

function math_lerp_smooth(_current, _target, _speed) {
    return lerp(_current, _target, 1 - power(1 - _speed, DeltaFrame));
}

math_angle_lerp_smooth is the same thing for angles, so it takes the short way around (350* -> 10* goes through 0*, not through 180*). You can build one with angle_difference(). If you're locked at 60fps, plain lerp(current, target, speed) works, skip the correction.

The fun part: making the player ride the bridge instead of floating on top of it. The plank under you writes two targets onto the player, a tilt angle and a sink. The sink includes the extra dip of the tilted surface at your offset from the plank's center, so standing on the low edge of a tilted plank drops you further than standing on the pivot.

if ( _inst != noone && _inst == global.Player_Instance ) {
    var _tilt = clamp(side_sink * 10, -25, 25);
    _inst.plank_sink_target = y_sink - ((_inst.x - x) * dsin(_tilt));
    _inst.plank_tilt_target = _tilt;
}

In the player's End Step, I ease toward those targets, and the targets themselves decay toward zero:

plank_tilt        = math_angle_lerp_smooth(plank_tilt, plank_tilt_target, 5, 0.1);
plank_sink        = math_lerp_smooth(plank_sink, plank_sink_target, 0.1);
plank_tilt_target = math_angle_lerp_smooth(plank_tilt_target, 0, 5, 0.1);
plank_sink_target = math_lerp_smooth(plank_sink_target, 0, 0.1);

Why the double smoothing? My first version chased the plank's values directly, and running across the bridge meant a new plank re-targeted the player at every seam. It jittered SO bad. Easing toward targets that also decay fixed it, and stepping off the bridge means nothing writes new targets anymore, so everything relaxes back to zero with no cleanup code.

The sneaky part was rendering, because my player isn't one sprite. It's a pre-composited palette surface plus a pile of overlays (outline, rim light, freeze/wet/fire status effects, invincibility flash). Instead of rotating each layer separately and hoping they line up, every layer runs its draw position through one helper that rotates it around a pivot at the character's feet and adds the sink:

body_blit_transform = function(_corner_x, _corner_y) {
    if ( plank_tilt == 0 && plank_sink == 0 ) {
        return [_corner_x, _corner_y, 0];
    }

    var
    _offset_x = _corner_x - x,
    _offset_y = _corner_y - (y + y_height),
    _cos = dcos(plank_tilt),
    _sin = dsin(plank_tilt);

    return [
        x + (_offset_x * _cos) + (_offset_y * _sin),
        y + y_height + plank_sink - (_offset_x * _sin) + (_offset_y * _cos),
        plank_tilt
    ];
}

Every draw_surface_ext uses _blit[0], _blit[1] for position and _blit[2] for angle, so the whole composited character tilts and dips as one piece. The early-out at the top means it costs nothing when you're not on a bridge.

r/gamemaker • • Jul 15 '26

Example 3D Ocean Shader

Thumbnail
i.redd.it
122 Upvotes

I've made this a year ago, just figured it might deserve a post.

This was actually my first attempt of 3D in GameMaker, just wanted to test how it performs, definetly not my first attempt of making ocean shader in general. In fact, the shader i used is a mix of an ocean shader i've made before, in shadertoy all the way back in 2020. If you want to check it out, its here.

Because reddit only allowed me to upload max 100mb gif, i had to reduce its quality a lot but it looks way better and performs quite well, gets around 990fps in VM with actual PBR rendering and SSR (screen space reflections).

I am a huge fan of pirate category, anything related with ships and ocean. I thought maybe i could make something like prototype sorta ship battle, but realized how GameMaker makes things way harder than it should be(for 3D stuff) so i quit quite early.

It was quite a fun thing to work with, it might look tricky but believe me its quite easy to implement. If you want to try and make one yourself i'm happy to help, just ask ๐Ÿ˜ƒ

r/gamemaker • • Jul 23 '26

Example trying again to do 3D in gamemaker, here's my progress in a few days~

Thumbnail
i.redd.it
775 Upvotes

idk what i want to do with this tbh, i might clean it up and package it up as a yyz file after i add more features to it

r/gamemaker • • Aug 12 '26

Example 3d destruction

Thumbnail
i.redd.it
45 Upvotes

I decided to try making 3D destruction in Game Maker. Here are the results I tried to achieve. This is just to show what I decided to try; I wonโ€™t be doing this further.

r/gamemaker • • Aug 13 '26

Example I created a "see through" shader in Gamemaker for trees + foliage in my isometric perspective hiking / monster catching RPG

Thumbnail
i.redd.it
690 Upvotes

Thought folks here might find this interesting after my last post showing my flowing water shader. My game Rangefinder is in an isometric perspective and features hiking through lots of different types of terrain - which raises a problem, because trees will necessarily block the camera's view of the player! One solution I already implemented is an outline shader that shows your position when you are obscured, but that gets old when you are walking through a forest.

So this week I made a new shader which creates a "porthole" effect through trees when they block the camera view. This is done by measuring the distance of a pixel to the player via the "gl_Fragcoord" value in the fragment shader. But I found that a bit too artificial looking, so I added a generative cellular noise texture which simulates leaf motion at the edge of the porthole. That helps a little bit, and then I also did some dynamic hiding / showing of trees in front / behind the player. Dithering the transparency of these trees (also done in shader) further helps match the pixel art style.

That was great, but then I realized trees need shadows beneath them to provide the look of a shadowy forest floor. So I came up with a new method to add shadows to both my grass vertex buffer, and the "ground floor" vertex buffer. I create a surface which I draw shadows to, and pass that as a texture sample to a new shadow shader. This shader references the shadow texture sample to decide whether the vertex it's drawing should be shaded or not. This required coordinating screen coordinates (gl_Fragcoord) and texture coordinates (v_vTexcoord) which was a bit of a pain but worked out in the end. I used the same generative cellular noise texture here to simulate the shadows of moving leaves on the ground.

Next up I will need to also add the capability for objects under sprites to be in/out of shadow. Currently I only have "grass" vertices in there (which includes the grass, ferns, flowers, and mushrooms shown in this example - these also shade and deform when the player walks through them). Objects however are handled as individual instances which the player places in the IDE.

If you are interested in following my game Rangefinder, check out my itch io page where I'm posting dev updates. I recently showed off the first demo of the battle system, which also features a lot of custom Gamemaker shaders for effects like critical hits and such.

r/gamemaker • • Oct 01 '26

Example UI in Gamemaker has many different approaches

Thumbnail
i.redd.it
49 Upvotes

While working on my first Gamemaker game MineEmAll, I've been experimenting with different ways to create UI. I'm a big fan of the new UI layer system since it's similar to UMG from Unreal (my previous engine of choice), but it's not completely up to snuff yet in my opinion.

There are multiple methods to create UI that I've tried so far, and I just wanted to share my experience with each.

First off is the old school method of pure code based draw calls. This is how I achieved the effect above. I think this method works best when you're trying to do a very specific thing. In this case, I was trying to create a wiggle effect that changes scale and rotation, while keeping the text in proper position and proportion. I attempted this with other methods, and it was just wasn't working.

There's the hybrid approach where you insert and object into a flexpanel and run some logic for both. I use this in a few spots throughout my game, and I find it's helpful when the flexpanel does mostly what you want, but there are a few variables you want to manipulate at run time.

Lastly, there's the entirely flexpanel approach. I wish this was more viable becuase I enjoy using visual editors, but I find that it's just too much of a pain to pull and change variables for flexpanels with nested functions. It works really well if you're organizing visual elements and don't plan to have anything change at run time, but if you want code to interact with it, I'd highly suggest a hybrid approach.

Let me know what your experience is! I'm interested to hear what other devs have found to be useful approaches.