Entrance Chat Gallery Guilds Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
January 02, 2026 - @677.63 (what is this?)
Activity rating: Three Stars Posts & Arts: 33/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: ozwomp is requesting your location  :ozwomp: [Agree] Guild Events: There are no events!

+  MelonLand Forum
|-+  Virtual Worlds
| |-+  ❤︎ ∙ World Building
| | |-+  godot decoupling tips?


« previous next »
Pages: [1] Print
Author Topic: godot decoupling tips?  (Read 380 times)
b3e3e3
Newbie ⚓︎
*
View Profile WWW


⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2025!
« on: December 12, 2025 @51.42 »

currently working on a game in godot and i feel like i have a ton of spaghetti code. a lot of things have smart designs, but a lot of other things are shoved into hard references to node instances, singletons, etc. etc. how do you usually decouple things in godot? i know this is a broad question, but i'm looking for broad answers-- situations where this has been relevant to you, times that you have struggled with this, stuff like that. i'm curious!
Logged

GideonWilhelm
Casual Poster ⚓︎
*
View Profile WWW

⛺︎ My Room

Artifacts:
Joined 2025!
« Reply #1 on: December 12, 2025 @618.88 »

I don't have a firm answer, but seeing as how I'm gonna be starting work on a world editing tool in Godot after I get some shuteye (somewhere in the ballpark of 400-500 beats from now) I wouldn't mind thinking this one over while my ADHD's in overdrive, and I could probably use whatever I come up with later for my own stuff!  Sadly, I know *very* little about singletons and instances... I haven't done a lot with the engine besides character controllers and little environments to run around in, so I'm not exactly a pro.  That said...

What are some examples of stuff that's hard coded that you want to decouple?
Logged
NoxidKin
Jr. Member ⚓︎
**
View Profile WWW


Hey please check out my blog! :)
⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2025!
« Reply #2 on: December 12, 2025 @762.75 »

You know, I was just thinking about this specifically for myself.

I'm going to try to plan out my architecture in advance, for once.

My thinking is to hold all functions in singletons, practically the whole game.  And the only thing scripts on objects can do is call the singletons.

That way, moving nodes around will basically never be an issue, and I know where to find everything.

Some obvious scripts for me would be GameStateManager MenuManager IngameUIManager IngameEventManager AudioManager, and so on...

As I said, I haven't implemented this at all, but it's something I want to try.

Oh and another bonus is modularity.  Scripts like AudioManager should be useful in pretty much any game.
Logged

MediocreMetastasis
Sr. Member ⚓︎
****
View Profile WWWArt


Personal Text
⛺︎ My Room
Itch.io: My Games

Guild Memberships:
Artifacts:
Joined 2025!
« Reply #3 on: December 17, 2025 @287.09 »

Not sure what your situation is but use @export to be able to use different values for multiple nodes using the same script.
You can also make custom Resources which are basically classes (you can just make normal classes in scripts but resources and more user friendly).
You can also autoload scripts and orphan nodes that you can access anywhere through the Globals tab. I use this for accessing settings values storing level data and global functions such as a function to shake the camera or a function that instantiates and plays an audio clip.

also if you're using the same node in multiple places, make it into a scene.

Additionally, learn how to make a state machine, that will dramatically help with modularization.
Logged


Artifact Swap: Wolfy EvilWolfy SusWolfyAngy DoggoHE WATCHES YOUThe fingerShocked DoggoSad DoggoHappy DoggoNeutral DoggoShocked SharaAgent JerrySunny the Puppy
Pages: [1] Print 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi