• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

I try to avoid global variables as much as possible. Change my mind.

Rob

Member
I've never been in a situation where I've found myself having too many variables... but I've cursed myself for having too many hardcoded magic numbers way too many times. (And let's just say I learned about using arrays to make batch operations on large chunks of data easier way too late - it's easy to get seduced by long lists of say, comprehensible stat names without realizing it'd make more sense to streamline it into an array because you'll do the same few operations on them over and over anyway)
For my own personal experience, after I'd done a few tutorials I thought I was a coding boss (as I'd managed to make some alterations/additions) and I decided to make a Monster Rancher style game. Every stat for every monster was a global variable. If I ever wanted to change something or add new stats, it was laborious to update. Doing anything in the game meant doing it for every different monster and copy/pasting (which leads to mistakes/oversights of course) and during that project is when I got to learn about arrays (but not enums, so I still had plenty of problems).
I lol at myself because I had an excel sheet of stats that I worked with but I updated the arrays manually, which leads to more oversights/mistakes and I just know that if I went to make the same game today, I could do in a weekend what would have taken me weeks back then, and the code would be far less prone to mistakes.
 

Yal

🐧 *penguin noises*
GMC Elder
after I'd done a few tutorials I thought I was a coding boss
This is a well-known psychological phenomenon known as the Dunning-Kruger Effect (or more commonly "mount stupid" because of how it looks in a graph). When learning something new, people quickly go from having no confidence to believing they've mastered all facets of it, then fall back to very low levels when they learn enough to know how much they don't know (usually thinking they're the least competent in their group and trying to hide their own shortcomings, which is known as "imposter syndrome").

Screenshot from 2020-10-12 09-56-09.png
 
  • Like
Reactions: Rob

Rob

Member
This is a well-known psychological phenomenon known as the Dunning-Kruger Effect (or more commonly "mount stupid" because of how it looks in a graph). When learning something new, people quickly go from having no confidence to believing they've mastered all facets of it, then fall back to very low levels when they learn enough to know how much they don't know (usually thinking they're the least competent in their group and trying to hide their own shortcomings, which is known as "imposter syndrome").

View attachment 34953
Do I owe you anything for this consultation :D?
 
Last edited:
Top