Game dev secret = use variables. What on earth is this world coming to 🤣
2026-05-20 11:38:32
374
Ratchet :
No offence but this is overstating the concerns of literals/magic numbers a bit.
If a variable is specifically for gameplay data that changes, absolutely store it in class scope and if it needs to be editor modified 100% expose it to the serialization system.
The bigger issue is unnecessary variables over literals. Every class declared and allocated variable increases object size per instance, so hundreds of variables across thousands of entities can become needlessly large memory overhead. Imo not every number needs to be declared and can be a literal in the functions local scope.
2026-05-20 03:46:12
44
sminty :
what you also can do is export it. this will give you a better way of editing it!
2026-06-22 15:18:32
0
Whale Snail :
I only use Unity. does godot not have an innate physics simulation system?
2026-05-21 14:21:48
1
seijicxz_ :
important values like gravity should use const
2026-05-20 15:21:08
25
anzu :
wouldn't doing every frame cause issues between 60 fps and 120
2026-06-13 11:02:04
0
Miles :
What’s the best way to learn coding through game dev?
2026-05-20 00:21:16
0
pikthem :
oh dang. im further along than I thought lol. godspeed to yall
2026-05-19 23:04:40
19
Bouncy Blobs :
Having a file full of constants is what I like to do.
2026-06-19 14:40:32
0
Smile :
I got magic variables of x y z a and b
2026-06-12 02:06:53
0
ba0o0 :
Bro this isn’t a Game Dev secret this is literally just basic programing
2026-05-25 19:19:34
1
strider :
also for jumping is better to use predictable values. It means that you should have variable jumpHeight instead of jumpForce, and somewhere in the code actually calculate how much velocity you need to apply to have jumpHeight for example 10.
2026-06-09 07:22:40
0
Oletron :
valid video cuz we ain't no computers to understand just the numbers
2026-06-08 12:00:46
0
⚫️ Thomas Yanuziello 🇨🇦 :
if you're going to tweak a variable, export it.
if you're not going to tweak a variable, it should be a constant instead.
2026-05-20 01:45:11
9
Sito :
Wanted to do this stuff many moons ago
2026-05-20 23:34:49
1
Chx2 :
This is very cool!... can you just... code everything for me?
2026-05-19 23:48:56
0
Thee Token :
Im a unity user, does Godot not have gravity from objects? Like in unity you get gravity via the editor not the code. But then again Ive never tried subtracting gravity in code, just making it work with the gravity in engine
2026-05-19 23:03:24
2
deha naku naranaku :
nobody makes that mistake past their first coding class
2026-05-20 11:41:58
8
Naoya fan 67 :
lua?
2026-05-22 16:38:48
0
j.s.p.12 :
placeholder usees no memory and do the Same so it's even better
2026-05-20 09:24:09
0
Xander :
velocity+= goes down not up
2026-06-14 08:12:50
0
mauricedevera :
Same logic applies outside code, unnamed spatial problems in a level become the exact same kind of debt. Nobody can fix what nobody named
2026-06-19 19:45:52
0
resonant.solutions :
This is a bit too dogmatic. Magic numbers are not an inherent issue, and in many cases make code easier to read. And that's the takeaway you should have - prioritise making code easy to understand.
Magic numbers have one very strong advantage - they are right there with no indirection. If you do not obfuscate your function and variable names, then not having to hunt for constants is a big plus.
Just look at your example, you turned 2 lines of code into 6, and you've introduced the implication that these numbers are not constant.
Sticking gravity in one place for the entire project is good, but be verryyyyyy wary of dogmatically wrapping every number in a layer of indirection if the purpose could have been understood just by looking at the code.
2026-05-22 11:35:27
0
Illegalez :
Or you could just leave a comment above the function like “//does some shit don’t touch probably will break game” that always works for me
2026-06-12 15:29:09
0
To see more videos from user @inbound.shovel, please go to the Tikwm
homepage.