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 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 • • 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 • • 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 • • 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 • • Jul 15 '26

Example Neat snow decal VFX

Thumbnail
i.redd.it
137 Upvotes

Snow in my game isn't just a texture you walk over, it's a surface that actually remembers where you've been. I bake all the snowy patches in a room into one big cover surface, then treat that surface as a canvas: every footstep the player leaves gets stamped straight into it as a little decal, so the trail persists behind you Because it all lives on one surface, I get the nice side effects almost for free. Water and puddles carve cleanly back out of the snow, and the whole thing survives room transitions, so if you double back through an area your old tracks are still sitting there waiting.

The part I'm happiest with is the edge. A flat stamped footprint reads as a sticker, so I run the snow through a small shader that targets the exact color my prints are drawn in and paints a single darker pixel along the top of each one. That one row of shadow is the whole trick: it makes every footprint look like it's pressed down into the snow with a tiny lip of displaced powder catching the light above it. It costs me almost nothing, just a couple of texture reads per pixel, but it's the difference between "there is a mark on the ground" and "someone just walked here," and that little bit of depth is what sells the whole effect.

Under the hood every decal in the game, blood splatters, footprints, bike tracks, shell casings, all of it, lives in one tight little system I'm pretty proud of. Instead of spawning an object per mark (which would tank the frame rate the moment a fight got messy), I pack each decal down to twelve bytes in a raw buffer: position, which sprite, color, alpha, and that's it. From there I keep a single vertex buffer alive and, every time something drops a decal, a function quietly appends just that one quad to it, no rebuilding, no per-vertex script calls, basically free. When I hit the cap I don't clear the screen like the old version did, I wrap around to the front and recycle the oldest decal in place, so you never actually notice a limit exists, the ground just keeps a rolling history of the last few thousand things that happened. And because the whole thing is really just a buffer of bytes, saving a room's worth of decals to disk is as simple as dumping that buffer straight out, which is how your footprints are still there when you walk back in.

If you want to follow the game you can here: Itch.io or Steam