r/PirateSoftware • • Jul 17 '25

I showed a professional 2D game engine programmer Pirate's lighting code and he said it's fit for purpose

I saw a video online talking about Pirate's lighting code, it just seemed off to me. I sent it to a professional 2D game dev and he told me the following:

The developer reviewed the code and found that the criticism in the video (claiming it's O(n^3)) is exaggerated and misleading. He mentioned that the code, written in GameMaker's GML, uses a pixel-by-pixel approach to avoid shaders, which is better for non-career programmers as it massively reduces complexity.

He also confirmed the time complexity is likely O(n) or O(x*y) (x = number of lights y = number of pixels) due to iterating over pixels and light sources, not O(n^3) as claimed. He pointed out that Pirate's method, while not perfectly optimized (e.g using case switches instead of clean math for directions and repeating diffusion steps), is a valid approach for a non-programmer game dev.

The video's suggested fixes, like using pre drawn light PNGs or surfaces, were wasteful in memory and not visually identical, offering no real performance gain. He also debunked the video's claims about redundant checks, noting they’re functionally intentional and O(1) with GameMaker’s collision grid.

Overall, he felt Pirate's code is decent for its purpose, and the video’s analysis and testing was wrong, as he had an "If true" statement which is a total blunder, running the code constantly, making his benchmarking completely wrong.

Edit:
If anyone has any questions for the dev, leave it in the comments and I'll forward it to him and I'll post his reply

103 Upvotes

424 comments sorted by

4

u/Nartiohk Jul 17 '25

Why the if true statement is a blunder? and what's the actual result of these two implementation.

9

u/dsruptorPulseLaucher Jul 17 '25

In the video's testing, he commented out the check (last image != image_index || last_sprite != sprite_index) and replaced it with "if true". This means that the code is running constantly, of course it's going to use "99.675" % of the process's CPU usage.

For the real results of the two actual implementations I'll have to get back to you about that one.

3

u/Nartiohk Jul 17 '25

oh, i thought he used "if true" for both of the implementation. So the result will not that different huh. Maybe a 5-10% improvement? Still, the bullying is getting too far.

→ More replies (2)
→ More replies (13)

35

u/tempistrane Jul 17 '25

That's because you asked someone not making money off of hate farming Pirate. The internet is wild. You see so many insecure people projecting on public digures.

7

u/Apprehensive-Mall219 Jul 21 '25

I'm sorry but that's the biggest load of cope. Just about everyone criticizing his code have pointed out the blatant and sloppy copy paste and redundant coding practices. Plugging your ears and pretending "all the hater" are just making a bag. Very immature take.

2

u/tempistrane Jul 31 '25

But a valid take. People are just trying to make money off the latest Internet Hate meta. It's pathetic. Thor literally has zero impact on theses peoples lives.

32

u/Level_Remote_5957 Jul 17 '25

Yeah imma be honest I've seen those "reviewing code" videos and I'm just sitting here like wtf is the problem and then I'm like do these dudes actually have any real game development work?

Cause even then coding is always different, depending on what good using to code and how you code.

Prime example team fortress to having a png of a potato in the code, you delete it everything will cess to function, which makes people curious if it's Steganography but that's for another discussion.

But yeah it's like completely random bs. Like you sit two half devs down on to separate engines both there codes are gonna be completely different.

20

u/Kerrigore Jul 17 '25

It’s hilarious to me because Thor has said repeatedly that you don’t need to be an expert programmer to make games and that highly successful games like Undertale were a complete mess under the hood: all that matters is if it’s good enough to work.

10

u/Level_Remote_5957 Jul 17 '25

Ding ding hell ever dived into the code of halo or a fallout game those are insane, yet both work, I know we meme on Bethesda games but most of them are actually pretty stable until you mod it, FALLOUT 76 Does not count it was made by a different dev team who never worked on any fallout or elder scrolls

→ More replies (5)
→ More replies (13)

13

u/JohnMichaels19 Jul 17 '25

Load bearing potato lol

12

u/warchild4l Jul 17 '25

I have stopped taking any review seriously when they bring up an "empty github" as a point against him

→ More replies (3)

3

u/s0litar1us Jul 17 '25 edited Jul 17 '25

It's a bitmap of a coconut, it's an unused asset, and you can delete it and many other assets without issues, you just get the purple and black default texture.
Shounic has a good video debunking this myth (people think deleting this coconut breaks tf2).
He also has a video on how many files you can delete before it breaks (how many files can you delete before tf2 breaks).

There is also the funny video on how awful/over-engineered the TF2 code was, based on the profanity filled commens left by the developers (the rapidly dwindling sanity of valve programmers expressed through code comments). There will be bad code in production software, nothing of subtantial size that seeks perfection will ever ship.

2

u/Level_Remote_5957 Jul 17 '25

Ahhh fair enough even tho in this same comment thread I've heard multiple different things of what it's used for lol in this same comment thread.

→ More replies (6)

6

u/Minute-River-323 Jul 17 '25

Prime example team fortress to having a png of a potato in the code, you delete it everything will cess to function, which makes people curious if it's Steganography but that's for another discussion.

So i will reveal something that has been known to every capable source modder so far...

It is a myth and has been a running joke for years.. removing coconut.vtf does not brick the game.

What it will do is trigger steam to redownload the missing files as you did not pass hash checks (to avoid modded player files etc, you can play locally but not online).

But yeah it's like completely random bs.

Oh the irony.

1

u/BambinoCPT Jul 18 '25

While dev's code will almost always be different, there's still an expectation of code quality that comes when someone like Thor claims to be a seasoned veteran of the game dev industry

18

u/acexprt Jul 17 '25

Not attacking you OP but it’s honestly pathetic people are attacking his code and even his sex life because he has a different opinion on a stupid petition. Everyone needs to grow up.

9

u/Kerrigore Jul 17 '25

A lot of people just already hate him and will use any excuse, and jump on whatever the latest bandwagon is. I just wish people would… you know… just not watch the guy if you don’t like him, instead of running around promoting hate.

→ More replies (2)

1

u/getfukdup Jul 21 '25

they aren't attacking him because he has a different opinion, its because of what the opinion is specifically. Don't pretend like you don't understand the difference.

1

u/[deleted] Jul 21 '25

He can disagree with the movement, it is how he did it, how he framed it completely wrong, refused to talk with the creator of the movement and insulted him, then doubled and tripled down on his comments went proven wrong.

→ More replies (3)

17

u/[deleted] Jul 17 '25 • Diamonds are Forever

AAA game programmer here. I think Thor's code isn't strictly terrible, but it's definitely not the work of somebody who has the right to authority on how to be a good game programmer. The main issue is that the codebase is accomplishing something on the CPU when it really should be being done with a shader on the GPU. In real production, if you posted that code for review, you'd immediately get slammed with a "this should be a shader" comment and sent back to rework your code. I've heard the argument that making it a shader harms portability, but that just isn't a thing, and is a lame excuse at best. If I got that as a response in a code review, I'd talk to that person's manager.

I think the main issue is with Thor presenting himself as a professional-level game programmer and then demonstrating amateur work, rather than the actual code itself. For an amateur game dev, I wouldn't flinch at that code. If I was working with someone on a big project and saw that code, I'd be asking some questions.

5

u/Polanas Jul 18 '25 edited Jul 18 '25

Finally, someone who actually knows what they are talking about. Thank you.

Shaders have indeed existed for 20 years. Game Maker itself uses OpenGL, which literally requires a shader to draw a texture on the screen. So if the game launches and displays anything, it already uses shaders.

That lighting code is just a terrible software renderer, since it relies on multiple collision checks(!) for every pixel.

Although I think in the context of a solo dev project there's nothing wrong with having code like that during the development, as in this stage what's actually important is iteration speed, not code cleanness. Hopefully it'll get rewritten to a shader when the game is closer to release.

2

u/[deleted] Jul 18 '25

thanks for adding that point! that part confused the heck out of me -- surely if your machine can't run a shader, it can't run game maker? it uses openGL3.3 and DX11, both are programmable pipeline versions of both graphics APIs, so the whole "i did it for brazilian fans" just feels like another case of "acktually, this seemingly illogical move was me being a hero of the poor"

→ More replies (2)

7

u/poon-patrol Jul 17 '25

Can I see that clip of Thor saying his a god tier programmer? I remember him saying he uses notepad++ cuz it’s funny that people get mad in chat, I remember him saying he nests if then statements for the same reason, I keep seeing you guys misrepresent the person who said he’s like the Bob Ross of programming, where the person was obviously talking ab the vibes of thors streams compared to Bob rosses and not thors programming capabilities, so can I get that clip where he says he’s the best programmer in the world?

Or are you j being a parrot?

→ More replies (21)

7

u/MonikanoTheBookworm Jul 17 '25 • Diamonds are Forever

Actually, he already explained why he is not using shaders: https://x.com/PirateSoftware/status/1945259082430259380

Relevant sections:
"1. I chose to do pixel by pixel CPU based lighting over using a shader to ensure the system was compatible with machines that could not compile shaders. This was helpful for a number of regions such as Brazil where the game has been very popular."

And another comment:

"We had some wild issues on super poor hardware in the beginning. This weird implementation fixed all that and it's been stable since 2018. Hell the 1.4 version still works today.

Would updating that make it more efficient?
Probably.

Does it need to be updated?
No."

4

u/spyingwind Jul 18 '25

GameMaker supports OpenGL GLSL shaders.

OpenGL 2.0 is over 20 years old.

Every GPU driver comes with OpenGL GLSL shader compilers.

https://en.wikipedia.org/wiki/OpenGL_Shading_Language

Some benefits of using GLSL are:

  • Cross-platform compatibility on multiple operating systems, including Linux, macOS and Windows.
  • The ability to write shaders that can be used on any hardware vendor's graphics card that supports the OpenGL Shading Language.
  • Each hardware vendor includes the GLSL compiler in their driver, thus allowing each vendor to create code optimized for their particular graphics card’s architecture.
→ More replies (9)

3

u/Archangel_117 Jul 17 '25

But this is what people miss:

He DOESN'T "present himself" as some sort of massively expert programmer. People keep saying this because they're desperate for him to be wrong about as many things as possible and to "justify" their attacks.

He doesn't present himself as this, and never has. That's people's interpretations based on assumptions, not based on his intentions.

→ More replies (5)

1

u/[deleted] Jul 17 '25

Yeah, I definitely have no issues with someone making subpar code, but when they claim to have as many years of experience, and be such an authority on gave development as he does, that's when it's a problem.

4

u/Archangel_117 Jul 17 '25

He doesn't claim to be a huge authority. Also his game development experience isn't the same thing as game CODING experience. He has never misrepresented this.

5

u/warchild4l Jul 17 '25

That's always been the biggest thing for me.

He has said repeatedly that he has game dev experience, not programming experience. Doing game design, game testing even, IS game dev experience, its just people trying to pick on everything.

I have watched plenty of his streams in the past, before onlyfangs era, when he still streamed heartbound dev, when i worked in the background, and I cannot remember him ever claim he was an expert coder who cannot make a mistake.

The only thing he has bragged about was this very lighting code and that was always because it was a solution that worked on a lot of platforms and was good enough for the small amount of pixels the game had. He has even said that his code was not scalable but that did not matter because he would not be using it for anything else.

→ More replies (4)

12

u/Ancient-Product-1259 Jul 17 '25

And my friends who have made games for 15 years said otherwise. Almost like you if ask 100 times you get 100 anwers. Pointless

2

u/Archangel_117 Jul 17 '25

But by that logic, so is every other issue that could be raised. So great! Let's use that same "pointless" conclusion with every issue that people drag on him for. If it works one way, it works going the other way too.

1

u/Pico144 Jul 18 '25

I think it's because that friend was generous, in fact OP wrote that this friend said "it's a valid approach for a non-programmer game dev", which is my takeaway from looking at that code too. And for all these critique videos, proving that he's not a good programmer is kinda the point

1

u/Herbalist454 Jul 21 '25

which llm is your "friend" that you asked?

the real reason pirate is getting hate is because he is a dick.
shit code is just a bonus.

1

u/dsruptorPulseLaucher Jul 21 '25

what's ur discord u can speak to him right now

1

u/Herbalist454 Jul 21 '25

i don't give a shit mate.

i told you why people don't like pirate - the shit code is just a bonus.

1

u/dsruptorPulseLaucher Jul 21 '25

you asked "mate", you obviously do give a shit

→ More replies (1)

6

u/Consistent_Two2067 Jul 17 '25

Okay okay I think here’s where there’s a disconnect

Software developers agree that he is not a good programmer. Much of the analyzing of his code is done under a lens of, “Would someone with programming experience write code like this”? And the answer is no. So ultimately this conversation is not really geared toward the average person who doesn’t care about what goes on in the backend as long as it serves its purpose.

It does what it needs to be, but it isn’t so optimal that it runs on a fridge screen (because the screen is just being used as a monitor).

This post says, “Well it’s okay for a non-programmer” and it does what it needs to do. And this is also true.

You don’t have to be a good programmer to write your game. I think y’all are having two different conversations.

→ More replies (1)

7

u/Dark-Mowney Jul 17 '25

I remember one of my game dev props would always say “just get it working” and then you would only optimize if your code was causing you issues.

4

u/Grassland- Jul 17 '25

Nah, the way the light was imp. is really bad, and the performance Will drop like a bomb the more are on the scene

4

u/Archangel_117 Jul 17 '25

Which would only matter if there were a point where enough were on the scene at any point to cause an issue.

→ More replies (1)

2

u/s0litar1us Jul 17 '25

But does the performance drop like that at any point in the game? No.
If he needed to use it in a way that slows it down like that, he would rework it, but he doesn't, so it is fine the way it is.
Obsessing over a hypothetical scenario that is never going to happen will get you nowhere.

2

u/Simboiss Jul 17 '25

It is not THAT bad. Unless you eventually need a high number of different lighting types, the calculations must be done anyway. Applying lighting on pixels implies that you have to iterate through all pixels that are affected by light. Even if you use a PNG overlay or a shader. So, where's the big loss if it's only about algorithms?

1

u/pskfry Jul 17 '25

He also confirmed the time complexity is likely O(n) or O(x*y) (x = number of lights y = number of pixels) 

no he didn't. big O notation never uses "x * y" that would be O(n*m) so you either asked someone who makes shitty mobile games for chinese companies (a common placing for game devs coming out of non prestige colleges) or you asked chatgpt with some very forgiving prompting and you're using the wrong notation

which is better for non-career programmers as it massively reduces complexity

welp thor presents himself as a career programmer so that's a bit cringe

-1

u/SnooOpinions2406 Jul 17 '25

This entire post by OP reeks of AI. The wording is super suspicious. At the very least he used AI to summarize what his “friend” said before posting

3

u/dsruptorPulseLaucher Jul 18 '25

You wanna talk to him?

I sent him the video and screenshots of pirates code, he analysed it and came to that conclusion. It was an informal conversation so I summarised it. No AI used.

→ More replies (1)

3

u/SocietyTomorrow Jul 17 '25

Something doesn't need to be coded by dwarven masters and quenched by the finest elven spring waters to work. Seems to be forgotten or ignored pretty often that people often don't care if it's the best way to do something as long as it gets the job done

2

u/AlternativeTruth8269 Jul 18 '25

Yeah, because there would never be any bugs, added functionality, testing, refactoring. Having gigantic arrays stored in your brain and using plain indexes throughout code are never problematic in any way, you never make any mistakes. And you never forget what code you wrote a couple of months ago, you just jump in and perfectly navigate the seas of magic numbers. Right? Job gets done perfectly.

1

u/AlternativeTruth8269 Jul 18 '25

Also, are you implying that using enums and structs to improve readability, development speed and state management are Tolkien style magic arts? Seriously?

→ More replies (2)

1

u/akayd Jul 21 '25

That's only if you want to never improve and learn to scale things in the future.

1

u/pskfry Jul 17 '25

jr. developer mindset. there is a breakpoint where something becomes so optimized that it's no longer readable or understandable and at that point you may have overdone it depending on what the performance requirements are, but performance does matter.

2

u/W_lFF Jul 19 '25

At the end of the day, the real reason Jason is getting hated on so much is not really because of his code. Nobody really has an issue with an indie dev writing bad code, that's just a funny thing. It's Jason's personality as a whole that really ticks people off, and rightfully so he comes off very insufferable at times. And because of that everybody wants to find any little thing to make fun of him and throw tomatoes at him. Every little criticism about what Jason does isn't actually about what Jason does, it's criticism towards Jason himself and how he is as a person and people just want him to change by bullying him mercilessly.

2

u/siraliases Jul 17 '25

a valid approach for a non-programmer game dev.

But he is?

1

u/Lunarcomplex Jul 17 '25

I mean, it's GM, making your own for loop compiles into less efficient c++ code than using GM's keyword "repeat"...

1

u/Knifferoo Jul 19 '25

15 years in game dev and he's doing stuff that is an acceptable approach for a non programmer game dev. Make up your mind. Does he have 23 years of game dev experience or not?

1

u/getfukdup Jul 21 '25

isn't worrying about 'wasting memory' in a 2d game in 2025 pretty strange, especially when considering the quality of the graphics in the game?

1

u/Suilied Jul 21 '25

For me personally, I was pretty surprised with that code snippet. Not because it's inefficient, but because GM has tools to do what he's doing built-in, no shader knowledge required, except for the basics I guess?

So basically what you do is the following:
- create a surface.
- draw a gradient rectangle on this surface
- draw the surface

It's not going to be a literal 3 liner, but not anywhere near O(n^3) as it makes use of native gfx processing.
In addition, you're no longer constrained by only drawing horizontally, you can draw it dynamically based on what the sitch is (to simulate dynamic lighting for instance).

Maybe I'm giving him too much credit because I don't see a whole lot of forum posts that mention drawing gradients and using surfaces in the same breath. So I can imagine someone new to GM completely missing out on this. I only remembered the whole surface thing from way back when (GM 7 introduced them I believe) and had to look up the docs to see if this was still a thing.. turns out, it is!

So whatever you think about this specific code review, I can encourage anyone who wants to get into game-dev to lean into your tool, be it Gamemaker, unity or what have you, make your tools work for you. So if you're stuck on how to do something. Read the docs, it might just be solved already.

2

u/Feran_Toc Jul 21 '25

As I understand it, this was all a conscious choice on his part. The game has a large following in Brazil and being aware they often don't have the best gaming hardware over there, he tried to make something that could potentially run on what they had by putting the work on the cpu instead of the gpu.

I also believe he used GameMaker 1.4 for Heartbound. Pretty sure I've heard that from him a few times.

→ More replies (1)

1

u/daFARKA Jul 21 '25

What are you talking about?
The lighting code is definitely O(n^3).
This is basic algorithm analysis. If you or your friend of yours were educated on the matter just a tiny bit you would instantly see this.

Also saying GameMaker reduces it to O( whatever ) is not making the algorithm that O( whatever ). That is like saying it takes everyone including me 3 mins to cook this steak, but in this special pan of mine it only takes me 1 min.

Im going to quickly break it down for you so you can also understand:

for ( all light sources)
for ( all y values)
for ( all x values)

that is in its most basic form: O(light_count * y * x) which is O(n^3).

Also what you conveniently left out is the part where PS copy-pasted the whole code for the other side and only changed the signage. Only an absolute beginner would do this. Modulo is learnt at a very basic level and SHOULD most certainly be understood by a person who supposedly has 20+ game dev experience.

1

u/CorrectTechnicality Jun 24 '26

The lighting code is definitely O(n^3).

Nope! I'll explain later.

This is basic algorithm analysis. If you or your friend of yours were educated on the matter just a tiny bit you would instantly see this.

Ouch. That won't come back to bite you, I am sure ;)

Also saying GameMaker reduces it to O( whatever ) is not making the algorithm that O( whatever ). That is like saying it takes everyone including me 3 mins to cook this steak, but in this special pan of mine it only takes me 1 min.

Funny you say this. A lot of 'critics' say the exact same thing about running the shader on the GPU vs CPU. Let me explain:

- Yes, it will run faster. You say that it's ridiculous that computations on better hardware will run faster. They will. Seriously, they will. You never upgraded from a 4090 to a 5090, did you? Try it out, you will be surprised!

- No, the complexity won't change. The complexity of O(whatever) will still be the same. The algorithm won't become a 'better' class just because you threw 10k processing units at it.

that is in its most basic form: O(light_count * y * x) which is O(n^3).

No, it is O(light_count * width * height). Those 3 variables are independent from each other. If you multiply the light_count by 10 you don't automatically multiply the width and height by 10 to match the light_count, do you? So your time increases by a factor of 10 (which is linear, aka. O(n)). It doesn't increase by a factor of 1000 (which is what you predicted, O(n^3)). The same applies if you increase the width to 4k. You don't get 4k lights, do you?

Some minor technicalities:

- In image processing you actually merge the image dimensions, so it is technically: O(light_count * num_pixels).

- light_count is a tiny constant number in his code. With complexity analysis, you can round that number away, so in the end it is O(num_pixels). This is linear. The starting O(light_count * width * height) is linear, too, so it doesn't matter that much.

You failed to do basic algorithm analysis. https://www.youtube.com/watch?v=1h_hftQN5Dw

1

u/gwynftw Aug 05 '25

So im an EM (engineering manager), and used to be a lead software engineer, for an extremely high performance bidding system, international advertising company, billion+ in revenue. I have done game development, but not professionally.

The code reviews against pirate software piss me off so much. People dont understand how restraining GM is. Honestly its a terrible game engine if you are a programmer. I cant imagine why Thor would use it, id rather use almost anything else. Godot now is the obvious choice, which Thor admits.

Every code review ive seen comes from lower level dev perspectives (c++ devs usually) are extremely hyperbolic about petty shit. Some of these people id never hire, because i know they are the kind of people who would reduce moral on my team. Making a code review from a c++ perspective on GM is the most egotistical, basement dwelling, better than thou dev shit ive seen in a long time.

Next O(n3) isnt a thing. Big O notation is an estimation. its O(n) or O(2n) or O(log n), maybe O(n!) but anyone who would say "O(n3)" would instead say O(n2) its just saying that the time complexity is exponential.

Next NO ONE WOULD USE PREDRAWN PNGS omfg. shaders, the answer is shaders. Thor should be using shaders. Thor is a career programmer, he should be using shaders. Or just copying a shader from the internet.


Finally when you make your own project, and your coding on your own... YOU GET TO WRITE LESS THAN PERFECTLY CLEAN CODE.. i want to pull my hair out. Thats some of the joy of doing an at home solo dev project.

Ive seen some of thors code, i do think he makes some mistakes that boggle my mind. but these people are insane.

/rant

Feel free to send me some code if you ever want my perspective, but i do have a strong distate for GM.

1

u/robhanz Aug 13 '25

It's obvious that the code is for lighting the edges of something with falloff from a light source.

I don't see how the other examples do the same thing. Yeah, a shader would probably be better, but it's probably not necessary in this instance.

1

u/Hot_Figure_8617 Aug 15 '25

did you guys see that coding Jesus guy actually lied about Thor's light code? 

1

u/OmegaJinchiiiiiii Aug 20 '25 edited Aug 20 '25

I do coding, his codebase is incredibly incredibly alright. Not regarding lighting but other criticisms by CodingJesus (aka: mr. I learnt programming in 3 months and got a job (on youtube) )

CodingJesus's two criticisms I remember, and why they don't matter:

  • Q: Why isn't this dialogue code in json or yaml, instead in an array?

    • Json and Yaml basically store an associative array in a file. He did what a json/yaml file would do in a non-standard way. And the fact that its in a array means he can at any time convert it to json or yaml with a small script. So, incredibly nothingburger criticism.
  • Q: Why does he have magic numbers?

    • He's a solo dev and as long as he remembers the purpose, that's that, and the function names involving these magic numbers were descriptive enough that he could figure out what the number does and he can read the function if he forgot what it does, which looking at the name- it very surely didn't do anything complicated. It was a nitpicky criticsm for the code being analyzed.

TLDR; Basically, CodingJesus nitpicked mostly good code, found it wasn't absolutely perfect and spread the propaganda that thor is an incredibly bad coder.

Lighting code, its a 2d game that runs on a pc... unless your game is making the room heat up- it doesn't matter what complexity lmao. Idk if its making the game lag since I haven't played heartbound, if it was then surely it needs work, but if not then... *shrug*

1

u/Naud1993 Aug 24 '25

Someone even said that Thor's particle code was wrong because of magic variables. What should he do? Make multiple lines of variables for every line of particle code? Game Maker shows what each number means anyway. And he probably created that code using a particle editor anyway since it's faster. Otherwise he'd have to start the game each time to see the changes.

1

u/SomethingSo84 Jul 17 '25

But Thor acts like he’s gods gift to the coding world and claims to be such an accomplished coder that others must bow down to him. It’s fine for a NON PROGRAMMER but Thor continues to claim that he knows more about programming than the people reviewing his code which he clearly does not

4

u/Feran_Toc Jul 17 '25

I've never gotten from him that he's "gods gift to coding." Maybe I've missed those moments cause I tend to watch when he's about half way though his streams. I have seen him fix a syntax error or a typo, celebrate and then discover he just made things worse or made a new issue then laugh at himself. Do you have some clip examples by chance?

As for those reviewing his code. I don't feel like they understand why he's done what he did. Why the code is the way it is. Admittedly I'm not a programmer. I've taken a few classes in C# and Python, but I'm not actively using ether. However I've heard his reasoning for it, and if it works, and it's not breaking machines, and works for who he's targeting, then what's the big issue?

3

u/poon-patrol Jul 17 '25

Can I see the clips of that?

→ More replies (2)

1

u/ArqHi Jul 17 '25 edited Jul 17 '25

A lot of these code reviewers have an impractical view of coding where they are somewhat obsessed with "optimal" solutions. Instead of understanding code as means to end in their view the code itself is the goal. In practice often times youre best-off doing the quick and dirty solution first and re-iterating on things when necessary. If your code architecture is decent, changing the implementation of subsystems isnt a big deal.

With that being said, the lighting system thor is using is fine for its purpose. No it is not massively performant, but it is very simple to implement, has high compatibility, and runs quite infrequently on a relatively low number of pixels, from my understanding. The criticism of it is largely academic.

I do think thor could absolutely handle the situation a lot better and be more mature about it. It wouldve been a great opportunity to point out the differences of optimal and in-production code and why sometimes we settle for the less than optimal solutions and why it is absolutely fine to do so.

source: am sweng

5

u/CarbonInTheWind Jul 17 '25 edited Jul 17 '25

People assume every game programmer who isn't on the same level as John Carmack isn't good at it. In the real world you have to balance optimization and the project timeline. There are very few Carmacks out there who have the time and patience to squeeze every possible ounce of performance out of a code base.

You optimize enough to get things looking and running smooth enough then move on. Hopefully you'll have time to go back and clean it up more later but if not you still have a functional product.

If you let yourself get bogged down trying to make everything perfectly optimized as you go you'll never finish any project on time. Many of us still get caught in that trap despite our best efforts though. I guess that's part of always wanting to be a perfectionist even though that's usually not best for the project.

5

u/ArqHi Jul 17 '25

Exactly.

If you let yourself get bogged down trying to make everyhing perfectly optimized as you go you'll never finish any project on time. Many of us still get caught in that trap despite our best efforts though. I guess that's part of always wanting to be a perfectionist even though that's usually not best for the project.

I feel like juniors in particular fall into this trap quite often.

4

u/CarbonInTheWind Jul 17 '25

And it's probably the hardest thing to get juniors to let go of. It's not intuitive to knowingly make an imperfect product because it can be created in an acceptable timeframe. It's so hard for a lot of us to accept that mindset.

1

u/AlternativeTruth8269 Jul 18 '25

Yeah, that's why this game's development has been going according to the roadmap and release dates schedule. Oh wait...
I sincerely don't understand what extreme optimization is being discussed? Lighting algorithms, that have been implemented thousands of times already and are available publicly, usage of enums, structs and iterators? What else?

2

u/AlternativeTruth8269 Jul 18 '25

Do you really think that using enums and structs to increase developer experience is some sort of crazy obsession with optimization? Also lighting in a 2d game should be a common thing, already solved a while back. Taking a bit of time to figure it out gives you a pretty much free performance boost.
And yes, for devs code quality matters a lot, since everyone had to add features to a questionable codebase, support legacy code etc.

1

u/ArqHi Jul 18 '25

Maybe read the op? We are talking specifically about the lighting here.

→ More replies (2)

-2

u/[deleted] Jul 17 '25

[removed] — view removed comment

3

u/ArqHi Jul 17 '25

Optimal solutions are preferred when they are needed. Optimizing solutions that have no discernible effect on the end product is objectively wasted effort. From a project standpoint you are rarely paid to satisfy your own professional curiosity, but rather to deliver a produt that fulfils the design criteria.

This is very much a junior mindset of optimizing things that dont need to be optimized. Yes what you are suggesting is more performant, but as this code isnt being run constantly on the entire screen, it does not matter. It is a 2d game that runs in 360p(?). It does not need to scale very much.

→ More replies (5)

1

u/AdFun2436 Jul 18 '25

Do you mean you asked AI?

1

u/snowmonster112 Jul 17 '25

I think people attacking the problems with the code itself are pretty nitpicky, but i feel like the general consensus i’ve seen is that the majority of people are frustrated at the amount of time the development of the game has taken with the more simplistic code that is presented. At least, that’s how I feel about it.

Undertale did not have a very clean code, but the game was well delivered on a somewhat organized schedule. If you make a promise to your audience and establish yourself as someone who creates games, your audience would want you to take game making seriously and make progress on it, regardless of how “clean” or “proper” it is.

Heartbound looks like a good game, but I want to see the game finished, and especially after so many years, it hasn’t made much progress, and much of Thor’s content isn’t even focused on working on the code itself. That’s my 2 cents

3

u/Farn-Lucifer Jul 18 '25

Well yeah but undertail had what 3? 4? Paths maybe? Heartbound is a choose your own adventure. Where every action affects the other paths. That is very different.

1

u/AlternativeTruth8269 Jul 18 '25

Some people are arguing, that that "simplistic" code is one of the reasons that the complete game is not out. Because developing in such style is heavily slowed down by the code quality.

→ More replies (1)

1

u/EmergencyTicket2071 Jul 18 '25

The issue is that he portrays himself as a game dev authority with decades of experience, when in reality he’s an amateur. Doesn’t matter if he’s never verbatim said this; these are the connotations you give when you spam the fact that you worked at Blizzard for 7 years.

The code reviews are a response to this character he’s put out on the internet. No one has a problem with being an amateur developer, the problem is not admitting to it.

3

u/Feran_Toc Jul 18 '25

I've been watching him for over a year now. As someone with minimum coding background (2 classes on different languages), he's never come off as an authority on coding to me, so I really don't understand where that's coming from. I why people say he has an ego, but not that.

If it's only for the reason he keeps bringing up that he worked at Blizzard, and then that's hypocritical. The only time he has brought that up is if it was relevant to a story, but far and away is in response to someone asking about it in chat. What is he supposed to do, not interact with his community and answer questions?

I'm pretty sure that one video that was released recently has some date and time stamps. Shouldn't be hard to prove me wrong.

3

u/doobyboop Jul 18 '25

I find this interesting, because I've watched him from before the drama (not religiously, but casually), and I have a bit of coding experience, and some game dev ( programming) experience.

I definitely got the impression he was great programmer. I'm not entirely where, but when I saw his code quality I was a little bit yikes. But like, that's fine, just I was surprised.

I feel like people get caught up in semantics, like he never SAID " I'm an expert programmer" he never SAID " I have 20 years experience programming games."

But like c'mon, he says he has 20 years game development, and worked as a hack for the government. Of course that gives the impression of technical expertise.

But of course it seems like you avoided this and I wonder how.

4

u/Farn-Lucifer Jul 18 '25

He said he has 20 years experiance in game development. Not Programming.

→ More replies (4)

1

u/NanoVermeer_5900 Jul 18 '25

Everyone is criticizing him not because the code is not optimized and bad (which it is), but because he claims he has many years of experience, so much more than a junior dev would have and yet is writing on par or even worse than a junior dev would write code.

The contradiction between his code written and his supposed years of experience is why he is getting exposed to not be a professional game developer. I guarantee you never gave context on how many years the dev who wrote the code has because otherwise it would be a different story.

-4

u/Sileh Jul 17 '25

Can you ask the dev if is this normal for a dev/hacker with 20 years experience?

5

u/Archangel_117 Jul 17 '25

20 years dev experience is not the same thing as 20 years coding experience.

-10

u/sketch252525 Jul 17 '25

Ok, I take it the code is fine. I know nothing about coding. So wheres the finish game ? with how much money he get from streaming, Sure he will hire more ppl to develop the game. Plus he Worked at Blizzard.

1

u/dsruptorPulseLaucher Jul 17 '25

The dev said he'd finish the game for a 200k contract, he will send pirate his resume and experience if interested.

3

u/Archangel_117 Jul 17 '25

Wouldn't work. All the remaining work on the game is writing, not coding.

3

u/Feran_Toc Jul 17 '25

There's something you're missing. The only unfinished part of the game is the writing, the story. That's all Thor has left to do. The actual code is all done according to him. He's got the framework to put in the new dialog once he's written it. What's taking so long is the story and that its a "chose your own adventure" rpg. So there are dozens and dozens of paths to write for. He feels (and I agree) that if he hires someone to do that writing for him is no longer his game. He's said this on stream a few times. This writing probably also explains why the monthly updates can seem a little lack luster.

3

u/Archangel_117 Jul 17 '25

He releases monthly updates, and one just went out last night.

What's the point of the last part of your comment? Saying he worked at Blizzard? I don't understand the relevance to the topic.

He doesn't need to hire more people to develop the game. The code is done. All that's left is writing, which he works on regularly.

0

u/[deleted] Jul 17 '25

[deleted] — view deleted comment

48

u/time-will-waste-you Jul 17 '25

Yes, regardless of complexity and clean code, he did in fact make a game.

You can also pick a handful of hobby projects from various senior devs and there will be shortcuts.

21

u/Delicious-Ad5161 Jul 17 '25

I think it’s a good idea to keep in mind that Thor also hangs around a bunch of people who aren’t Clean Coders. So by association I don’t expect him to write code that meets those standards but is instead purely functional.

2

u/AlternativeTruth8269 Jul 18 '25

With all due respect, what was presented wasn't a "clean code" issue. Code legit looked like a fast mockup which snowballed into a monstrosity. My main issue is why wasn't it fixed to something more workable after the beta was released.
Feels like Thor did a quick and dirty version for beta and then just rolled with it.

→ More replies (17)

1

u/90bubbel Jul 18 '25

well in fact the game isnt finished, and its been development for 8+ years

1

u/time-will-waste-you Jul 19 '25

That is true, but you can argue that Candy Crush is not finished either as they keep adding levels to the “game”.

Modern games are also released as a MVP nowadays, and then DLC’s are released often with the actual game content.

→ More replies (2)

15

u/Delicious-Ad5161 Jul 17 '25

This is why I haven’t watched those videos despite them being pushed at me by the algorithm.

8

u/Eckred Jul 18 '25 • I’ll Drink to That

I've gotten these recommendations as well, but I couldn't care less if they are right or wrong. I haven't watched them, because it's extremely destructive to bash someone who has produced functioning games, for the code they have written. For an unexperienced coder it's just demotivating to see that your code could be picked apart, even if it works perfectly fine.

3

u/Delicious-Ad5161 Jul 18 '25

Especially when the code itself functions fine and there are legitimate reasons to make weird decisions. The entire premise of attempting to crucify someone’s code because it doesn’t fit your use case, style, experience, or a standard that might not actually be good to begin with is ludicrous in and of itself. You can tell they are people reacting on pure emotion and grasping for anything to attack with hoping it sticks.

→ More replies (3)
→ More replies (2)

1

u/Apprehensive-Mall219 Jul 21 '25

Yea, I guess being ignorant is blissful huh?

1

u/Delicious-Ad5161 Jul 21 '25

Ignoring the rage engagement farming is. There’s zero reason to nitpick a solo dev’s code when they’re the only one maintaining it and their ability to understand their own thought process and structure is the only thing that is important for maintenance, and that it functions is what is important for anyone using the product.

→ More replies (2)

2

u/AlternativeTruth8269 Jul 18 '25

I would assume that people see the dissonance between the code quality and Thor's way of presenting himself. I honestly think that Thor is a normal dude, not a scammer or an egomaniac, like some paint him out to be. It seems that Thor is not the best at handling such situations, so he perpetually makes those situations worse.
To be completely fair, drama stuff was completely overblown, and level of shit Thor experienced was unaccouted for.
But sadly, his responses haven't made the situation any better. I still don't understand, why he is even interacting with the critique and farming he is getting in a manner he does. What's the point of lashing out and keeping drama going.

→ More replies (5)

11

u/[deleted] Jul 18 '25 • Gold Blast

[removed] — view removed comment

1

u/Apprehensive-Mall219 Jul 21 '25

He's being criticized and scrutinized on his code because of the alarming amount of times he refers to his time working at blizzard and his 20 years of experience. When you boast about things like that, your code should reflect that time and experience. If you got sloppy code, and you're bragging about working at blizzard, you look like a clown.

1

u/AlternativeTruth8269 Jul 18 '25 edited Jul 18 '25

What led you to such conclusion? I am not a gamedev, I develop backend. But almost everything I saw was more or less in good faith and fairly reasonable critique, as a dev I have seen way more asinine ways to code review. Anyone who wants to do coding semi-professionally will encounter code reviews and learn from them to get better or to stand their ground and validate their approach with testing, metrics etc.
You don't have to be a programmer, but it doesn't mean that you don't have to learn. Most people would be pretty happy to get a third party good faith review for free (at the start of my career I actively sought out people at hackathons and code meets to do cross reviews and pair programming to up my game), especially when starting up, since their decisions might not only be not optimal - which is a bad practice, where you are actively teaching yourself antipatterns and general gabage, those decisions might slow down your development to a standstill, where adding anything will create a multitude of issues, adding functionality will be outright impossible.

4

u/Swift1313 Jul 23 '25

You completely forget the human element, that programmers are people too. People not starting a project because they can't do it "perfectly" is very common. Use Undertale as an example; terrible code, plays great! If they want to learn how to do it better, or get code reviewed, they will reach out. But unsolicited coding advice just makes people feel like a failure and more likely to drop their project. And these critique videos, specifically, aren't done in "good faith", but to reap the benefits of the current hate train. Just go make games, which is always the underlying message from Thor, is way better than "go have professional code with professional standards that are the most ideal for lighting".

2

u/[deleted] Jul 17 '25

[removed] — view removed comment

8

u/RipLow8737 Jul 17 '25

Being technically correct, it is n3, but practically if you bound the input size then you get consistent performance and if that’s acceptable then you check it off as done and move on. Over optimization is a time suck and not every algorithm in a program needs to be optimal.

1

u/CorrectTechnicality Jun 24 '26

for time complexity you always take the worse case scenario. otherwise every time complexity would be equal to O(0)

You don't understand what worst case means. Worst case doesn't mean you blow it up by a few powers. Best case doesn't mean you go to O(0). Worst/average/best case ALWAYS lock the data size to an abstract 'n' and analyze what happens with different incomming data. Let's take linear search:

- Best case: O(0). Element is in the first position.

- Worst case: O(n). Element is in the last position.

- Avergae case: O(n). Element is, on average, somewhere in the middle. Notice that it actually is n/2, but you round it.

See? Worst case also doesn't mean that we have n = 23942384 trillion, best case doesn't mean we have n = 0.

Doing complexity analysis on merge sort you will notice that all the cases are O(n * log(n)), because the algorithm doesn't react very differently to different data. I have no idea how you can get merge sort down to O(0) when you follow the well established and accepted definitions. Please teach me, senpai!

this code has 3 nested for loops which will always result in a O(n^3)

This code has two nested loops, so it should always result in O(n^2), right?

for (i = 1; i < n; i *= 2)

for (j = 0; j + i < n; j += i * 2)

This are the main loops in the non-recursive merge sort implementation (it actually has some more loops inside those, making it 3 nested loops). But it's still O(n * log(n)), so you should really check yourself before you wre... ... ...before you confidently spread falsehoods.

0

u/Regular-Equipment-10 Jul 18 '25

The reason is because it's just an AI slop post.

→ More replies (1)

8

u/[deleted] Jul 17 '25

[removed] — view removed comment

3

u/warchild4l Jul 17 '25

Thor has even said that it is not scalable few times in the past few years (mainly when he showcased some of the features from his game), he said that he implemented it the way he did it because game's resolution is small and this solution is good enough for the given size and amount of pixels.

1

u/f3xjc Jul 17 '25

With small n, O(n) is basically useless.

I had a problem with like 100 000 ~5*5 subproblems and what ended up helping the most was to reuse the same array for all computes instead of 100k allocations and to swap the ifs ordering.

Problem was a fuzzy search, english words are on average 5 letters. It turn out that when searching for a needle in a haystack, quick exit for needles are counter productive almost all the time. Being able to discard hay fast is more rewarding.

Anyway. If there's always about 2 light sources, that can be eaten up in the big O constant.

1

u/gwynftw Aug 06 '25

None of what you said makes any sense. O notation is a rough estimate of how many times an algorthim has to run through a set to achieve its goal. O doesnt always use worst case, you often provide a range of cases. If you only did worse case you wouldnt be able to compare 2 algorithms one which is always O(n) and one that is ideally O(log n) but is worst case O(n)

NOBODY says O(n3) its O(n2). O notation is describing the graph. O(n3) is the same "kind of curve" as O(n2) the point is that its exponential.

the code complexity is certainly not O(n) as O(n) requires to run through the inputs once which is impossible for nested for loops to do.

idk the code, but this is O(n) because n here represents the pixels. IN A MAZE SEARCH ALGORTHIM you dont count height and width as separate Ns... thats now how this works. Its how many times you have to check each "thing" in the set... in this case pixel. O(n) n for pixels. Oh so if i flatten this 2d array, into a 1d array, its suddenly O(n) fucking crazy, so much more performance.

so with O() Notation you always take the worse case scenario

so the worse case scenario is i have the exact same size pixels and light count

This is not how this works at alllll (from a cs algorthim analysis perspective). When talking about O notation you focus on a single set. If i want to find the o notation of a maze searching algorthim I dont make it O(n3) (cause it would be O(n2) im crashing out) because theres a loop for each maze. but i sound like a crazy person even then CAUSE N HAS TO BE THE SAME ITEM, ITS N is a singular set..... it wouldnt be N anymore if we had a seperate set!

It would be, at most O(x * y * z) BUT NOBODY DOES THAT, thats not what O(n) represents ;lkajsd;lkgjna;slkjngal;kjfgsd

-2

u/dsruptorPulseLaucher Jul 17 '25

O(n) can be described as "for every element of a collection, you do a given calculation once". In Pirate's code, we iterate over every pixel in a sprite once. It doesn't matter that we can physically see the word "for" twice, one nested inside the other. What matters is the bounds of the loops. He doesn't iterate over every width pixel for every height pixel, he iterates over every width pixel index for every height pixel index. Big difference. If he does this for every light in the scene, the runtime complexity would be O(n^2), not O(n^3).

8

u/TheMrFluffyPants Jul 17 '25

O(n) absolutely cannot be defined as that, that’s a misrepresentation.

O(n) a measure of time complexity. In layman’s terms, O(n) means the time required for the operation grows linearly with its input (n). If the input goes to infinity, the scale of the operation is always linear in growth.

O(n2) time complexity means that, at minimum, the growth of the code is multiplicative. As both width (w) and height (h) increase in values, the number of computations goes up in multiples. And when both values go to infinity, the computations is (n2).

Thor’s function isn’t quite O(n2) in practice, since w is not equal to h, but it is O(n2) in complexity since, in the worst case where w IS equal to h, it does scale quadratically. Same logic with lighting.

Also, your friend points out that this code is fine for a non-programmer game dev. Which is true! Toby Fox had notoriously bad code, but he does not boast about how “highly performative” it is. You cannot lie about the performance of your game (again, his code is only fine for his purposes, not fine code), and how it can ‘run on a smart fridge’ (which it can’t), and mislead your audience about your experience.

It’s an insult to developers. Putting it into a different situation, it’s like a math tutor who brags about their skills, only for you to find out they struggle with algebra.

1

u/dsruptorPulseLaucher Jul 17 '25

You could represent every pixel in a single array. You could not have width and height, instead only having number of total pixels. In this case you would agree it's O(n). The fact there's two variables is confusing you. The way the data is represented is irrelavent. It's one set of data where we are iterating on each element one time. This is an O(n) operation when n is the number of elements we are operating on, in this case pixels on a screen.

2

u/TheMrFluffyPants Jul 17 '25

By your logic, you could also represent every pixel as a fixed total if you knew the resolution of the game. If the game were 128 x 128 pixels, you could argue it’s in constant time since you know the exact number of operations you’d need for 1 light source (16,384), but that’s not how algorithm analysis works.

The input for Thor’s algorithm isn’t number of pixels, it’s resolution. When you double the resolution, you aren’t just doubling either height or width. You’re doubling both of them, and the resulting number of operation quadruples.

Either way, whether it’s linear or quadratic, it doesn’t change the fact that Thor’s claims that this implementation is ‘highly performant’ is incredibly misleading. This is a brute force algorithm with no optimization for efficiency whatsoever.

→ More replies (1)

2

u/Archangel_117 Jul 17 '25

He doesn't mislead his audience about his experience. He doesn't claim he has 20 years of experience coding. Coding is not the same thing as dev, and experience is not the same thing as skill.

I think people always assume that when a person says they have X years of experience in something, that they are automatically saying they have some universally equivalent amount of skill in that same thing. But that assumption is on the reader/listener, not the speaker.

If I work as a welder for 20 years, then I can accurately say I have 20 years of experience as a welder, regardless of how much skill I have as a welder after that point. Not everyone who spends 20 years as a welder will have the same skill at the end of it. If people are making an assumption based on what THEY think the skill of a 20-year welder will have, they don't get to use that assumption to claim that I misrepresented my SKILL when I CORRECTLY and FACTUALLY stated my EXPERIENCE. They are not the same thing.

2

u/TheMrFluffyPants Jul 17 '25

Ah, let me be clear. I never specified that a developer requires coding experience. That’s not the issue I have here. A game developer can vary from a creative director, sound designer, artist, etc. All of whom are the lovely developers that create our games.

Here is the real issue. He doesn’t have industry experience. To be blunt, working at a game company does not make you a developer, nor does it imply industry experience. A QA is not traditionally considered part of the “Gaming Industry”, nor a developer.

But let’s just say it is. It’s closely tied enough to the process that, sure, let’s stretch the definition a bit and move on in Thor’s resume. He spent 6 months as a Qa, quit (by his own words), then spent the next 7 years self-employed as “Freelance Security Researcher and Developer”, spent 3 more years at Blizzard as a QA, 3 more as an applications hacker (not game applications, website), a social engineering hacker (phishing emails), then 2 more years as an automation engineer & Cyber security specialist. Even our lenient definition of what qualifies as being part of the Gaming Industry would only net him ~4 years experience. None of which was spent designing games.

And to address your analogy: If someone claims they’re a welder, I’d at least expect to know how go weld. But let me raise you a different one to understand this situation. Thor is essentially claiming he has 20 years of dental experience because he worked as a receptionist for a dentist for 13 years, then opened his own clinic where he eyeballed every procedure. Every patient there came out with a cracked tooth and he tells you they’re all,”Exceptionally well-handled.”

This is essentially what he’s playing off his experience like. I’m speaking as someone who works with Security Analysts and Game devs (because I am a software dev).

1

u/Kerrigore Jul 17 '25

Plus there a different types of welding; someone who spent 20 years arc welding might not be very good at oxyacetylene, and vice versa.

Thor’s roles were largely security related, as a red team specialist- and even then, his focus was on bypassing physical access controls. His hacking black badges were in cryptography and telephreaking.

None of that involves being an expert coder. I expect that’s one reason he partnered with Primeagen for his podcast as Prime has much greater expertise when it comes to actual coding.

1

u/TheMrFluffyPants Jul 17 '25

Sure, sure. Maybe he’s not a great coder/programmer. And maybe he acknowledges that, knows he falls a bit short there.

So why does he offer up programming advice when he isn’t good at it?

https://youtube.com/shorts/G7L6mQxlfVU?si=10sQW7szMkJBs5YN

Or refers to himself as a Professional Programmer?

https://youtube.com/shorts/q2pL890BvWw?si=j0Cqi00Ww2GClFie

And sure, maybe it’s because he’s done some code now! He IS a professional programmer, because he does it for work! Maybe. Maybe. What about being the ‘Bob Ross’ of programming?

https://youtube.com/shorts/hZRwxYy6H6k?si=G-hANHaWU_2Ph2KN

And his code is still awful.

3

u/s0litar1us Jul 17 '25
  1. You don't need much experience to provide advice, and that advice was pretty good to be fair.
  2. "Professional X" means that it's your profession, your job.
  3. He said that people (likely chat) call him "Bob Ross of programming".
→ More replies (1)

2

u/poon-patrol Jul 17 '25

That’s crazy that you sent a clip of him showing that he’s not an expert programmer as evidence of him pretending to be one. (That description is a joke if you needed it explained). I love the Bob Ross one too, the person who said that is clearly talking ab the vibes of Thors videos talking over programming to the vibes of Bob Ross talking over painting. Nobody’s saying that Thors skill level in coding is equivalent to Bob Ross’s painting ability

→ More replies (1)
→ More replies (5)
→ More replies (5)

1

u/ohelo123 Jul 18 '25

Software dev here. You're absolutely correct.

1

u/CorrectTechnicality Jun 24 '26

O(n) absolutely cannot be defined as that, that’s a misrepresentation.

Yes, it can. Big-O answers the question, how the resource consumption (usually time or memory) increases when you increase the input.

O(n**2) time complexity means that, at minimum, the growth of the code is multiplicative.

O(n) is also multiplicative. If you multiply n with 10, your algorithm will take 10 times longer. An O(n^2) algorithm will take 100 times longer if you multiply n with 10. You use the wrong words here.

As both width (w) and height (h) increase in values, the number of computations goes up in multiples.

So, if you increase the width by multiplying it with 10, will the algorithm run 100 times longer (O(n^2)) or just 10 times longer (O(n))?

is O(n**2) in complexity since, in the worst case where w IS equal to h

If I run a linear search on a list of integers, what is the complexity? O(n), right?

If I run a LINEAR search on an image to find a pixel of a certain color, you claim the complexity is O(n^2)? If you tell this to anyone doing image processing, they will ask you this one question: https://www.youtube.com/watch?v=tb2Ct3yyB4g

Same logic with lighting.

Feelings, not logic ;)

No, the number of lights is CERTAINLY not bound in any way to the number of pixels, so please don't blow it up to O(n^3). In fact, in his code the number of lights is a very tiny constant, so you can round it away, leaving his code with being O(n).

I don't quite understand why the correct explaination from the OP is being downvoted, while clear misinformation recieves upvotes. I know Big-O can be confusing, but can't people think for more than 5 seconds?

1

u/JinSecFlex Jul 17 '25

Can it? Yes, it can, if you want to be very off the mark of what time complexity is and arrive at incorrect calculations.

1

u/Sensanaty Jul 18 '25

No, n in the context of Big-O does not denote anything other than the abstracted upper-bound time complexity of a given algorithm, only really useful when trying to do asymptotic analysis. It doesn't equal to time spent, CPU cycles, number of instructions executed or anything else of the sort. 2 algorithms that are both O(n) can execute in different timeframes and with different resource usage.

It doesn't matter that we can physically see the word "for" twice, one nested inside the other.

By definition for Big-O, it matters, seeing as it's the worst-case or more accurately upper-bound growth of a function. For Big-O, you take the worst possible case, and in a nested for loop that is always O(n^2) by definition.

1

u/CorrectTechnicality Jun 24 '26

By definition for Big-O, it matters, seeing as it's the worst-case or more accurately upper-bound growth of a function.

Big nope. In Big-O you round. Up AND down. An algorithm that reads an n-sized list 2 times is rounded to O(n). Not to O(2n), O(10n) or O(n^2). You confuse this with best/average/worst case analysis. They all CAN have different complexities, btw.

and in a nested for loop that is always O(n^2) by definition.

Following are the two loops in a non-recursive implementation of merge sort:

for (i = 1; i < n; i *= 2)

for (j = 0; j + i < n; j += i * 2)

You claim merge sort is O(n^2) by definition. Great. Here, in the real world, the best/average/worst for merge sort is always O(n*log(n)).

As an exercise, transform the two loops using width and height into one single loop. Maybe you get more insights into computational complexity theory. This things are pretty basic and beginner level, so I am shocked so many people here get it wrong...

1

u/Yamitz Jul 17 '25

You’re touching on an even more complex topic - which is “is O(n x m) better or worse than O(n2 )?”. If n and m are similar (and normally in algorithms we’re thinking in terms of order of magnitude, so n = 160 and m = 720 would be similar) then there’s no difference between the two. If m is close to 0 (relative to n) then it would be similar to O(n). And if m is much greater than n then O(n x m) would be worse than O(n2 ).

Big O notation is just a quick way to evaluate the performance of an algorithm when you’re designing it. In this case both have already been built and so the better way to compare them is with real performance. And everyone is right here - this code is performant enough that it doesn’t matter and so it’s not worth changing, but it’s also not how a senior professional game dev would write it, and it’s definitely not good enough to dunk on other people.

2

u/Archangel_117 Jul 17 '25

But he doesn't "dunk on other people" in a way that suggests he is some sort of "god of programming". People keep saying this... and it's just not true. It's a biased interpretation of his attitude by people who already dislike him, and are predisposed to interpret the things he says in a way that further paints him negative.

0

u/[deleted] Jul 17 '25

[removed] — view removed comment

2

u/ShapesAndStuff Jul 17 '25 edited Sep 08 '25

ev$WKU04yXeR9E-:Vf&t0(AlmiES2*;e(D.mKenF]h)J-W;TrDe72#<opR<hkV$$tkzm<QJWuhWA,[fDd[tsO%-L0mi<VPb4ZPI$pKgi.Qg%9cX:^)H%FALI.o3(;ed.1508Id0&,~+x*PwR$[TrQiunDZAIXMl&[GphwIZ.5([woboOEM&vc

2

u/Simboiss Jul 17 '25

Isn't going through every concerned pixel needed no matter what? What would a "correct" implementation do? Having a bitmap overlay with light masks is nice from a design point of view, but it doesn't prevent going through every pixel to do some processing. Even an optimized shader would do that. So what's the problem? CPU work vs GPU work?

→ More replies (2)

-1

u/s0litar1us Jul 17 '25 edited Jul 17 '25

O(x*y) is closer to O(n) than O(n^2).
It's about how much slower it is based on an increase in input.
O(n^2) means it's exponential, O(n) means it's linear.
Seeing how the loops are structured can be a quick way to guess what its O(...) is, but it's more than just one loop is O(n), two nested loops are O(n^2), etc.

Also, worst case is more about what code paths run based on the input rather than the largest possible input. For example there is a loop that only runs n times if the first number in the array is a specific number. The worst case is O(n) as the worst case is it being that number, and it then scales linearly based on n.
Another example is that for a search algorithm the worst case is when the value you want is the last possible one to check, not that there is a huge amount of values to check.

Again, Big O is about how it scales. The variables involved may in some cases match up with another Big O, but how it scales is different. If it was that way then O(1) would also be O(n^2) since 1 == 1^2

2

u/TheMrFluffyPants Jul 17 '25

O(n2) is quadratic, not exponential. That’d be O(2n).

Worst case is a measure of all input size n, not just the code path run. If each pixel were touched just once, you could make an argument that n=w*h and is therefore linear. In Thor’s case, depending on how many times light diffuse is repeated, each pixel can be visited multiple times per loop. Even if the number of pixels is linear (debatable), the growth rate of Thor’s code is quadratic at the minimum.

1

u/CorrectTechnicality Jun 24 '26

If each pixel were touched just once, you could make an argument that n=w*h and is therefore linear.

Correct. This would be a valid argument.

In Thor’s case, depending on how many times light diffuse is repeated, each pixel can be visited multiple times per loop.

Yes, the pixels will be visited as many times as there are lights. Ignoring the fact that the num_lights is a tiny constant in his code, we get: n = w * h * num_lights.

This is linear. Increasing one of those numbers (let's take num_lights) by 2 increases the runtime by 2. Not by 4. Not by 8. Just by 2. I repeat: This is linear.

Even if the number of pixels is linear

This makes no sense. Number of pixels is just the number of pixels. It's not linear or quadratic on its own.

If you perform a linear search on the pixels, the runtime will be linear. Merge sort them to get O(n * log(n)). If you bubble sort the pixels, it will be quadratic. If you bogo sort them, you get O(n * n!).

→ More replies (1)

1

u/Altruistic_Hunter835 Aug 13 '25

If it was that way then O(1) would also be O(n^2) since 1 == 1^2

This is an old comment, but Big-O absolutely works this way. Big-O notation represents the upper-bound of a function's growth, whereas Omega notation describes the lower-bound, and Theta the tight-bound. Either way, if you're talking about Theta complexity, the statements

O(x*y) is closer to O(n) than O(n^2)

are purely speculative, since we don't know the relation between x and y.

For example, if we let n <- sprite_height and m <- sprite_width, then we first know that O(n) <= O(n*m) (where O is just Theta, for simplicity)

As for the upper-bound, it's completely unknown, since m could be

  • m = theta(n) (grows strictly greater than n, such as m = n^2), thus O(n*m) > O(n^2)
  • m = o(n) (grows strictly less than n, such as m = log n), thus O(n*m) < O(n^2)
  • m = Omega(n) (grows proportionally to n, such as m = k*n for some k), thus O(n*m) <= O(n^2)
  • m = k for a constant k, thus O(n*m) = O(n)

From this, the upper-bound can be literally anything, and the "closeness" of O(n*m) is just as arbitrary.

2

u/[deleted] Jul 18 '25

[removed] — view removed comment

0

u/Knifferoo Jul 19 '25

Interesting that you bring up critical thinking. Just a question, would you think someone claiming to have multiple decades worth of experience to make mistakes you'd find from someone in their first couple of years in the field?

-2

u/[deleted] Jul 17 '25

[removed] — view removed comment

2

u/poon-patrol Jul 17 '25 edited Jul 17 '25

Nah you guys j don’t understand what gamedev means. You guys do know that ttrpgs have game designers right?

2

u/ShapesAndStuff Jul 17 '25 edited Sep 08 '25

)C9$TdQWxOuU3Hry7W![8uvJ6rORKw43A5*dsWC<EoB%SU~d5>BvkCc&#DXtTRqdTUv40od

W0,AxV5bJyKX6qEV.u%2eHzt<xJ#hba%h5~bql0U49)15b7n-d5CV3J:~a,>.$GXzq&*:9L-sF

VBuuPoGQg),,5Ac.q:Vb,[F$dim<4-f2hMlRsfXc$LkT31U3642G8F~qiF>u%,U6TQl5bye~wxNrt74.O<Z::cnKn2T(ax%G.I.eTtocRtVLA-ZL9GpTR&6n):ibaeZxQlM02V;<! uu(X(WbO37Nn$GIcPku7pb5DW9:GRsmJRias~l7e%wsW)m739wnGV9n4dSZ

0

u/purchase-the-scaries Jul 17 '25

I think you’ll find a lot of videos showing he does. Note. I’m not saying he says “I know everything I am the authority on this”. But he has lied on several occasions to set a persona for his followers.

Some super smart, ex blizzard developer who is some genius hacker.

It’s the same thing people do when they go for job interviews - lie in their resume and act like they know something they don’t to get a job.

2

u/Archangel_117 Jul 17 '25

He goes by Thor.

He DOESN'T "act like an authority" on this. People assume that based on his tone, but it's not what he implies. He has never acted as some god of programming.

-1

u/purchase-the-scaries Jul 17 '25

Then he should change his name.

Someone doesn’t need to come out and say “I’m an authority on this”. You are being gas lit. It’s every small thing that he has done that shows the kind of person he is.

You can believe otherwise that’s fine. I’m not here to turn all his followers against him. He sometimes says some decent stuff even. But doesn’t change anything else I believe.

2

u/Farn-Lucifer Jul 18 '25

Why should he change his name? You are all so damn wried about thism Thor is his middle name. The one he likes to use online. I don't use my real name online either. Neighter are you 'purches-the-scaries'. He used his middle name which yeah he can wow. Such news. Just like I use Luci online and my mom calls me by my name.

-1

u/purchase-the-scaries Jul 18 '25

Call him whatever you want.

2

u/Farn-Lucifer Jul 18 '25

You are so wierd ngl. If you don't want him to lose followers why are you even here commenting? And what exactly are the ones watching him getting gaslit about? That we... should try and make game even if we know nothing about that? That we... should not be afraid of misstakes? Oh maybe that we should still do stuff that we love.. no... hmm.

Oh maybe that he has 20 years of experiance in Game Development which some seam to think is the same as saying 20 years of experiance in Programming? Is that it? The narrative that has been made to fit the crime? What else is there? That he didn't like the skg movement? So he aint allowed to have a differing opinion? On a pedition that isn't about human rights or animal heath? Really??

→ More replies (1)

0

u/[deleted] Jul 17 '25

[deleted] — view deleted comment

1

u/AlternativeTruth8269 Jul 18 '25 edited Jul 18 '25

Some things presented were 100% not fine in the slightest. I don't understand that "fine" approach. So anything goes, just get the job done? And, somehow, the release dates are moved, features can not be added at a reasonable pace, bugs a flourishing because of minor changes. That's just "fine".
Like, you legit get burnt out working on such code. If this is supposed to be your fun project that people payed for, I assume that you don't want to start hating it in 6 months and constantly being scared to add changes because it will break something. And some practices that were pinpointed by reviewers are red flags for such code.

1

u/BambinoCPT Jul 18 '25

I'm a software dev.

He has 20 years experience in the game industry.

He doesn't use for loops.

The codes not good.

1

u/ohelo123 Jul 18 '25

I'm a software dev. The code is not good. From the little I've seen, it's pretty egregious.