r/PirateSoftware • u/dsruptorPulseLaucher • 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
4
u/Nartiohk Jul 17 '25
Why the if true statement is a blunder? and what's the actual result of these two implementation.
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.
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.
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.
17
u/[deleted] Jul 17 '25 •
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.
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
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.
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.
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
1
u/pskfry Jul 17 '25
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
welp thor presents himself as a career programmer so that's a bit cringe
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/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
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.
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/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?
Q: Why does he have magic numbers?
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
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
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
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.
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?
-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.
0
u/[deleted] Jul 17 '25
[deleted] — view deleted comment
8
u/[deleted] Jul 17 '25
[removed] — view removed comment
2
u/[deleted] Jul 18 '25
[removed] — view removed comment
-2
u/[deleted] Jul 17 '25
[removed] — view removed comment
0
u/[deleted] Jul 17 '25
[deleted] — view deleted comment