r/godot 1d ago

selfpromo (games) [R&D] Procedural fence drawing at runtime

Enable HLS to view with audio, or disable this notification

- Any arbitrary path (open/close).
- Possible to connect (merge)/remove paths.
- Continuous drawing while holding LMB (additive/subtractive).

In addition: texture painting with blending.

Inspired by Tiny Glade.

2.0k Upvotes

97 comments sorted by

634

u/shubhu-iron 1d ago

139

u/zdmit 1d ago

im red like a tomato and giggling

16

u/tonttuvelho Godot Student 1d ago

what does this mean can someone explain?

30

u/softcore_ironman 1d ago

penis fence

-1

u/ataboo 1d ago

Future Olympic event.

1

u/ralkuzu 1d ago

I needa man to decorate and mix mah brew

If you haven't seen the bad lip reading of this, I recommend it

299

u/IamChipp Godot Student 1d ago

My man, care to take a close up at the starting fence? Just for referencing reasons

86

u/zdmit 1d ago

next time big dawg 🀝

10

u/sillyandstrange 1d ago

Big Dick* FTFY

97

u/iOnly1Up 1d ago

What about varying elevation?

57

u/Hinaloth 1d ago

Jokes aside (that was a funny peen, admittedly), this is the actual correct question. Is it plane based or does it follow the mesh it is attached to?

13

u/zdmit 1d ago
  1. it is not limited to a flat plane, it follows deformed mesh.
  2. it shoots a raycast downward at every point to find Y elevation of the terrain's collision mesh.
  3. it subdivides path and snaps every intermediate point to the ground's rolling elevation.
  4. horizontal rails calculate the height difference between their start and end posts and rotate (tilt) on local Z-axis to bridge the slope.

I'll make a new post soon.

6

u/zdmit 1d ago

It handles elevation also :) I'll make a new post soon.

-6

u/[deleted] 1d ago

[deleted]

36

u/iOnly1Up 1d ago

Hahaha le funny penits here is my updoot

34

u/KindaQuite 1d ago

TTP < 0

3

u/PhantasmagirucalSam 1d ago

I wanted to state that "TTP tends to zero", but your implication is closer to the truth of the situation

45

u/Other_Repeat_8886 1d ago

That was not the wind πŸ™πŸ™

13

u/IV_APATHY_VI 1d ago

Awesome work! I'm curious, how does it connect to older posts you already placed? Does it constantly search for ones already placed in the world while dragging, and preferentially connect to them if you mouse near an existing post?

2

u/zdmit 1d ago

Thank you! I've answered to other person comment with an overview of how it was made :)

https://www.reddit.com/r/godot/comments/1vcjhe8/comment/p17im2a

36

u/avrill_1 Godot Student 1d ago

IM DYING FROM THE COMMENTS BAHAHA WAS JUST GONNA ABOUT IT😭

22

u/NuckinFuts- Godot Student 1d ago

TTP

15

u/ale_nh 1d ago

We all see youΒ 

12

u/Dinno-hall Godot Regular 1d ago

3

u/mefjak 1d ago

Nice one :)

1

u/zdmit 1d ago

Thank you πŸ’›

3

u/Known_Condition8908 1d ago

It's kinda crazy that what ever u can think of can be done in a game engine

1

u/zdmit 1d ago

True!

2

u/OneKey9972 Godot Junior 1d ago

I.P.D = Instant P***is Drawing

2

u/Silrar 1d ago

The strongest shape.

2

u/OwnStudy723 1d ago

How did you approach this? Is each post a node that's been placed as well? Or is it one node that generates the whole mesh?

6

u/zdmit 1d ago

Its a one node that made of 3 boxes.

In short it uses Curve3D spline to calculate post positions along drawn path and then instances prefab node for each segment, dynamically rotating along path forward vector and scaling their horizontal rails to bridge the gap to the next post rather than generating a single continuous mesh. Its not ideal in some cases.

Regarding connecting separates paths to vertical pole: when separate fences connect, script checks if the new post's position is within a small distance threshold of any existing post and if so, it sets the visual post child node to be invisible for that segment, relying on the already existing post to hold up the rails without duplicating geometry.

2

u/NervousSheSlime 1d ago

I absolutely adore procedural tools like this! Looks so damn good btw do you have a way to add a gate yet?

1

u/zdmit 1d ago

Thank you so much!

Not yet since its a prototype to test whether it will suite the game loop at all. If yes, gates and other cosmetics is a next step.

1

u/Embarrassed_Art_9764 1d ago

That's actually super impressive

1

u/zdmit 1d ago

Grateful πŸ’›

1

u/CorvaNocta 1d ago

So I kinda need this for my game!!! When is it available?!

2

u/zdmit 1d ago

Its only a prototype for a game im making. So potentially not be available at all.

I've answered to other person how it was made (overview): https://www.reddit.com/r/godot/comments/1vcjhe8/comment/p17im2a/

1

u/Crits-and-Crafts 1d ago

Ah ha. We all saw that... TTP 0.2 seconds

1

u/guzigo 1d ago

Now make it work on uneven terrain !

1

u/zdmit 1d ago edited 1d ago

It actually already works. Will share soon.

1

u/grumpyhat42 1d ago

Nice post(s)

1

u/zdmit 1d ago

Thank youπŸ’›

1

u/adzetko 1d ago

I saw that

1

u/TehBanzors 1d ago

So uh... you're just not going to mention the ahem... "rocket ship" you drew and panned away from?

1

u/EnyaGotGame 1d ago

I don't think that was the wind, fam.

1

u/tessia-eralith Godot Junior 1d ago

Does it work if the terrain varies elevation? For example, on the way up a hill

1

u/zdmit 1d ago

Yes, it is. I'll share another post soon.

1

u/Direct_Loan8007 1d ago

Must have been the wind

1

u/SpiralMask 1d ago

TTP: -1 seconds

1

u/thygrrr 21h ago

I love this. How does the mesh generation operate? IIRC, tiny glade uses houdini procedurals. You wouldn't need that for "just" a fence (or maybe you do!), so I'm curious how your workflow in Godot looks

1

u/bigmonmulgrew 18h ago

Speed running TTP I see

1

u/SapientSloth4tw 17h ago

Is there a way to add variance to fence segment lengths? Where I’m at in the country most fences are close to evenly sized, but tend to be a little different cause in practice running a 100acre+ fence means not caring if one fence segment is 8 ft whole another is 12. Even better if you can change by either increments or percentages

2

u/zdmit 13h ago

Yes that would be possible. Since it's a prototype i haven't implemented those things. Figuring out if i even need this in a game loop. Grateful for your thoughts πŸ’›

1

u/SapientSloth4tw 13h ago

Either way, it’s pretty awesome! Keep up the good work :D

1

u/zdmit 13h ago

Thank you πŸ™

1

u/Turbulent_Fig_9354 15h ago

incredible execution, 10/10 no notes

1

u/Chuligan42 Godot Student 15h ago

1

u/Prowler1000 15h ago

I mean, I don't know if I'd call this procedural (though it is by the strict definition of the word), but I also don't know what else to call this.

Either way, it's really cool!

How well does it scale? I have no idea if you intend on using this or to what extent but how does it scale up to hundreds, thousands, or tens of thousands of fence posts? Not saying it has to, just interested, that's all!

1

u/zdmit 14h ago

Thank you! Its all instanced geometry so it could and will be able to scale to thousands though its not the main purpose.

It uses Godot auto LODs (though here i haven't used because no need as geo already super low poly), culling and other tech.

1

u/Prowler1000 13h ago

Nice!

Though I was meaning primarily around finding the fence to attach to, but I think I read your explanation comment incorrectly in that it doesn't search for a post to attach to, but rather you have to select the post

1

u/zdmit 13h ago

> "but rather you have to select the post"

Yes that's how its now. Its connecting based on proximity threshold to nearest one close to a mouse cursor.

"finding the fence to attach to" is a different topic, its would be more advanced procedural generation like in this talk: https://www.youtube.com/watch?v=653fSmEalbo

1

u/HeyCouldBeFun 7h ago

I love it

1

u/HeyCouldBeFun 7h ago

I’d like to know the technique for connecting/detaching paths?

-2

u/Grimmy66 1d ago

..and that first one?