ProgrammerHumor

epic

epic
https://i.redd.it/5c3j723imfcf1.png
Reddit

Discussion

RichCorinthian

When you’ve just learned about arrays, and decide to apply Maslow’s Hammer

1 day ago
_LordDaut_

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 implicitly? Maybe though... idk. The method has no parameters.

1 day ago
Voycawojka

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)

1 day ago
EasterZombie

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.

1 day ago
petty_throwaway6969

It feels like he might have self taught himself basic coding (like one semester’s worth) in the early 2000s and then didn’t even make an attempt to update his knowledge. Like he doesn’t even use what’s available to him in GML.

1 day ago
frenchtoastfella

Where can I submit my game's code so people could roast it? I want some exposure too man

1 day ago
james2432
:asm::c::cp::cs:

i heard stackoverflow will review your code, even if you didn't ask for it and call you an idiot

1 day ago
I_Heart_QAnon_Tears

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

1 day ago
ninjasurfer

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.

1 day ago
Tejasisamazing
:py:

Yea its called murphys law, named after Charles Murphy in 1991, when online forums were starting to pop up

1 day ago
fr0sty_l3m0n

you meant Cunningham's law (I hope it was intentional lmao)

1 day ago
calibrik

it really works damn

1 day ago
Jaded-Ad262

😂 I am going to use this method to solve all my online queries now.

1 day ago
ScholarZero

Hehehe got em

1 day ago
Impressive_Change593
:py:

that makes me mad and I know what you're doing lol

1 day ago
Fresh-Combination-87

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…

1 day ago
Ewenthel
:py::rust::perl:

There’s an answer for the same problem in a different language from 2009. Closed as duplicate.

1 day ago
Easy_Floss

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.

1 day ago
Captain_Lolz

The trick is to give the wrong answer in the question. You will have the correct solution in the first post.

1 day ago
arihallak0816

nah, they won't even see your code, it's a duplicate

1 day ago
Stop_Sign

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

1 day ago
The-Rizztoffen
:p:

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

1 day ago
Neon_Camouflage
:py::js:

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.

1 day ago
The_Real_Black
:gd:

there a serveral youtuber and streamer making review sessions around 10 made a heartbound review.

1 day ago
nothingtoseehere196
:cp::cs::c:

The Cherno does a code review series

1 day ago
faultydesign

Just code on a livestream and the critics will find a way.

1 day ago
StopMakingMeSignIn12

Why use separate flags when big array do trick?

1 day ago
TheTybera

I mean at least a dictionary, because then it's a nice map.

1 day ago
StopMakingMeSignIn12

Hash key lookup slow, integer index fast, me grug, best programmer

1 day ago
StolasX_V2

I call it integer indexing, rhymes with grug

1 day ago
bademanteldude

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)

1 day ago
Honeybadger2198

Oh no my 1 picosecond operation is now taking 3 whole picoseconds what will I do

1 day ago
lovecMC
:c::cp:

Ehh indexes wouldn't be as bad if he used Enums so it's at least readable.

1 day ago
TheTybera

Really this all needs to be in its own little tooling to create the quest and dialog data and flags.

1 day ago
lovecMC
:c::cp:

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.

1 day ago
Alexander_The_Wolf
:c:

And considering he has very little coding experience

See, this is the bigger issue here.

He touts himself as a game dev with 20 years experience, and a master hacker who worked for the government, when in reality, he puts out code like this? Yeah sure buddy

1 day ago
Moloch_17

I certainly wouldn't be putting this on stream, that's for damn sure.

1 day ago
PsychicDave
:p::cp::j:

The array isn't necessarily bad, but the magic numbers to access the data are, at least define some constants.

1 day ago
LexaAstarof
:py::rust::c::j:

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.

1 day ago
The_Real_Black
:gd:

who dont remember quest 367 but 253 was better imho.

1 day ago
Skepller
:j::g::py::bash:

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.

1 day ago
sentientgypsy

Oh my dear god, this is an array of flags?

1 day ago
RedstoneEnjoyer
:cp::c::cs::py::js:

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

1 day ago
sentientgypsy

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

1 day ago
element39

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.

23 hours ago
Necro-

this needs to be taught in classes in the future on things never to do

23 hours ago
Laty69

I think 253 had great worldbuilding, but storywise it was lacking. Quest 969 was a banger tho

1 day ago
elliiot

Unfortunately quest 374 was deleted last year and you just overflowed into the sa̶v̴e̸ ả̸̬̼r̶̺͚͛ȇ̵͈̣͌͝a̵̪̝͕͉̦̙͒͒͐̎

1 day ago
Warm_Zombie

uh, excuse me, but thats called obfuscation

now you wont be able to reproduce his awesome game just by looking at the code here

1 day ago
Gaunts

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

1 day ago
THiedldleoR

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

1 day ago
namepickinghard OP

This is pirate software's 20+ years of programming experience on display

1 day ago
Hot-Ad4676

“20+”, yeah right, it’s full of cybersec shit and not game dev experience

1 day ago
EXUPLOOOOSION

"Cybersec" being mostly social engineering

1 day ago
foxaru

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. 

1 day ago
THiedldleoR

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

1 day ago
TenaceErbaccia

You convince people with 10 minutes of experience.

1 day ago
Drumedor

Most people just see code, and have no experience in evaluating the quality of code.

1 day ago
Xtrendence
:js::p::msl::j::cs::dart:

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".

1 day ago
FlyingWolfThatFell

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

1 day ago
Callidonaut

Social media is optimised to enable narcissistic behaviour.

1 day ago
banchi306

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.

1 day ago
Callidonaut

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!

1 day ago
banchi306

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.

1 day ago
reventlov

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.

1 day ago
Orio_n

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.

1 day ago
ChampionOfAsh

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”…

1 day ago
b1ack1323
:cs::cp::c:

You mean using the Steam achievements as DRM?

1 day ago
Alokir
:ts::js::cs::rust:

I wonder what happens if I want to start a new game

1 day ago
not_a_burner0456025

It isn't supported, but if you pirate it it is fairly easy.

1 day ago
flag_ua

That was for another game

1 day ago
CMDR_Profane_Pagan

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

1 day ago
dschazam
:ts::sw::cs::py::bash:

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.

1 day ago
GForce1975

Haha that brings me back. Before that I think we used tape to beat the "copy protection" on some diskettes.

1 day ago
Anaxamander57
:py::rust:

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.

1 day ago
zanypeppers

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

1 day ago
Kooky_Anything8744

As a "cybersec" person, there is no god damn way that moron has 20 years of experience in cyber security.

He just spouts internet related paranoia and claims it as cyber security.

1 day ago
LoudSwordfish7337

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”.

1 day ago
RedstoneEnjoyer
:cp::c::cs::py::js:

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”.

I know man, i was so proud of my garbage that would give leprosy to anyone even remotely competent reading it.

1 day ago
wexman6

Wait until you see how he sets every value of an array to 0.

Spoiler: it’s not a for loop

1 day ago
Fluffy_Ace

Did he really set each value individually?

1 day ago
RedstoneEnjoyer
:cp::c::cs::py::js:

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

1 day ago
ChangsManagement

He sure did. Ive heard people saying he doesnt know how to even use a for loop

1 day ago
not_a_burner0456025

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.

1 day ago
ChangsManagement

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.

1 day ago
Fluffy_Ace

He sure did.

That's so sad but also hilarious.

1 day ago
lelemuren

I wouldn't use a for-loop for that. I'd use memset. Compiler probably optimizes it to the same thing anyway, though.

1 day ago
wexman6

I feel like anything would be better than manually going through each value and setting it to 0

1 day ago
lelemuren

Yes. PirateSoftware is a joke. This would be a failing grade in a first-semester programming class.

1 day ago
omgitsjagen

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.

1 day ago
bloody-albatross

Does Game Maker script have memset?

1 day ago
NUTTA_BUSTAH

I sincerely doubt Game Makers scripting language has the ability to manage memory at that level

1 day ago
Moist_Ad_6573

This guy has 20 years game dev experience and he used to work for the government as a professional hacker. According to his statements.

1 day ago
Beardbeer

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.

1 day ago
Orio_n

He worked as a social engineer writing phishing emails, not hunting for 0 days

1 day ago
Spyes23

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.

1 day ago
ihavebeesinmyknees
:py::js::rust:

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.

1 day ago
PaleEnvironment6767

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.

1 day ago
No_Anywhere_6163

You just got added to the array, bud. Hope it was worth it.

*big switch*

1 day ago
Koozer

Eat my entire array!

21 hours ago
AutistMarket

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"

1 day ago
Mr_Fourteen

I hate you. I read this in his voice. 

He's also commenting every single line

1 day ago
PaleEnvironment6767

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.

1 day ago
boothin

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.

1 day ago
Exclarius

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.

1 day ago
Previous_Aardvark141

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...

1 day ago
IFIsc

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

1 day ago
chysallis

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

1 day ago
LuciusWrath
:cs:

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.

1 day ago
cacalin_georgescu

Well...

  1. Bitmapping and masking is more efficient

  2. 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)

1 day ago
da2Pakaveli
:cp::cs::j::py:

Then just use enums

1 day ago
Boredy0

That would require knowing that enums exist.

1 day ago
FishMissile

You forgot "eat my whole ass"

1 day ago
scottishkiwi-dan

This is the same guy who built the unpiratable DRM that was pirated in 1 day.

1 day ago
Snudget
:rust::py::asm:

He is called pirate software, maybe he wants his software to be pirated

1 day ago
Lerijie

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.

23 hours ago
Sixhaunt

So he pulled an Elden Ring?

Elden Ring added a mount called "Torrent" so if you google soemthing like "Elden Ring torrent" you get pages about the mount rather than torrent links for pirated versions of the game.

21 hours ago
frenchytrendy

That's really smart though (the elden ring part)

17 hours ago
Own_Watercress_8104

Considering his stance on SKG, I doubt that

1 day ago
Exormeter

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.

1 day ago
vlees

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)

1 day ago
GrampaSwood

The weird thing is, how would you start a new playthrough? Is he gonna take away achievements or just grant you the progress instantly?

1 day ago
Zestyclose-Phrase268

Whoa whoa calm down. The GameMaker tutorial didn't say anything about a 2nd play through

1 day ago
vendetta1881

And its funny because that guy probably thinks he is smarter than other big gaming companies who pay huge money for Denuvo

1 day ago
tomi901

No shit his game is taking that long to make, imagine trying to remember what every index represents after a few weeks.

1 day ago
Todegal

this is literally the text adventure game I made when I was 12

1 day ago
enp_redd

tbf hes programming like he worked in QA fulltime. which is true.

1 day ago
W_lFF
:js::snoo_biblethump:

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?

1 day ago
Otterable

This man literally sets individual array indexes to 0 instead of using a for loop.

In fairness, he clearly was doing that so the array initialization could double as documentation for his magic numbered indicies.

That being said, he still should have used an enum so it was actually readable in files like the one linked in this post and maintained the documentation there if he still wanted to use this single global array for everything.

23 hours ago
Callidonaut

Oh god, is he hard-coding the game's plot? I thought most devs had stopped doing that by the mid 90s!

1 day ago
LazoVodolazo

Forgive the ignorance but what would be the common way of doing it instead of hardcoding everything into an array

1 day ago
Leninus

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

1 day ago
[deleted]

[deleted]

1 day ago
lobax

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.

1 day ago
Callidonaut

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.

1 day ago
bloody-albatross

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.)

1 day ago
CMDR_ACE209

Any other data structure basically.

Something where the properties have useful names. A class, a struct, frikkin globals, anything other than an array.

1 day ago
IFIsc

You could even still use an array but index it with named enums!

1 day ago
HugeAli

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.

1 day ago
miniprokris2

As someone who doesn't code much other than simple scripts, I'd like to know too.

1 day ago
Kaos_nyrb

https://en.m.uesp.net/wiki/Skyrim_Mod:Mod_File_Format/QUST

here's a breakdown of how Skyrim stores quests

1 day ago
evanldixon
:cs:

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.

1 day ago
MiniDemonic

There's quite literally no other way to do it, you have obviously never used gamemaker.
/s

1 day ago
Thighcreeper

having to change every single one if you decide to add, change or remove something, is peak comedy.

1 day ago
flytrapjoe

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.

1 day ago
DaveK142

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...

1 day ago
PopTraditional713

Times like these are reminding me that Tobias dog's (Toby fox) entire UNDERTALE dialogue is in the hands of a singular switch statement

1 day ago
Fragrant_Gap7551

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

1 day ago
RedstoneEnjoyer
:cp::c::cs::py::js:

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.

1 day ago
loftier_fish

Yeah, its one thing to write shit code that works fine, and ship quickly, its a whole nother to spend eight years in gamemaker without a thing to show for it.

21 hours ago
RedstoneEnjoyer
:cp::c::cs::py::js:

Exactly. Toby Fox delivered 4 chapters of deltarune in same time period this game was stuck in hell.

18 hours ago
Lenni-Da-Vinci

“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.

23 hours ago
sebas737

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.

1 day ago
g-unit2

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}]")

Simulated game event: player walks into Nazeem's proximity

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.

1 day ago
DaveK142

"Do you get to the Cloud District very often? Oh, what am I saying? Of course you don't."

1 day ago
Phailjure

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.

1 day ago
pomme_de_yeet

Come on that's not fair at all

1 day ago
veryrandomo

Thor isn't exactly a great person but he isn't nearly as bad as a pedophile

1 day ago
Mitio_Maga

He's out of mana guys, what do you want him to do ?

1 day ago
IFIsc

He worked at Blizzard btw!

Maybe he was that one breast milk thief too...

1 day ago
Xerxero

Low level test monkey on the night shift.

1 day ago
IFIsc

In-between tasks he was perfecting the art of MS Paint

1 day ago
Raxreedoroid

he didn't even work as a developer/programmer.

1 day ago
Unupgradable
:cs::ts:

Yandere Dev 2

1 day ago
D3adInsid3

Yandere Dev never claimed he knew what he was doing.

1 day ago
voyti

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.

1 day ago
Unupgradable
:cs::ts:

Especially when his actual production speed is more like 0.1x despite writing like this

1 day ago
EggParticular6583
:c::cs::ts::terraform:

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.

1 day ago
Greggs-the-bakers

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

1 day ago
DDFoster96

if player.hasattr("career"):     player.career.destroy()

1 day ago
calgrump
:unity::cs::cp:

My man was too busy being the tech lead at blizzard to check what magic numbers are. My eyes are burning.

1 day ago
Mateogm

I know this is a stupid way to do it, but what would be a better way?

1 day ago
TessaFractal

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.

1 day ago
aresi-lakidar

yeah, I work in C++ in another field, but we use enums like this all the time. I've never had to consider the index or "encoding" of anything, if I wanna get something i just... you know, type out what it is I wanna get.

1 day ago
RlyRlyBigMan
  1. 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.

  2. 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.

1 day ago
ralgrado

But I want a global writable singleton so speed runners can manipulate it to jump directly to the end of my game.

1 day ago
Special70

if you're talking about the switch case, a simple if statement is enough i believe because only the first switch case mattered

1 day ago
Quod_bellum

Didn't he say there's an ARG in the code?

1 day ago
theofficialnar

The ARG is finding out what the fuck quest[367] is when he eventually comes back to this code after a few months.

1 day ago
Snudget
:rust::py::asm:

I think the game is the ARG (game from an alternate reality where code looks like this)

1 day ago
christianwee03

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

1 day ago
sanketower
:py::js::p::c::cs:

Reminds me of how all of UNDERTALE's dialogue is one single massive array with a zillion of if statements. You don't need clean code to build great games.

Still pretty funny, tho

1 day ago
Mtsukino
:cs:

Eh, I've seen far worse.

Edit: i just got caught up on some of the drama. Holy shit.

1 day ago
theofficialnar

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.

1 day ago
gonssss

my first year of college ‘s cpp code is better than this shit

1 day ago
Substantial_Top5312
:s::js::cs::ts::lua:

Who is this?

1 day ago
Downtown_Speech6106

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

1 day ago
Dr-Jellybaby
:ts:

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"

1 day ago
Greenman539
:lua::ts::cs:

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.

1 day ago
Blackhawk23
:g:

This is “my dad got me the job at blizzard” code

1 day ago
Ok_Needleworker5837

If only it was possible to take a direct screenshot instead of taking a picture with a phone. 

1 day ago
Both-Election3382

Big F for all the people that paid for this abandonware thats never releasing

1 day ago
Shura_Shulgin

This guy has managed to piss of coders to the point that they stopped configuring their NeoVim and started posting videos ripping his code to shreds. That's an achievement on its own.

1 day ago
Honest_Relation4095

the global storyline array ist just a metaphor for life. One mistake can mess up everything, you have no idea what is going because it's all just obscure numbers and it's very confusing.

1 day ago
edgeofsanity76

Meh. It's garbage but it's his garbage. I would advocate for stopping this kind of ganging up behavior as I don't like it, but to be fair he's been really shitty to other people.

1 day ago
YeetCompleet
:rust:

Mfw I have to add a new quest in between other quests and it absolutely fucks up all of these indices throughout the code:

1 day ago
Zymosan99

Ah, the Toby Fox method. Actually, at least Toby used a switch statement. 

1 day ago