r/howdidtheycodeit • • Jul 09 '26

How did Bennett Foddy achieve the hammer mechanic in getting over it?

Post image
3.7k Upvotes

I been trying to make this mechanic but I fail to make the states (like when the hammer is touching ground and when don't) and I fail to make the momentum transfer when you are moving fast, and when yo move slow you just move (with infinite mass i think), idk I just can't wrap my head around this mechanic, please help. I know griffpatch made it in scratch, and I try reverse-engineer that but i also couldn't


r/howdidtheycodeit • • Nov 25 '23

how do i recreate this?

1.2k Upvotes

r/howdidtheycodeit • • Jan 30 '24

Question How are the web collisions coded?

684 Upvotes

r/howdidtheycodeit • • Feb 20 '26

Question How did they animated this model?

641 Upvotes

Source

How they did that movement that looks silly and funny? I tried to ask to the original author but i got no answer, in the comments on says he did it with procedural animation using Blender and Godot but nothing about details on the animation itself.

I intend to reproduce something similar using godot jigglebones on the legs, but not sure if it can be combined with the procedural movement.


r/howdidtheycodeit • • Nov 13 '19

Question How is it possible to alter the size of the object with the position of the player?

580 Upvotes

r/howdidtheycodeit • • Apr 07 '20

Showcase I wrote a shader for simulating procedural volumetric clouds inspired by games like hzd and rdr2.

496 Upvotes

r/howdidtheycodeit • • Jul 12 '26

Question How did they coded the rendering scene on Librarian: Tidy Up the Arcane Library?

Post image
474 Upvotes

Well, tbh, my main question it's how they managed to code in so there's thousands of physics objects visible without causing performance issues, I know the scene is quite small overall, but still I'm intrigued in what are the optimization techniques used so it isn't all laggy


r/howdidtheycodeit • • Apr 03 '20

Showcase I made a little breakdown of my cartoon water shader

448 Upvotes

r/howdidtheycodeit • • Apr 16 '25

Question how did the generate the millions of positions to place each blade of grass at in BOTW?

Post image
423 Upvotes

this is entirely in regards to the positioning of the grass blades in BOTW. no way they store each position, so they'd need to generate the positions procedurally, right? if so, what technique do you think they used to do these calculations so quickly?


r/howdidtheycodeit • • Jun 20 '26

Answered Where is this type of UI coming from?

Post image
399 Upvotes

I see it all the time with different things. Simulations, Games, Demos, it is everywhere; but where the hell is it from?


r/howdidtheycodeit • • Mar 09 '26

Making an element appear outside its window

364 Upvotes

I've been meaning to emulate this similar result but I just don't know how to start, especially as I want to code in Java (no other way around it it has to be Java)

Is it like a fake window and the game is in full screen ? Or can you just make an element appear outside its window ?

I know you can sometimes make an image appear even though you're on your desk so is it that ?


r/howdidtheycodeit • • Aug 12 '25

Question Why is ESP so hard to stop in games?

339 Upvotes

ESP (Extrasensory Perception) lets hackers see their enemies through walls

Can't they just prevent this by letting the server calculate if an enemy is just about to enter someone's screen using matrix calculations and the enemy's velocity, and only if the enemy is 1 frame away from possible being in view, send that enemy's position data?

And what about encrypting the position data?

sorry 4 ignorance


r/howdidtheycodeit • • Aug 12 '26

How do games like Peak, Noita, etc ensure randomly generated levels are completable?

288 Upvotes

Peak seems to generate 4 random levels each day, but they are always completable. Noita generated a new map for each run, and has the benefit of the player being able to modify terrain, but still needs to ensure the player isn't blocked from progressing downwards.

With Peak especially, being a 3d game with no terrain modification, how do they ensure a map is completable? (No necessary climb too high to progress past)


r/howdidtheycodeit • • Dec 16 '24

Question How games like this were programmed in NES era?

Post image
287 Upvotes

r/howdidtheycodeit • • Oct 08 '26

Should we ban AI-related posts?

244 Upvotes

They usually get downvoted to 0, but I wanted to ask everyone before updating the Submission Guidelines.

Proposed rule:

  • No posts about AI generated content or LLM coding systems. This subreddit is about curiosity and the craft of programming. There's plenty of other subreddits to discuss these topics, so take it there instead.

Edit: Ya'll have spoken! updating.


r/howdidtheycodeit • • Feb 08 '21

Question Eco Global Survival is voxel-based but on a spherical planet. How did they do this?

Post image
234 Upvotes

r/howdidtheycodeit • • Jan 31 '20

Question [Beginner] I am dying to try making something hilarious like this. How’d he do it?

Thumbnail
youtu.be
230 Upvotes

r/howdidtheycodeit • • Jun 06 '19

One of the best "howdidtheycodeit" channels - Incredibly complex, ground-breaking game development techniques explained in an easy to understand way by an industry veteran

Thumbnail
youtube.com
227 Upvotes

r/howdidtheycodeit • • Mar 11 '21

Question How was the muscles effect done? GTAV also have this effect but with clothes instead of skin.

221 Upvotes

r/howdidtheycodeit • • Feb 02 '21

Question How do I make a player movement like this in unity.

194 Upvotes

r/howdidtheycodeit • • Mar 15 '26

Question How did they code that?

187 Upvotes

Looks like a video input + particles system + fluid simulation, but I have no idea how I would go to code that


r/howdidtheycodeit • • Feb 02 '22

Answered Divinity Origional Sin 2: How did they make the elemental surfaces; Answer Provided

184 Upvotes

Just to restate the question. How did they program the elemental surface effect in divinity? I've been wanting to implement this system in my own project later, which is combining XCOMs destruction, and Divinity mechanics with Starfinder or HC SVNT Dracones. Which ever seems like the better option. I've searched the internet, and there doesn't seem to be any answers other than decals. However, implementing hundreds of decals on the screen is no good. That's a pretty good way to dive performance, even with efficient rendering techniques due to overdraw. So I decided to look into it myself.

In the game divinity origional sin 2, the ground plays a major role in the game's combat system. The ground and various objects can be covered in blood, water, poison, and oil as combat progresses, or players set up devious traps. And each of these all seem to have a very different look and level of viscosity to them. If it was just a decal, that'd be all said and done. And that is what it looks like initially.

But when you play the game, and watch the animations. This is very clearly not the case any longer.

https://youtu.be/BEmuDCcHjsM

There's also an interpolation factor here as well. And the way it travels, also implies that there's some cellular automata being done to interpolate these effects quickly over time to fill out spaces. So what's going on behind the scenes?

Well... it turns out that the "decals" people were guessing was only half correct. If you look into the Divinity Engine Editor, the material for all of the surface effects are in fact using the decal pipeline according to material settings.

However what's actually happening behind the scenes looks more closely like this.

The image above is the "Surface Mask Map" of Fort Joy. It is pretty much an image of the above view. And is where most of the magic actually happens. By this image alone, we are actually given a major hint! Or rather... the answer if anyone recognizes the texture.

If the second link didn't give you a clue. It's actually the old school technique for rendering fog of war! A single large image is mapped to the XY (XZ in the case of Divinity) coords in a one to one ratio. Divinity uses half meter increments, so each pixel is half a meter. The image is 1424x1602. So roughly 712m by 801m. Here's what all of the ground surfaces look like next to each other.

The one above doesn't look too useful, does it? Well... lets focus on the red channel.

Barely detectable, the surfaces all have slightly different hues, which means that the texture is actually very few bits for detailing what's what. So... why does this matter? Well... the rest of the bits are used for interpolation for the animation. This was an absolute bitch and a half to figure out. But here's what's going on under the hood. In the image below, I added a patch of the same surface to another surface and captured the frame while the newly added surface was animating.

As we can see, the blue channel is primarily used as the mask factor. This is animated over time, rising from 0 to 1, allowing the surface to be visible.

There's one other small problem though. By this logic, the masking should create square patches right? Well lets single out a single pixel and see what happens next.

There's theory with little proof on what I think is happening here. First... what I do have proof of. To create the edges of these surfaces and make them look natural, the game makes use of procedural textures. It doesn't actually make this on the fly, but uses an actual texture on the hard drive for such a purpose. Here's one of them.

The surface shaders will scale and make changes to these textures before and after plugging them into a node called "Surface Masks"

I don't actually know what the hell is going on in the image above. There's two things I do know. First, is that the image uses the world coords to Scale UVs. Which... is odd. As it also means that the scale dynamically changes on a per-pixel level. If only slightly. The Second, is that there is hidden magic happening inside Surface Mask node.

My theory about this is that the Surface mask node uses some form of interpolation. to help smooth out the values and adjust the opacity mask.

Judging by the images above, it looks like Bicubic is our likely culprit. As the fragment shader travels further away from the center of the .5m square, it blends with surrounding pixels of the mask. And only if the mask matches the current surface. The shader knows what surface it is using, as each surface projection is rendered separately during the gbuffer pass.

So what about the Height and Walkable mask that we see in the node? Well... I don't know.

Cycling through color channels doesn't net me anything useful. I recognize a decent sum of these areas from Fort Joy. Green seems like all of your possible walkable paths. But none of the channels helps me deduce anything special about this, and its role in the surface shaders.

Parting Words

Well, it's clear that Divinity was 3D game working with mostly 2D logic. And because they never go under bridges or such, they don't have to worry about complications. So how would this even be applied for games where they need to worry about 3D environments or buildings with stairs and multiple floors? I actually have a thought about that, and sort of figured it out after making this analysis.

The backbone of my game's logic is driven by voxels. However, the game graphically will not be voxel based. The voxels are being used for line of sight checks. Pathfinding across surfaces, along walls, through the air, and across gaps. Representation for smoke, fire, water, etc. Automatic detection of various forms of potential cover. And so forth.

Each voxel is essentially a pixel that encompasses an cubic area of space. With this in mind, I can store only the surface nodes in either a connectivity node format, or sparse octree, and send it to the fragment shader for computing. Like what I've discovered, I can still simply project a single texture downwards, then use the cubic area of voxels to figure out if a surface has some elemental effect to it. If it does, I can interpolate the masks from surrounding surface voxels.

For Deferred renderers, this would be typical Screen Space decals. No need for resubmitting geometry. For Forward Renderers, this would be the top layers of a clustered decal rendering system.

But anyways gamers and gamedevs! I hope this amateur analysis satisfies your curiosity as much as it did mine!

Edit 1: Some additional detailsSo I made some hints that the divinity engine does in fact use a deferred rendering schema. But I think it might also be worth noting that Divinity has two forms of Decals.

The traditional decal we all think of, in divinity is only applied to the world from top to bottom. This is used primarily for ground effects. However, even more curiously, divinity does not actually use screen space decals, which have became common practice with Deferred Renderers. Instead, it uses the old forward rendering approach, which is to simply detect what objects are effected by said decals, and send them to the GPU for another pass.

The second form of Decals, are much closer to Trim sheets. They are actually just flat planes that can be thrown around. They don't conform to shapes in any shape or form. And all most all of them uses a very basic shader.

And while we are speaking about Shaders. A good number of Divinity's materials actually reuses the same shaders. Think of them as unreal's "Instanced" shaders. This is useful, because part of Divinity's render sorting, is actually grouping objects with very similar device states.

Why does this matter? Primarily performance reasons. A draw call isn't cheap. But more expensive yet, is changing the device states for everything that needs to be rendered.

Binding new textures is expensive, hence why bindless texturing is becoming more popular. But changing the entire pipeline on the other hand... yeah you want to avoid doing that too many times a frame.

And some objects, such as the terrain is rendered in multiple passes. Yeeeaaah. The terrain can get resubmitted roughly 14 times in a single frame depending on how many textures it is given. However, this isn't that expensive. Since everything is rendered from top down, the overdraw isn't horrendous. and it uses a Pre-depth pass anyways.


r/howdidtheycodeit • • Mar 23 '26

Question Highlighting a character in Return of the Obra Dinn

176 Upvotes

When you zoom in on a character, it briefly shows this highlight effect before fading out. How would I go about creating a similarly-rough silhouette of a specific object? I'm aware of the inverted hull technique for outline shaders, but that doesn't seem to be what's used here. I'm not interested in the dithering/one-bit rendering techniques, just the silhouette.

I skimmed through the Obra Dinn devlog but wasn't able to find any reference to this specific mechanic.

I apologize if this is obvious, I am still very much a novice in shader programming (I've experimented a little in Godot/Unity). Any suggestions or shader resources would be helpful. Thanks!


r/howdidtheycodeit • • Jun 16 '19

Article The devs of Crash Bandicoot (1996) found shaded characters looked better than textured characters. This led the developers to use a high resolution mode on the PS1 that ate memory normally used for textures. The end result is a very sharp game, with lots of shaded polygons, and a cartoony aesthetic.

Thumbnail
all-things-andy-gavin.com
176 Upvotes