Godot

6570 readers
99 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

!roguelikedev@programming.dev

Credits

founded 2 years ago
MODERATORS
1
2
 
 

Hey y'all, I'm here from reddit after getting falsely permanent banned and I'm wondering if the community is good?

3
8
submitted 2 days ago* (last edited 2 days ago) by xolatgames@programming.dev to c/godot@programming.dev
 
 

Hi, folks! So, I have the problem with making materials as unique.

Image

I need effects, such as painting of ships in red color, will applies only where particles will spawns. But... As you can see those effects can applies also into other ships.

I've already set these materials as "Local to Scene" into inspector tab.

And have create script for making those materials as unique:

func _make_ship_materials_unique() -> void:
	for i in ship.get_children():
		if i is MeshInstance3D:
			for n in range(i.get_surface_override_material_count()):
				i.mesh.surface_set_material(n, i.mesh.surface_get_material(n).duplicate(true))

But it given me few results 😕

If it can help, here's the script of applying of ships painting:

func damaged_spec_effect() -> void:
	for i in ship.get_children():
		if i is MeshInstance3D:
			for n in range(i.get_surface_override_material_count()):
				_create_fade_in_then_out_effect(i.mesh.surface_get_material(n), Color.RED)
func _create_fade_in_then_out_effect(material: Material, final_color: Color) -> void:
	if material is StandardMaterial3D:
		material.albedo_color = Color.WHITE
		var tween = get_tree().create_tween()
		tween.tween_property(material, "albedo_color", final_color, EFFECTS_DURATION / 2)
		tween.tween_property(material, "albedo_color", Color.WHITE, EFFECTS_DURATION / 2)

So, what do I need to do for solving my problem? 🤔

4
 
 

Some objects sticks with each other when those use CharacterBody2D, and moves like those are sticking together.

So, what do I need to do to solve this issue?

5
 
 

Hey everybody! Recently, we created a shader that simulated an analog clock using polar coordinates, and we'll stick with this type of display a little longer. This time, I'll demonstrate how to program a fully customizable spinner based on similar principles. So, let's start coding!

6
 
 

I'm new to Godot and game dev and I've decided to make my first project (having already finished some tutorials) to implement the Diplomacy board game in Godot.

Creating the logic of the game will be the easier part for me as I've been a professional systems programmer (C++/Python) for several years now.

What I'm struggling with right now is how to create the map and the tiles that represent that game board (online example: https://imgur.com/bfnEMup). Since I will want the game to react to a click anywhere in a particular region, I assume I need to have some Area2D that matches the region's shape. The problem is that it's irregularly shaped and I don't know what the best way to accomplish my goal would be.

The options I've thought of so far:

  1. Import the entire map. Then in Godot, create the areas to approximate the regions.
  2. Import the map into some graphics program. Split the map into a sprite for each region. Somehow save the offsets. And import the regions into Godot, each as its own asset. I assume generating a shape from an imported asset is pretty easy.

Any advice or recommendations?

7
 
 

Hi everybody! I hope the previous episodes have piqued your interest and that you're motivated to learn more tricks for rendering a 3D scene in 2D shaders. As you may have noticed, so far we've been able to change the camera's position, but not the direction it's facing, meaning it was fixed straight ahead, which has been somewhat limiting. In this video, we'll solve this problem, so that by the end, we'll be able to aim the camera anywhere or even set it up as an orbiting camera. So, let’s do it.

8
 
 

How is it? I'm eager to hear any and all feedback.

If any of you are on macOS, I could use your help testing out the add-macos branch. What's currently there is just me guessing at what might work.

9
10
 
 

Hi everybody! And welcome back to our miniseries dedicated to rendering 3D scenes in shaders using the ray marching method. In the third episode, we will bring the previously static scene to life – adding combinations of objects, rotations along different axes and pivots, multiple lighting sources, and morphing using the so-called smooth minimum.

11
 
 

I have instances of this area2d object that spawns and is added to a group dynamically. when they collide I want them to say their name and the group they are in. right now they report their name but not their group and I can't figure out why, when they instantiate they report the group they are in so it looks like they're in their group but when they collide the group is missing.

var type_groups = [ "pluto", "moon", "mercury", "mars", "venus", "earth", "neptune", "uranus", "saturn", "jupiter", "sun" ]

func set_type(t): type = t

# Adjust for paths or hierarchy
var shape = get_node_or_null("CollisionShape2D")
if shape:
	shape.scale = Vector2(type_sizes[t] * 5.5, type_sizes[t] * 5.5)
	
var detect = get_node_or_null("Area2D/CollisionDetection")
if detect:
	detect.scale = Vector2(type_sizes[t] * 5.7, type_sizes[t] * 5.7)
	detect.add_to_group(type_groups[t])
	print("added to group: ", type_groups[t])
	
var sprite = get_node_or_null("Sprite2D")
if sprite:
	sprite.scale = Vector2(type_sizes[t] * 1, type_sizes[t] * 1)
	sprite.texture = type_textures[t]

func _on_area_2d_area_entered(area): print("Collision detected by: ", get_name(), " | group: ", area.get_groups()) set_contact_monitor(true)

12
13
 
 

Hello!

So I installed an addon and saw that it made a license, readme and so on on the main folder. At the moment I didn't had those files there since I'm still very early on the game but shouldn't this files be inside the addon folder instead of the whole project?

The addon is as simple as check for the TODO on the comments but I want to do this properly. Where should I move this files of the addon? Or my License would substitute the one there if it's stronger?

Thanks!

14
 
 

Hi everyone! Do you remember the digital clock shader I created here some time ago? It was one of the first 2D shaders I used in a 3D project, and the result looked very usable. I think a shader simulating a classic analog clock could have a similar application, and that's exactly what we'll be creating today.

15
 
 

The demo for Robot Anomaly is out! Try it out and leave a review!

16
17
18
 
 

Hi everyone! In this video, I would like to demonstrate a shader that reacts to mouse clicks and movements. It is a variation of a shader displaying the Mandelbrot set, which I created here about a year ago. This time, however, we will enhance it by adding the Julia set at a point chosen by the user, and we will add more control elements, all of which will be controlled by the mouse.

19
20
 
 

Hello. I'm at a point in my learning where I see potential to make a big mess and want some advice before that happens. Particularly, how to organize game systems like inventory, damage calculation, level variables (eg. locked doors -> remain unlocked even after the level scene is reloaded).

For Inventory (consumable items, weapons etc), what I've done so far that seems to work is create a global script called PlayerInventory, within it is a list of every item as a boolean variable to indicate if the player has it or not. So now when the player travels through different level scenes, their inventory is persistent and any upgrades remain. Seems to work so far.

But how would you go about doing this for a locked door in a level scene? One way is to tie it to a key, in the player inventory - if "key" == true, "locked" = false. Ok, fine. What about a wooden crate that has been destroyed by the player? How would you keep track of the crate's destroyed state without it being tied to a "key item" in the PlayerInventory global script? Is the solution to create more global scripts, like "EnvironmentChanges"? What script should be responsible for remembering this and where should it live?

With regards to a damage calculation system, I think the high level question is similar- how to organize this? The path I'm going down looks like, "DamageManager" global script which handles the calculations and updates, meanwhile the player and enemy scenes have an "HP" node added, with the "hp" value variable set by the parent (the player or that specific enemy).

I'm looking for high-level ideas about how to make these things work together and to keep it as easy to maintain and organized as possible. More details and specifics are welcome, too. Thanks

21
22
 
 

Hi everyone! In this video, I won't be showcasing any shader. Instead, I'll show you a trick for easily generating 2D sprites from 3D models in Godot Engine 4.4 or higher.

23
 
 

so I have the RB2D collision layer just for collisions, and I have a area2d collision layer for detecting contact between cloned nodes, but it doesnt detect the two earth nodes touching unless I set the area2D collision mask to layer 1 and I'm not sure why.

24
 
 

I just came across this great GDscript reference page and thought it might be handy for other beginners here. Cheers!

25
 
 

Hello everybody!

I have recently started to make small game jam project with friends using Godot. I previously had some experiences with it, but only on solo dev project. I really like it. I recommended it, and we used it on several project with git the following way: we split our project in a lot of small scene to avoid conflict, and everybody works on their branch. We communicate to be sure nobody is working on the same scene.

Now we face problems that could mean the end of our godot usage as a team: After some commit (I'll say the first one after a fetch), the uid of some random scene changes and will cause merge conflicts. It seems that there is no logic to it, and it leads to a lot of time lost, sometimes file corruption. The faulty commits are then extremely hard to track. Today we worked with godot 4.4 and it was even more painful. We lost a lot of our project.

I really want to continue to work with Godot, but I should say that my teammates were talking about learning other engine (and I want to be clear: the git conflict is our only issue; but we took half our coding time resolving conflict, reverting commit, cherry picking, etc. just so the master branch has something working on it)

If I have to choose between believing that our workflow sucks or that it is impossible to work with Godot in a team, I'm 99% on our skill issue. If you have any solution or advice, thank you! If you work on a team and you never had those kind of problem, that is also good to know!

Best

view more: next ›