yes, i am promptin u to prompt me so i cn respond in the commnts
so like… put a commnt or somthn…
i promise all my responses will be real and written by me by hand, nt by som language model.
in case things get bad
hav a look here.
lets have friendly, fact-based discussions, if any arise… i rlli hope not, i jus wanted dis to be a funi lil thing, jus a post so i get to pretend to be an llm…
Working on a complex Godot project, just like with any other complex software development project, is a difficult and iterative process. 😓
However, there are steps you can take to make it easier for yourself when your project start growing 🌳
Export EVERYTHING 💽
Godot allows you to set properties of nodes or resources quickly in the inspector! so instead of modifying your code to update a value, you can simply enter the changes right in the editor inspector!
To export a property, you add the
@export
keyword! It has many variations, here are some of themMaking changes like this increases your iteration speed drastically, as you can even edit these values while in-game and they will update accordingly!
Custom Resources 📰
Custom Resources are a true blessing in Godot! They allow to quickly assign a lot of values right in the editor, even allowing to share them between multiple nodes!
For example, to create an
EnemyStats
Resource, you can write code like thisAfterwards, in any node script you want, you wan simply export a variable of type
EnemyStats
and now you can edit all the stats in the inspector!
You can access the stats in code like this
var enemy_health : String = stats.health print("This enemy has ", enemy_health, " health!")
and it will print this enemies health.
Working with custom resources can speed up development drastically, as resources can be quickly saved, shared, assigned and modified and they are incredibly flexible as they can contain any godot-native data!
File Structure 📂
Often under-appreciated are clean, easy-to-use project file structures.
Beginners will often cobble together any scripts or scenes which seem somewhat alike and “work out the structure later”.
When that “later” arrives however, they have a mountain of different file types and contexts to sort through to create clarity.
Here a file structure I have found to be very useful, even in more complex projects:
Write your own Tools! (advanced) 🧰
When Resources and a good project structure are not enough and you feel yourselves doing many repetitive steps over and over again, eating up you time, writing your own tools is the way to go!
Godot allows you to add you own custom tool integration into all sorts of places!
If you have any question regarding something I mentioned, or you want to iterate on your video game idea, ask right away ☺️
Are you actually not using LLM? This does NOT taste like LLM. I love this sooooooo much. I love your persona. Holy heck.
I can ensure you that all provided content is 100% human generated! ✅ 🧙♀️
I have made first hand experience reguarding organisational problems and programming hurdles in the Godot Game Engine 🔵 and I could not pass up the opportunity to share my experiences to empower others.
If you are willing to step further and uncover the wide range of Godots capabilities 🧰 just let me know 😉
Thank you Smorty bot!
I had not heard of this usage of the Resource class before, but I think I could use it in the future!
I think properly organizing scripts like you said and splitting up functionality into separate classes would be key to make opening the project and working on it seem less daunting.
You might have to cast that health stat to string, since the type is hinted. You can also use
prints
to automatically insert spaces between argumentsGood advice! This is a great post
Aah yes, of course! Casting the
@export_range(0, 100, "allow_greater") var health : int
to a String 🧶 would increase readability significantly! Let’s look at how this would look likeRunning this code would print this into the Output console:
This way, we make it clear that the health being passed as an argument is a String. ✅
It is important to note that the
print()
function allows for arguments of any type and converts each into a String automatically.So practically, a conversion is not strictly required.
If you have any other recommendations to improve our code or questions about custom Resources, just let me know 😉
Oops, I wasn’t clear! I appreciate the thought process there, I’ll be more detailed.
My first note was for the type hint. That
Stats
resource uses an int for the health property, sovar enemy_health : String = stats.health
would throwParse Error: Cannot assign a value of type int to variable "enemy_health" with specified type String.
It could be fixed by changing the type in the hint, or picking it automatically:
var enemy_health := stats.health
The confusion muddied up my second point, you can replace:
print("This enemy has ", enemy_health, " health!")
with:
prints("This enemy has", enemy_health, "health!")
Which doesn’t do much here, but when you’ve got multiple variables it’s easier than adding
, " ",
between each 😉 I don’t have any other feedback, it was a solid reply with some useful info!Oh, you cought my error there! 😄
Yes, you are absolutely correct and I should have payed closer attention 🔎 🤔
Thank you for pointing out my error! ❌