When you’ve just learned about arrays, and decide to apply Maslow’s Hammer
Forget about the giant mutable global array, magic numbers and ints instead of enums for a second.... how the fuck does "instance_destroy" know which instance to destroy?
It doesn't look like it's in a class something like "this" in whatever language this is isn't being passed? Maybe though... idk. The method has no parameters.
This is GML (gamemaker language). It doesn't look like it's inside of a class because of indentation but effectively it is (or, more precisely, the code is run in the context of an instance and this instance will be destroyed)
So it implicitly passes self
? That sounds very unpleasant.
Not that insane of a pattern for a script attached to a specific object
Maybe it looks at another global variable that tells you what quest you are on. It could also temporarily end the entire game instance and then it would reload the whole game with the new quest value being complete and whatever changes that results in, though that’s a Morrowind “restart the Xbox every so often instead of fixing the memory leak” level of solution.
Why use separate flags when big array do trick?
I mean at least a dictionary, because then it's a nice map.
Hash key lookup slow, integer index fast, me grug, best programmer
I call it integer indexing, rhymes with grug
If you define a enum for the index you can have understandable names in the code so it kind of works like a dictionary at programming time.
Still cursed, but slightly less (or more in some eyes)
Oh no my 1 picosecond operation is now taking 3 whole picoseconds what will I do
Ehh indexes wouldn't be as bad if he used Enums so it's at least readable.
Really this all needs to be in its own little tooling to create the quest and dialog data and flags.
Ideally yes, but dialogue systems suck to make no matter which direction you take.
And considering he has very little coding experience, it is a somewhat reasonable way to implement it.
My bigger issue is that somebody with supposedly two decades of industry experience and working on a solo project for nearly another decade should know better.
But instead it's code that even someone halfway through first year comp science would look at and think "this is so ass, surely there's a better way to do this" and then looked it up.
The array isn't necessarily bad, but the magic numbers to access the data are, at least define some constants.
Isn't what memory is, anyway?
That's just the beginning of a grassroot movement. It will peek when people use literal pointer accesses, instead of these fancy arrays.
Maybe he thinks it's 1955 and you have to use a single array to save space.
who dont remember quest 367 but 253 was better imho.
It's even worse, it's not even an array of full quests, it's a "things that can happen" array.
An unspecified interger array with a thousand manually created entries that mean random stuff like "Did we drink the coffee on the table" lmao
Truly something only a rockstar Blizzard dev and government hacker could think of.
Oh my dear god, this is an array of flags?
Yes, each item in this array is flag for specific interaction. Not only that, related interactions (like belonging to the same event/quest) are not even next to each other.
He actually shows part of it in his stream - this is how it looks like
This is gonna be an absolute pain to restructure if he ever tries to. This is off the top of my head and flags are fine but I would have built quest objects that contain all the flags that pertain to that quest along with the tasks for said quest. Quests usually are a set of tasks so that could be a struct and each individual task could be a struct that contains the individual steps
Even if this game doesn't have generic quests "go kill this" "talk to this" "pick up this object" you can break down any step into a task to fill the structs with and it would be dead simple to add new quests or scenario, plot-points etc.
Add additional methods that complete the quest that talks to some UI that updates and checks flag there, again this is napkin design
I haven't looked too hard into this game - the whole Thor situation is such a mess I don't even want to - but for what it's worth, I think it's a game very similar in structure to Undertale, which means there are no 'quests' in a traditional sense and every tiny little flag will compound to alter the story. So categorizing them into quest containers doesn't really make too much sense.
Having one giant array with magic numbers is fucking crazy, though.
I think 253 had great worldbuilding, but storywise it was lacking. Quest 969 was a banger tho
Unfortunately quest 374 was deleted last year and you just overflowed into the sa̶v̴e̸ ả̸̬̼r̶̺͚͛ȇ̵͈̣͌͝a̵̪̝͕͉̦̙͒͒͐̎
uh, excuse me, but thats called obfuscation
now you wont be able to reproduce his awesome game just by looking at the code here
The obfuscation is so good that neither can he! at least based on his lack of updates to his game in the last 6 months
That's the kind of shit we did in like the first to years of school when we had no idea of what we're doing, lol
This is pirate software's 20+ years of programming experience on display
“20+”, yeah right, it’s full of cybersec shit and not game dev experience
"Cybersec" being mostly social engineering
Not enough mention is made of the fact that he actually has years of professional experience in social engineering, not programming.
He just then used social engineering to convince people otherwise.
He's probably the best social engineer in the world then. How can you manage to convince anyone this was the result of 20+ years of experience
You convince people with 10 minutes of experience.
Most people just see code, and have no experience in evaluating the quality of code.
And when he, with a shit ton of followers, says that he knows what he's talking about, then people with no experience obviously will believe him over some random guy he labels as a "hater" or "grifter".
Most people don't know shit about coding. For someone who might just randomly stumble upon his content, like me, they won't understand what is wrong with this
Social media is optimised to enable narcissistic behaviour.
He's rarely shows it and never codes on stream, if you watch the first codingjesus breakdown he talked about his research before talking about his code and he quickly found out that out of all of his coding live streams only like 2 showed actual code from his game and none of them were him actually coding just putting it up on the screeny like in the image and talking about whatever.
Not that everything else this guy seems to do isn't absolutely risible, but I couldn't imagine ever coding on a live stream. Even if one writes the most beautiful, elegant code in the world, the actual sight of one doing so could be anything but!
I would agree, i had a manager who has a big 42" tv in his office and routinely asked other devs into his office to "help" with a coding problem always turned into a "government" job him coding and 2 to 3 other people watching and wasting time.
I imagine the streams would feel kinda like that or pair programming with no input which is also miserable.
That being said if your watching someone knowledgeable tackle complex issues it can be fun to watch. But I could be an anomaly on that one.
I'm sufficiently arrogant to think that my code is pretty good (as in: much better than average) though not perfect, and I think that "seeing the sausage made" might help other people write better code even if some of the intermediate steps aren't the prettiest.
On the other hand, it would be boring as hell to watch me code, because it would be like: 20% actually typing code, 40% staring into space, looking things up, browsing source, etc., and 30% adding a ton of variations on tests, and 10% debugging test failures.
That 40% would probably balloon out to like 80% if I had to try to narrate it, too: when I'm thinking deeply, my internal monologue disappears or switches to just little fragments, and trying to talk about what I'm thinking would make it take so much longer. I would basically have to interrupt my thoughts in order to put them into words.
As a cybersec engineer and developer, there’s no cybersec at play here either. His so-called DRM is a fucking boolean flag that is set in a simple if-else statement that any idiot could patch out in 5 minutes. And he claims it’s “unpiratable”…
You mean using the Steam achievements as DRM?
That was for another game
I wonder what happens if I want to start a new game
It isn't supported, but if you pirate it it is fairly easy.
My favourite comment under this video by Slop News Network is
Guy really said his software was unpiratable and wrote "if pirated = true, dont"
from @VeeIn3D
Ahh. Like the good old no CD checks used to be. I loved to disassemble them as kid and patching them using a hex editor. Good times.
Haha that brings me back. Before that I think we used tape to beat the "copy protection" on some diskettes.
His social engineering way to stop piracy was to regionally decrease the price of the game until piracy stopped. Which is nice, I suppose, but technically encourages piracy by making it an act that benefits others.
He wasn't in cyber sec. He was a QA tester. He claims he moved to security but since there is literally no proof or even evidence he did anything other than buy the team coffee and lunch, it's been pretty contested.
He found bugs in games and reported them. I mean it's clear he can't do anything else.
I believe he mostly complained the devs can't do anything right in a little room, playing the latest build as I doubt anyone read anything he reported. He was there because daddy was top brass. And everyone knew it. And he knew it.
His personality is bewilderingly insufferable, so who would even want to listen to the guy on the off chance he was even right!
I guarantee when this dude showed up at the water cooler, everyone instantly dispersed.
Edit: fucking grammar
He worked at blizzard doing qa work and social engineering. He is not the uber 1337 hacker he wants you to believe he is. He got his claim to fame during the apex legends hacking incident by portraying himself as a subject matter expert but later on it was proved that whatever he proposed was actually wrong. This guy gives a bad name to actual cybersec people who I assure you would write better C code than this even for their one off programs.
Wait until you see how he sets every value of an array to 0.
Spoiler: it’s not a for loop
I wouldn't use a for-loop for that. I'd use memset. Compiler probably optimizes it to the same thing anyway, though.
I feel like anything would be better than manually going through each value and setting it to 0
Yes. PirateSoftware is a joke. This would be a failing grade in a first-semester programming class.
My failing grade in first-semester programming was a very fancy vending machine. My code was 10 pages (it did not work). The solution was about half a page. Professor told me to get out while I could. She was right.
Does Game Maker script have memset?
I sincerely doubt Game Makers scripting language has the ability to manage memory at that level
Did he really set each value individually?
He sure did. Ive heard people saying he doesnt know how to even use a for loop
He also incorrectly thinks his programming language of choice does not support booleans. He wasn't merely unsure, he confidently statrd that they were unsupported, despite his coffee using them, but only in around 10% of the places they should be used.
Coding Jesus talked about this. Basically GML doesnt have a native boolean data type. However, it supplies enums for True and False (0,1) that they say you should use as a future proofing in case GML does add a bool type. Pirate argues that because the compiler recognizes 0 and 1 as boolean values that him using the integer values instead of the enums is actually good programming.
He sure did.
That's so sad but also hilarious.
He shouldn't be using an array at all. A loop would just make the implementation even more incoherent. He should drop the array and use an enum.
Yes, but not because he doesn't know loops.
He did it because he doesn't know what enum is and needs comment for every item explaining what those magical numbers mean
First year code looks like that, second year code is the entire game state being stored in a long
that’s being abused with bitwise operators “because it’s more efficient”, third year code uses over complicated data formats and architecture “because design patterns are important!” and fourth year code (and onwards) doesn’t exist because the student is either depressed as fuck, too drunk to work on any personal project or too busy on their final project/exams - or, more commonly, all of the above.
It’s fun though. I miss writing being able to write shitty code without feeling bad and/or doing crazy (but useless) optimizations just for the heck of it. Now I just feel dead inside and think “ah come on you could have defined constants for these magic numbers at least”.
This guy has 20 years game dev experience and he used to work for the government as a professional hacker. According to his statements.
If you look into what he was actually doing for the Government, you'll realize he was just a low level keyboard patsy. He makes himself sound like he was Mr. Robot.
He worked as a social engineer writing phishing emails, not hunting for 0 days
I remember seeing a short of him saying that if Undertale has terrible code, then you don't need to worry about good coding practices. Hos example was literally what we're seeing here - a huge, jumbled, nested switch case.That's when I realized this guy is complete dogshit.
if Undertale has terrible code, then you don't need to worry about good coding practices
That's completely true though, Toby Fox is famously a terrible programmer, and yet his games are immensely popular. You don't need to be a good programmer to make a simple 2D RPG.
At the end of the day, if it works, it works. I do a lot of that with personal projects. I don't claim the code is good, though. I'll be the first one to point out that my approach is probably dogshit mental but that's what I figured out and it works and I can't be arsed to refactor it.
Although when I'm working on something I get paid for, I strive for good practices. Someone will review it and someone will have to maintain it eventually.
Okay but that's kind of survivorship bias, isn't it? A terrible programmer was able to create a very successful game does NOT mean that terrible programming is good. There were many other factors at play. Truth is, good programming more often than not will save you game-breaking bugs or at the very least help debug them much better.
Edit: I'll clarify- my point is that bad programming practices shouldn't be encouraged. And Pirate was pretty much actively encouraging writing bad code because "it worked for Toby". I don't agree with that take personally.
does NOT mean that terrible programming is good
Nobody said that though. "Terrible programming is enough to create a good product" is all that was said
Best part is you know he's the type of dude to go "actually in certain situations it's more performant and I can read it so your point is invalid"
I hate you. I read this in his voice.
He's also commenting every single line
A lot of people could do more commenting, but having "Do nothing" over a break is just unnecessary. My first thought on a comment over a break is that it's just a placeholder for now.
having "Do nothing" over a break is just unnecessary
It is unnecessary, but I don't mind the "Do nothing" as much if you look at it from the perspective of intent rather than the perspective of documentation. Adding this comment immediately clears up any confusion about whether we intentionally do nothing or whether we forgot to add a function call.
Code should be self documenting, comments should be for explaining stuff that's unusual in your code.
edit: well now that I think about it, it makes sense then for pirate to comment each line, considering the absolute state of that codebase...
I used to think that way, but now I'm writing more comments.
For example, a block of code might be absolutely readable and clear because of how all the variables and functions are named, but it'd be of GREAT help for anyone reading that block to have a small preface as to what to expect from this code.
Having a "# Performs X on A but not B" before a fully readable 10-line segment primes the reader's mind into verifying whether you're performing that X correctly and makes them more likely to notice whether or not you're checking for B in the right way
I agree, self documenting code has 2 faults.
1) it expends more mental effort to parse code than to just read a comment telling you what it does.
2) comments can give you the intent of the author, making debug work much simpler
For someone reading the code for the first time, everything is unusual or non-sensical. Almost no professional code I've seen, including commercial software, is self-documenting. Unity's or Unreal's production code is horrible, for example.
Many important Python libraries have horrible documentation too.
I'm actually ok with the "do nothing" comment because it means it's purposefully doing nothing instead of accidentally not implemented, not taking into account better ways like just having the default case do nothing. What I do have issue with is the "have we done this" comment. That is completely useless because 1) of course you're checking if it's been done, what else could that line possibly mean 2) it doesn't even say what "this" is, which would be the only saving grace as it would at least serve the purpose of explaining the magic number.
I'm not so sure about that one in particular. If the comment is there to explain what is happening in the code it's stupid. But sometimes I create all my functions, branches in a switch case, methods of an Object etc before I implement them. So for someone else it might look like you just forgot to implement this specific case, and the comment makes it clear, that it's intended to just exit and do nothing else. In that case I think it's not that stupid.
Well...
Bitmapping and masking is more efficient
He can't read it. That's why he has to comment everywhere. He probably started doing this after the 14th time he forgot what 1 meant in scenario 364 and lost 30 mins looking it up (They're not global, they are ordinal by character in scene)
Then just use enums
That would require knowing that enums exist.
You forgot "eat my whole ass"
Opens up MS PAINT to sketch the reason his code is good and we're all wrong
“You’re a disgusting human being”
This is the same guy who built the unpiratable DRM that was pirated in 1 day.
He is called pirate software, maybe he wants his software to be pirated
Nope, he's actually extremely anti-piracy. He chose that name specifically so that when people googled "How to pirate ____ software" his YouTube clip channel would be in the top results. It's just annoying SEO manipulation.
Considering his stance on SKG, I doubt that
He said his save game where steam achievements, so pirating the game wouldn’t let you save because you weren’t getting the achievement.
Interesting to hear that a leet hacker has never heard of the arcane technique of patching the binary.
The weird thing is, how would you start a new playthrough? Is he gonna take away achievements or just grant you the progress instantly?
Whoa whoa calm down. The GameMaker tutorial didn't say anything about a 2nd play through
The #1 steam drm bypass for over 15 years now (Goldberg emu) supports faking steam achievements.
His game he claimed was unpirateable on some clickbait youtube short was uploaded to some piracy site the week it released on steam (before his shitty YouTube short lying about it being unpirateable)
And its funny because that guy probably thinks he is smarter than other big gaming companies who pay huge money for Denuvo
this is literally the text adventure game I made when I was 12
tbf hes programming like he worked in QA fulltime. which is true.
Which is fine! If he wasn't going around acting like he's some expert. He literally considers himself to be "The Bob Ross of programming", which is not only the corniest shit I've ever seen, but disrespectful to the actual Bob Ross! His code is an absolute nightmare to look at! This man literally sets individual array indexes to 0 instead of using a for loop. What the hell?
YandereDev right now is probably like: "Finally, a worthy opponent!". Kinda hilarious how Thor and YandereDev are close in popularity, shittiness as a human person AND shittiness as a programmer.
As I recall, wasn't Yandev's entire state of the game stored in one massive string? Which they had to delimit, split, read, and make edits to in order to update? At least this is already an array...
Times like these are reminding me that Tobias dog's (Toby fox) entire UNDERTALE dialogue is in the hands of a singular switch statement
Difference is that Toby doesn't pretend to be an amazing programmer, If you told him his code sucks he'd probably agree with you lol
Also Toby actually delivered his game and it is that kind of game where he will not touch its code ever again after bug fixing.
“One day, I randomly read about arrays, and realised I could program a text system using them, so I decided to make a battle system using that text system, which in turn gave me many ideas for a game. Then I decided to make a demo of that game – to see if people liked it, and if it was humanly possible to create.”
He found out about Arrays from wiki-fucking-pedia and was like: surely, I could right? With no regard for sanity or any worldly limitations.
What do you think would be a better option, a tree ? I really don't know how games manage so many conditions. It really surprises me how many interactions a game like Skyrim has.
Disclaimer: i’m NOT a game dev. i’ve taken 1 course on unity game dev in my ms
at that scale it may by relevant to have some type of sql lite database to manage each character’s dialogue lines. they would each have a hash/pointer/reference to a directory where all the actual voice acted lines are stored.
it would be easier to manage over time, add, delete, update, as well as create backups. this may work better on a team as well.
alternatively, you would store all the dialogue in some XML/JSON file which is a tree structure. so unless you had a second data type indexing it, it would be fairly slow to parse.
you’d also want to leverage some event driven design. entering a new area is an event that has context like a group of characters. along with if you’re on a quest or something. these character models/data type can be loaded into the game state.
Insert into DB ```SQL
INSERT INTO npc_dialogue ( npc_id, location, trigger_type, text, audio_path, conditions ) VALUES ( 'nazeem', 'whiterun', 'proximity', 'Do you get to the Cloud District very often? Oh, what am I saying, of course you don’t.', 'audio/nazeem/cloud_district.wav', '{"player_has_not_attacked_nazeem": true}' ); ```
Event Driven Game State Load Example ```python def load_proximity_dialogue(npc_id, location, player_context): conn = sqlite3.connect('game_dialogue.db') cursor = conn.cursor()
cursor.execute('''
SELECT text, audio_path, conditions
FROM npc_dialogue
WHERE npc_id = ? AND location = ? AND trigger_type = 'proximity'
''', (npc_id, location))
rows = cursor.fetchall()
for text, audio_path, conditions_json in rows:
if conditions_json:
conditions = json.loads(conditions_json)
if not all(player_context.get(k) == v for k, v in conditions.items()):
continue # Skip this line if conditions not met
play_voice_line(text, audio_path)
break # play first valid line
conn.close()
def play_voice_line(text, audio_path): print(f"NPC says: {text}") # You'd hook into your audio engine here print(f"[Playing audio from: {audio_path}]")
player_context = { "player_has_not_attacked_nazeem": True, "player_faction": "none" }
load_proximity_dialogue("nazeem", "whiterun", player_context) ```
you would probably want a function or member of some larger object where you define all the static game state like “players in X village regardless of quest/game progress” the perhaps another function or member of object that can inject any players in the game state for a particular quest you are on. the quest has priority and will overwrite the first injection.
"Do you get to the Cloud District very often? Oh, what am I saying? Of course you don't."
I'd guess each NPC object holds their own dialog tree, maybe that's a switch statement or maybe it's a tree structure. I've never done game dev and never looked at skyrims code, but it makes sense that the NPC object holds all associated info, like health, inventory, and dialog. There's no reason to shoot a guard and go through a switch that's like "did he shoot a dragon? No. A bear? No..... A guard? Yes, lower health.", same for talking - you already know it's a guard, skip to the next bit.
Come on that's not fair at all
Thor isn't exactly a great person but he isn't nearly as bad as a pedophile
They are not close in shittiness bruv. Thor might be pretentious, stupid, etc. But at least he's not a pedophile
Oh god, is he hard-coding the game's plot? I thought most devs had stopped doing that by the mid 90s!
Forgive the ignorance but what would be the common way of doing it instead of hardcoding everything into an array
Pobably a JSON or CSV to record story related flags into. Or AT LEAST use a dictionary so its not "if arbitrary.value[576]" but "if story.get("flag")" and is understandable on a glance
Yeah 576 means nothing, especially for anyone else reading it, but if the indexes were at least Enums or hashmap/dictionary keys like StoryArc1_Quest2_NPC_Dialog1 or anything which places the value in the wider scope of the game you can at least tell what is happening.
Seperate script files would be best for maintaining the code base.
This is pure spaghet
I'm not a game developer but if we're talking text, it would probably be better to just use text files and load them with each new chapter in the story.
Should also help with adding new languages, just send the files to the translator.
You pick the right data structure and abstraction for the job.
Here he managing some state (I guess quests?) in a giant array. The obvious drawback being that there are a bunch of magic number that are incredibly hard to debug.
One way to manage this in a more readable way is to use an Enum to index the array, or a hashMap. This would allow you to reference the story line of going to lunch as global.story_line[GO_TO_LUNCH]
or global.story_line[”Go to Lunch”]
or whatever.
This would make it much more readable and significantly less likely for us to make mistakes.
Additionally, the value can hold a struct with the state instead of some magic number that we need comments to decipher. E.g. using Enums would make this so much more readable and get rid of the comments too.
With more context I would probably be able to construct something even more useful, but just using Enums would likely drastically reduce bugs and increase development speed.
Script files. It's not just games, either; a very powerful way to approach any complex computing problem, especially when you expect to have to attack multiple disparate examples of the same class of problem (e.g. releasing a game sequel, in this context), is essentially to first write your own tailor-made, ultra-specific mini-programming-language within one of the big workhorse general-purpose languages. This is probably why many traditional programming textbooks focus heavily on how to write parsers.
See also Greenspun's Tenth Rule.
A highly desirable side benefit of using script files is that you don't have to excruciatingly slowly recompile your entire executable every time you want to make any change whatsoever to any part of your game, even a line of dialogue or a graphical sprite or something.
This is Game Maker language, though, which is a already scripting language, I think. And that doesn't answer how the state should be managed. The state that will be saved in the save file.
(You can use structs with named fields instead of an array with indices.)
> is essentially to first write your own tailor-made, ultra-specific mini-programming-language within one of the big workhorse general-purpose languages.
that sounds quite complicated, is that reaosnably doable for someone with not much programming experience?
Well it is quite complicated and too much work honestly. The best way is to use Lua as it's very lightweight (the lib is ~300kb) and easily integrated into your engine.
Then you could perhaps resort to an "event-driven model", e.g. you have functions in the Lua script for OnCreate for when the entity is created, OnUpdate, OnCollision, OnDraw etc.pp.
Any other data structure basically.
Something where the properties have useful names. A class, a struct, frikkin globals, anything other than an array.
You could even still use an array but index it with named enums!
As someone who doesn't code much other than simple scripts, I'd like to know too.
https://en.m.uesp.net/wiki/Skyrim_Mod:Mod_File_Format/QUST
here's a breakdown of how Skyrim stores quests
I'd opt to make the data structure more modular so you look up data by quest or area then flag, but if that's not an option I'd at least use a dictionary or even an enum to avoid magic numbers.
There's quite literally no other way to do it, you have obviously never used gamemaker.
/s
having to change every single one if you decide to add, change or remove something, is peak comedy.
He worked at Blizzard btw!
Maybe he was that one breast milk thief too...
Low level test monkey on the night shift.
In-between tasks he was perfecting the art of MS Paint
he didn't even work as a developer/programmer.
i guess now we know why he workED for blizzard
Yandere Dev 2
Yandere Dev never claimed he knew what he was doing.
Yeah, the major part of it all is if he just said "yeah, the code is messy and not super professional, it's okay with me but it sure can be improved in many ways" this would boil down to some jokes and memes, and the crowd would move on. However, cause he needs to defend this obvious garbage to maintain his image as a self-proclaimed tech guru who can't get off of his high horse for one second, he blows this out of proportion.
There's nothing wrong with not being a proficient programmer in your own project, but at least own the reality of it. It's possible to make a good game with a shitty code, it's mainly your problem if you're a single dev and you still deliver. But you just don't get to pretend to be a 1000x super senior dev while doing that.
Especially when his actual production speed is more like 0.1x despite writing like this
Yandere dev made more regular updates to his game than this guy...
He's out of mana guys, what do you want him to do ?
You just got added to the array, bud. Hope it was worth it.
*big switch*
I'd honestly love to see him defend his decisions with his 20 years of AAA games development and hacking. Maybe a live code review.
There was a guy who called out his code, a guy on YouTube called CodingJesus, and he got really upset about it lol and just devolved into calling the guy names. For example he called the guy a "grifter trying to fight for relevance" despite that being exactly what pirate has been doing.
https://youtu.be/HHwhiz0s2x8 - first video by CodingJesus
https://youtu.be/Q6aRA0szfiI - and this is where he goes over pirates response
if player.hasattr("career"):
player.career.destroy()
I know this is a stupid way to do it, but what would be a better way?
I've found enum like STORYLINE_FERN_HUG and so on help turn integer array access (simple and fast) into something human readable. And your IDE can help spot when you mistype.
So instead of dialogue_array[27] when it should be 28. You have it clearly: dialogue_array[FERN_HUG]
There more subtleties and things you can do but that's the gist.
Avoid global Singleton objects like the storyline array shown here. It's possible that the storyline array has read only access but I doubt it, meaning that it would be very easy for any class to mess with the wrong story line index making bugs that are difficult to track down because everything has public access to the primary state object of the game. Would be much better to break the full story line down into practical units and then only allow an object access to the piece of the storyline that it is concerned with.
Avoid magic numbers in favor of enumerations or constants that describe what the number means. This applies to the index numbers being used, and to the integer results that are being stored. Here the coder is using comments to notify the reader what values are being retrieved and what the result is, but it's very easy for the comment and the value to disagree with each other, making it difficult to debug and difficult to spot in a code review. From the style shown, it's likely that the results and the index values are probably in a comment elsewhere, which means you need to verify in two different places to make sure that it's even the correct value.
But I want a global writable singleton so speed runners can manipulate it to jump directly to the end of my game.
if you're talking about the switch case, a simple if statement is enough i believe because only the first switch case mattered
if he's doing other similar (dialogue, I assume) implementations with a switch case, it would make sense to use a switch case for this instance as well, at least from a consistency perspective barring efficiency/portability/readability concerns.
The biggest issue that stands out to me is magic numbers. Just use an enum, even if it's not the cleanest or most efficient thing, it makes the code 100x more readable. Not to mention the fact that you don't even need the `case 2` at all. Delete it and throw in a comment saying 'no dialogue options for other characters' or something if you want to be verbose.
My man was too busy being the tech lead at blizzard to check what magic numbers are. My eyes are burning.
No shit his game is taking that long to make, imagine trying to remember what every index represents after a few weeks.
Didn't he say there's an ARG in the code?
The ARG is finding out what the fuck quest[367] is when he eventually comes back to this code after a few months.
I think the game is the ARG (game from an alternate reality where code looks like this)
Eh, I've seen far worse.
Edit: i just got caught up on some of the drama. Holy shit.
Holy shit isn’t even enough to describe the shit show that this guy has put himself in. It’s like when God made it rain ego he took all of it for himself, dude has 0 humility.
my first year of college ‘s cpp code is better than this shit
I don't care about this guy at all, but didn't Toby Fox have a giant switch statement for any line of dialogue in his wildly successful indie game
The difference is Toby Fox originally made Undertale as a project to get experience with game development, so it makes sense that the code was bad. PirateSoftware always brought up on stream his industry experience with Blizzard, so it's kind of atrocious that someone who worked in the industry would write code this bad.
Ya but Toby Fox doesn't parade around his nepotistic credentials like Thor. The code would be fine if he could accept criticism and just be fine with "It works for me"
I've not seen the code, but if it was using an enum or strings at least it'd be understandable.
Who is this?
I wouldn't call my self an expert by a longshot, but if your array gets that big, you probably shouldn't have made It an array, even less in his case, judging what that array is supposed to rappresent by its name.
But what do I know, I didn't work for blizzard for 7 years
Somebody please teach this man how to use an enum
This is “my dad got me the job at blizzard” code
The stolen breastmilk had lead in it.
If only it was possible to take a direct screenshot instead of taking a picture with a phone.
Somebody please tell this guy about enums
Ah, the Toby Fox method. Actually, at least Toby used a switch statement.
Honestly I think this is a great example how you can write dogshit code and still create things
If I pull shit like this in the code base at work, I'll become jobless enough to open a Twitch channel as well.
Where can I submit my game's code so people could roast it? I want some exposure too man
i heard stackoverflow will review your code, even if you didn't ask for it and call you an idiot
Ask for advice and they will not only not give you any they will mock you for even asking. Oh and the cherry on top? Even if you do a thorough internet and site search and nothing is available to solve your issue they will close the help request with some sort of snarky "go find the answer yourself"- as if you havent already tried that
You just need to post your question. Switch to an alt account to answer the question incorrectly and hope some swoops in to call your alt a dumbass and solve the problem for you. Or so goes the meme.
Yea its called murphys law, named after Charles Murphy in 1991, when online forums were starting to pop up
you meant Cunningham's law (I hope it was intentional lmao)
it really works damn
😂 I am going to use this method to solve all my online queries now.
Hehehe got em
that makes me mad and I know what you're doing lol
Manipulating Other Peoples’ Impulse to Correct Someone Else, For Profit and other self help books are available for purchase on our Amazon store and at other fine retailers…
There’s an answer for the same problem in a different language from 2009. Closed as duplicate.
Dam you beat me to it, guess I'll tell him to post a more detailed code snippet, we arent magicians out here you know, we need to see what he did wrong .. so we can call him an idiot of course wink.
The trick is to give the wrong answer in the question. You will have the correct solution in the first post.
nah, they won't even see your code, it's a duplicate
there a serveral youtuber and streamer making review sessions around 10 made a heartbound review.
Just make a discord and keep your code open source. I did it (discord is stop_sign gaming) and I had an insane amount of comments and corrections in my code (along with a random pull request that fully translated my entire game into French). Lots of people found how to make the game timer go fast and started giving me advice about endgame issues too.
They gave me a ton of code patterns I've adopted, but years later and I have found many many performance issues no one ever pointed out
I love open source but I am always afraid that my code is so shit that if a project of mine ever takes off it will get rewritten to be actually good and there won’t be any code of mine in there. I know it’s silly
While silly and not something that would happen, it's also not a bad thing even if it did. Whatever is rewritten wouldn't exist without you providing the initial code, and whatever it gets rewritten to you can learn from. Having the experience of building out a project, then seeing all the ways you could have done it better, is an incredible learning opportunity.
Just code on a livestream and the critics will find a way.
The Cherno does a code review series