Godot

6009 readers
76 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

[email protected]

Credits

founded 2 years ago
MODERATORS
1
 
 

Putting a backslash after a part of the statement basically means ignore any newlines between this and the next characters so you can indent it however you want

2
 
 

Hi everyone! Let's add a simple effect simulating a TV signal disturbance to our collection. It actually resembles typical artifacts when playing recordings from a low-quality VHS tape, but it's up to each programmer to find a suitable use for it. And because it's a very simple algorithm with just a few lines of code, this video will be relatively short as well. So let's create it.

3
 
 

I am experimenting with creating a pixel-art mobile game in Godot. I am having trouble with the viewport size regarding the pixel art assets. I've learned that I should set the scaling mode to integer, which adds black bars to the screen. My plan to get rid of the black bars is as follows:

  1. Find a way to resize the main viewport dynamically in runtime
  2. Calculate, based on the device's size, what size the viewport should be
  3. Apply that calculation when appropriate

Before I even try to get a calculation like that going, I want to make sure I can change the viewport's size in the code, which I couldn't figure out myself. I have tried the following:

  • Changing the project settings in a _ready function: Does nothing
  • Changing the project settings in a _process function: Does nothing
  • Setting get_viewport().size in a _ready function: Does nothing
  • Setting get_viewport().size in a _process function: Changes the size of the viewport, but without expanding it
  • Setting get_window().size in a _ready function: Does nothing

What else can I try?

4
35
submitted 4 days ago by popcar2 to c/godot
5
 
 

This lets you type parts that are differentiated from the other variables quicker while still having enough to smart pick it

6
30
Godot 2024 Showreel (farside.link)
submitted 1 week ago by [email protected] to c/godot
7
 
 

Hey everyone! The end of 2024 is slowly approaching, so I thought it would be good to add at least one more post-processing effect before diving into something more complex next year. This time, it’s again about layering, with each layer shifted differently using a noise texture and rotation. With a bit of imagination, the result can resemble a painting where the colors have blurred and blended together slightly. Let’s take a look at how this algorithm works.

8
 
 
9
 
 

If you do this remember to free the old one (or have some way of accessing it) since the engine won't do it for you

10
 
 

Fly, dodge, and barrel roll your way to the win! Challenge yourself to beat the high score. Now with tons of maps to choose from and lots of replayability! Do you have what it takes to master the glide?

Playable the browser on PC. All feedback is welcome.

11
 
 

This is useful to see where specific prints are happening

12
56
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/godot
 
 
13
47
Godot - Priorities page (godotengine.org)
submitted 1 week ago by popcar2 to c/godot
 
 

The team made a new page to see what they're prioritizing at the moment. Neat!

14
 
 

Alternatives to doing this would be to right click and then hit the close button or to use the hotkey for it (defaults to ctrl + w)

15
 
 

Missed some days due to exams but more daily posts should be happening now

16
 
 

Context: The default 3D physics engine of Godot is really bad, so one of (if not the) most popular extensions for Godot was Jolt Physics, replacing the old physics engine with Jolt (which is what Horizon Forbidden West uses).

Jolt not only has way better accuracy and less bugs, it also performs better. There is no reason to use the official one compared to this.

What this means:

  • Jolt is coming to Godot 4.4, it's currently not a default since it's experimental (you can switch it on in the project settings), but once it becomes stable it will be the default physics engine.

  • The Godot Jolt extension will be in maintenance mode since it's now built into the engine itself.

  • The old physics engine will still exist for now (probably for backwards compatibility's sake).

The wait for 4.4 continues.

17
 
 
18
 
 

Hey everyone! Let’s create a simple shader that will shake our screen or an element on the screen as if an earthquake has occurred. This could be quite useful in various platformers, right? And, in fact, it’s very easy to implement. Let’s get coding.

19
 
 

I'm having trouble figuring out how to tell when a tool script is rebuilt in Godot mono 4.4. When the build project button is pressed the ONLY notification that the node receives is NotificationWMFocusOut and NotificationWMFocusIn so _EnterTree/_ExitTree and _Ready are useless and never called.

My node has several RIDs that are sent to the RenderingServer and PhysicsServer3D but when the project is rebuilt there seems to be NO indication that it is being rebuilt so the node loses reference to all the RIDs (preventing me from freeing them) so they are still visible as ghost objects in the editor that don't go away until I reload project.

Has anyone figured out how to do this properly? I'm totally at a loss...

20
21
 
 

This is usable in any script. It checks to see if the two values differ by a very small value

Alt text: Code that says print(is_equal_approx(1, 0.99999999999)) and then the console log which has printed out true.

22
 
 

This will be available to click on if you have a web export template

Alt text: Clicking on the Remote Debug button in the top right of the Godot Editor and a menu popping up that says Run in Browser on a button, and then Start HTTP Server on a button

23
29
submitted 2 weeks ago by popcar2 to c/godot
24
22
submitted 2 weeks ago* (last edited 2 weeks ago) by Zykino to c/godot
 
 

I have been looking for a way to move non player entities on the map. For example I want cars to move around road, a parking lot, … I found way too many options without comparaison to see pro/cons. Is there a ressource telling which option is privileged?

I saw (in 2D, but I suspect all/most have their 3D equivalent):

Option My understanding
Path2D Very rigid path to follow (only saw used with tween). Can be nice to follow tracks, insert cubes in slot, … But when trying to have a more natural movement, with a bit of variety thanks to physic I don’t see how to do it.
AStar2D (and the AStar2DGrid variant) Robust algo known everywhere. Can add weight to connections. I suspect to make it work we have to give points to reach so we should "cover" the maps with points and link them together
NavigationServer2D Same as AStar2D but experimental, more automatic. Instead of specifying all the point we specify accessible zones. But adding weight to the connection is less obvious (using NavigationObstacle2D?) may be less customizable also?

Are there more options?
Is my understanding of each correct or completely wrong?
What is "the best" one (in Godot 4.3)? Like is there big performance drawback for some (at 100 entities there are lags or whatever)?

Keep in mind that I want my game as little as I can to understand how Godot/game engines work (I’m a developer so that part is easy, Scenes and Nodes choice less so), I don’t really care if using experimental feature means it disappear at some point or change behavior.

Edit: Just found out the official page explaining the different methodes.
So AStar is for grid/pathing on a set of points while NavigationServer can navigate to any point on the accessible area and uses A* as an implementation detail.

=> I think for my use case A* is better suited since I want to move on roads (that look like a grid with weight being the length).

25
 
 

Theres similar settings for paths, navigation, and avoidance

Alt text: Hovering over the Visible Collision Shapes setting in the editor and a tooltip showing with "When this option is enabled, collision shapes and raycast nodes (for 2D and 3D) will be visible in the running project"

view more: next ›