>global.flag[916]Wow, great coding.
>human generated code is badFork found in kitchen
>>746093506Bro just vibecode that shit, programming from scratch is fucking retarded>"umm yeah I don't google search anything I go to the library"
>>746093506Simple, elegant human code written in RPG Maker 2003.
>>746093608>>746093731>>746093813Saars.
>>746093506No one cares about the code as long as it works. Make a good game first. You know the iconic dialog of the generation-defining game Undertale? All of the witty humor and charming characters that MILLIONS of people love and made Toby Fox a millionaire, meet Sakurai, and compose music for an official Nintendo game? It's all in a massive 1000+ condition switch statement.Stop being autistic over code and make a good game.
>>746093506if this is decompiled wouldnt it meant hat the numbers have a meaning pre compilation?
>>746093506That's because it's related to the super secret evil route
Complaining that code isn't readable to you means nothing if it's readable to the main programmer. All of my scripts for my job use complete nonsense for the variables that I translate using a handwritten codebook so if they decide to fire me the code is more difficult to understand.
>>746094701>It's all in a massive 1000+ condition switch statement.Which is why I never understood why some coding tranny made that video about Yandere simulator and its code like I give a shit, I'd never play that game and I never cared about it but who the fuck is autistic enough to look at the code and be like "Ummm this bad coding or whatever" Only thing I know about Yandere simulator is seeing troons posting screenshots of the code like it matters
>>746094701That code is from Undertale's sequel
this isn't even slightly bad, the fact hes using 915/916 is likely due to the fact that it's decompiled, that's how GM worksthe fact he's checking for argument count also suggests he's also calling the function from script_execute which is usually the optimal way of doing things
>>746093506Having a big array of game flags isn't the worst thing. But you should use a constant value instead of raw numbers so you can read the damn thing. Maybe they weren't preserved after compiling and decompiling.
>>746093506Making it difficult to go back and change shit forces you to get it right the first time and move forward with the project.
>>746095587It is this naïve way of thinking that causes people to bump into problems they can't work around because they didn't build their projects in a smart, expandable way, causing them to quit or plunge into refactor hell.
>>746095051That makes a lot of sense, low iq shit from a low iq
>>746095719No, I know and already considered all the benefits of adhering to best practices. And I think in this circumstance when the coding job isn't very complex, the benefits of keeping things smart and tidy isn't really worth it, especially when you're the only guy doing the code. Or Toby is a codelet. What works still works.
>>746096071>the benefits of keeping things smart and tidy isn't really worth itSame mindset taken by people who live in squalor and who never clean their rooms, do their dishes, or take out their garbage. The benefits of keeping things smart and tidy don't need to be evident for it to be worth working smart anyway.
>>746096239They are called industry best practices because they're best practices for the industry, for working in large teams. If you're doing all the work solo, nobody else is going to need to be able to read it in order to work with it. Of course Toby had a level of tidiness in his code. It's not like everything is written in one continuous line. But it's just enough for him to understand it and work with it, and that's enough.
>>746093506enums would make this system perfectly readableif this is decompiled there's no way to know if the coder used enums in place of that magic number
>>746093506>>global.flag[916]>Wow, great coding.Yes, integers are faster to compare than strings and literals.
>>746093506>decompiled code is unreadablewow nice fucking find sherlock
>decompiled code results in a bunch of nameless variables No fucking shit.
since this is decompiled i assume the original used some sort of enum for the flag indices
>>746093906Sorry that AI replaced your mainstream reasoning for why America needed to import trillions of browns to every tech company in the west, rabbi.
OP is a colossal fucking retard, thank christ multiple anons called him out
>>746097051Such is the intellect of losers trying to spam "stealth" threads for Underslop/Deltatroon.
>>746097104don't care for the games but I also don't think any current game should be banned as there's nothing rule-breaking about it afaik
>>746093506that ain't a multithread safe mutex. when will these jokers learn
>>746094701Is Deltarune still Gamemaker? Because if so, Gamemaker is also sort of just like that. It's not a particularly elegant language.
>>746096659llms are actually pretty good at guessing enums, they just pull all of the uses and surrounding code into its context and reason the likely enum out. its made decompiling way easier
>>746093813I don't know what RPGMaker 2003s like.This looks like a small script, at the top I see the language seems to be this is triggered by some event.Is it doing a value swap?
>>746093506>//anon doesn't know commented out strings don't appear in undertalemodtoolsure its still dogshit code but rest assured the one who coded this must have written down whatever the fuck that piece of code does there
>>746096871silence, bratella
>>746094953This. Obfuscating your code itself by design is job security 101
>/v/ attempting to talk about anything more technical than gay furry sexythis place is a toilet
>>746096583Making stuff neat is also a service for your future self. It's normal to forget the mental model eventually. and it shouldn't be painful to build it back.
>>746094776decompiled means the code could be completely different to what was written in the first place.this is like listening to a dance recital and critiquing technique.
>>746093506>decompYou are a retarded nigger ape monkey barely considered conscious and by no conceivable means sapient if you think this is actually how it was originally coded before the compiler had its way with itThis doesn’t even look properly decompiled
I deserve a Berdly bf
>>746094701>No one cares about the code as long as it worksPeople will once the mass firings begin.
>>746096979Saaaaaaar.
>>746093506Why is it hard for ai derangement syndromers to understand that at any given moment AI is the best it will ever be? That with every prompt AI gets more efficient? If you want AI code to be more organized and neat, you can literally just train it to do that.
>>746099223>>746094953this senior i used to work with did this, once AI came around they kicked his ass out the door the first chance they had
>>746093506The flags all had readable enums names but that would get lost in decompilation.Good job.
>>746093506IDK anything about programming. Explain what's wrong and how you'd fix it.
>>746104126let's say you make a decision in a game, kill some guy who's important and was supposed to appear later in the gamein the code, you can make a "flag" - a true/false value, and you call it "importantGuyWasKilled". if you kill the guy, you set the flag to true, if he lives it stays false. the flag's value is then checked later and depending on if it's true or false, different things happen in the gamebut whoever coded this didn't use any naming, instead they use a list of nameless flags and access them by their position in the list which is insane, you'd have to either know the whole list of thousands of flags by heart, or look its meaning up every time you want to change a flag
>>746105253you can just have an Enum that tells you what each number means in text. It's more efficient coding to use numbers.
>>746105253There are several advantages. It packs better to have array of bools. You can serialize/deserialize it easily and efficiently if your data is all neatly packed in one place
>>746104126Nothing. OP and >>746105253 are retarded and don't understand what they're looking at.
>>746094701There's nothing fundamentally wrong with a giant switch statementIf you have 1000 cutscenes, its a reasonable thing to do. Just make sure to give the ID numbers good names so you say "cool_dude_intro" instead of "scene #378"global_flags[915] is fucking unhinged
>>746102763Is that what all your employees say rabbi
>>746105253This is a decomp retard. The naming isn't going to exist because it was human readable enums before compilation replaced them with an int.
>>746094701>It's all in a massive 1000+ condition switch statement.It later got refactored to support japanese translation
Am I insane or something? Why is everyone talking about muh decomp variable names? Are not seeing the fucking dead code?
>>746108261>Why is everyone talking about muh decomp variable names?
>>746105253>>746107868Even if it's named, I don't know why any game has 1000 different integers for 1000 different usesLike is 400-450 all inventory? Is 232 the full-screen setting? Is 3 and 4 the players X Y position?It makes no sense to all be in a big ass global array[integer]
>>746094701>look at me being retarded and not understanding things Maybe it wouldn't take you a decade to make a shitty RPG-maker looking game if you didn't design your code in a way that makes it extremely easy to fuck up and extremely difficult to find your fuckup, you fuckup.
>>746107868It's that Piratefags game.
>>746104126It's made in a way that makes it extremely easy to mess up and very difficult to find the source of your error. It looks like some self-taught single developer mess that will never be finished, because the structure of the code creates and endless sea of busy work. Being organized is very important once you write more than a short script.
>>746108984Consider the amount of things you might interact with in your average Dark Souls game (chests, doors, lootable items, key items, etc), and you can quickly see things adding up. 1000 things isn't that incomprehensible, though of course the method of tracking all those variables is likely going to be more elaborate (before compiler optimizes things, anyway).In this case, the hard coded number 915 may have very well had some name associated with it during development, and that array has simply added up to containing a thousand or so items.
>>746096583>t. retarded nodev who has never made a game solo or in a large team
>>746110278>chests, doors, lootable items, key itemsThat's 4 things, not 1000You can make an array[chests] and an array[doors] and at no point are you typing the code door[314]Globals[915] means there are a thousand different things named in the code. Somewhere in the code is 913, somewhere 912, somewhere 911, somewhere 910if Mario has 1000 coins in the game, there is no code that says "if coin[134]" or "if coin[620]"
>>746108573Yeah no shit. Okay so I’m not insane you’re all just retarded. This whole function could be a single line of code and everyone’s talking about the variable names.
>>746110883Only 5 out of 7 chapters are out, so I think this is placeholder with a todo once later chapters release
>>746110817>That's 4 things, not 1000Every individual thing has to be tracked separately one way or the other, because you need to keep track of what chests have been opened and so on. So if you have 1000 chests you can open, you'll need some way to keep track of thise. You could use individual bits of some binary values to represent that on/off behavior, so one integer variable could in theory track multiple things, but I doubt most developers go to such lengths these days. Something like that was more common on PS1 or something, when you had to worry about memory card capacity.>if Mario has 1000 coins in the game, there is no code that says "if coin[134]" or "if coin[620]"If you use something like enums to reference the keys, you'd be writing something like array[enum.keyxyz], which a compiler might optimize down to just a integer representation. I think the main thing I'd change in this setup is to keep different things in different arrays, lookup tables or dictionaries, but I don't know the context, so I'll leave it at that.
>>746111591>1000 different things takes memory Yes, obviously, it takes 4000 bytes or whatever. But 1000 coins should not take 1000 lines of code!You should still not write in your code, anywhere, "if coin[enum.the_one_on_the_mountain]"You should just have a for loop that goes over all the coins and does the coin things. All the coins are the same. They don't have their own code.So if you ever have an enum with 200 things, than means you probably have at least 200 different lines of code that do 200 different things on what SHOULD be similar objects (coins)This is how I know, instantly, just by the decompilation, that globals [915] is shit code
>>746094701Maybe if he didn't it wouldn't take him 8 fucking years to shit out a glorified flash game drawn in MS Paint.
is checking for 200+ things every frame a good idea or not? asking for a friend.
>>746112497>"if coin[enum.the_one_on_the_mountain]"Depending on usage, it could be simplified down to a for loop going over a range of values, rather than individually checking each thing individually with a conditional statement. Would I recommend doing it like that? No, there's probably a better solution. Can I see some solo developer doing it like that? Sure, I've seen worse code in the wild.For reference, see this monstrosity, which does exactly what you're describinghttps://gist.github.com/alessonforposterity/832da4fab11e10609dad
>>746113169Depends. Games tend to check many, many things per-frame. The question comes down to how computationally heavy each of those checks are, and if they all need to be checked every frame.
>>746094953>All of my scripts for my job use complete nonsense for the variables that I translate using a handwritten codebook so if they decide to fire me the code is more difficult to understand.All I'm hearing is nobody should've ever hired you to begin with
>>746113169In what sense?Performance? You can check 100000 things every frame and you're fine.Complication? Depends how you organize your code and what those checks are doing.There's many things that look and sound ridiculous to someone who doesn't make a lot of software, but there's nothing actually weird or bad about them in reality.
>>746113169You usually have to and it's not gonna be a performance issue or anything. Like, consider a bullet hell game, every frame every single of the potentially like 500+ bullets onscreen is gonna have to do a collision check with the player.Don't worry about checking a buttload of things every frame if they actually need to be checked, but if something only changes or is capable of being triggered (thus requiring a check in the code) in response to certain things the code for that should just fire when that thing happens instead of going off every frame. It's all context based
>>746113169Depends entirely on the check. That said, almost nothing except for input and graphics need to be run every single frame.
>>746114425imagine something like stardew valley, there are 200 NPCs (that act like player) that can change their inventory, till soil, chop tree, etc. They are all scattered over different maps and can move between areas.
>>746105253It's decompiled. There could (defenitely is) a header library file with a bunch of defines so that writing SPECIAL_EDITION gets rewritten as global_flag[911] by the preprocessor when you go to compile. It's the way signals are handled in C.
>>746114904>there are 200 NPCs >(that act like player)Those are pretty loose qualitative things, as the performance requirement for processing a player entity and NPC can vary wildly.If the NPC is off-screen and uninteractable, the system could be simplified down where those NPCs are updated only every once in a while, or when player gets near them. Like if they have a routine they follow, you could simulate that routine in chunks as necessary, instead of ticking things every frame.
>>746115189>It's the way signals are handled in C.The code in OP is GML, I'm pretty sure, for which I'm not sure if the compiler is as sophisticated as the one for C.
>>746115591GML is interpreted so it doesn't even have a compiler.
>>746114904I don't see any major reason why that would need to run every frame. I mean unless are updating all their state machines or similar. Then it's probably fine since each state/component can set their own timing as required.
>>746116489I only know how to do elseif and switch check...
>>746114904stardew valley gets updated 60 times per second a single core cpu would have 250000 cycles to figure out what each npc has to do (probably nothing) it's alien technology
>>746093506Elitist techbros who constantly view everything through a hyper-competitive lens and gatekeep what is or isn't "good" are the biggest faggots around. They're self-anointed reddit geniuses who of course claim to know the deepest intricacies of any system and everybody else doesn't know what they're doing. The right mindset is one of genuine curiosity, learning, and bringing yourself up and the team.
>>746093506>>746093813>spaghetti code: :|>spaghetti code, japan: :O
>>746107868yeah well i didn't see that
>>746107868nah m8, john blizzard actually uses magic numbers on his code
>>746093506retard
>>746114904If they're not in a currently loaded area and you can't see them it'd probably be a really barebones simplification of it rather than having them actually act out all the logic. Probably just a timer between actions and then it'd just resolve the whole action, like just put the gathered thing in their inventory and clear the crop tile without actually having them move around to it and execute the full interactions and stuff.It might even be something where instead of running in real time it'll just all be frozen while you're not there and when you come back to that zone it'll check how long it's been and then run some simplified code to catch everything up in one frame. Apply crop growth all at once, execute however many simplified NPC actions there were time for, that sort of thing.
>>746115189>>746115591>>746116396Most GML games like Deltarune are "compiled" to bytecode interpreted by a VM on runtime, these can be easily decompiled back to something resembling source for moddingSome games use YYC which is converted to C++ and compiled to native architecture, YYC games run a lot faster but it requires more effort for devs to port to different hardwareMore info here: https://discord.gg/UQvbY6kVn
>>746114904>>746116605I am neither of those anons but let me try to help you some.Could you simulate everything off-screen in a game like this? Yes, but it depends on how complex all the logic is behind these things, that's what the other anon means when he says loose. Are you incrementing one int? That's trivial. Are you running pathfinding for every single one while also updating the map data in real time resulting in the pathfinding to recalculate constantly because you're also simulating rain and its making mud puddles that slow NPCs so they pathfind around them and also every tile has 4 different types of plants running multiple functions to simulate growth realistically... etc. The more logic you are cramming into those checks and the more those checks needs to talk to each other the bigger deal it will be. Ultimately ask yourself, what MUST you simulate. Think about my over the top example, so many calculations for plants growing would be silly. Why do the NPCs need to path find around mud when the player isn't even seeing them? Maybe it matters if it's some kind of resource gathering game so you want their pathfinding to simulate how they would gather less with the mud but that's a lot of calculations, why not just figure out how many resources they gather when raining and when not when the player is on the map, then when the player is gone you don't simulate anything other than rain and keep track of how long it was raining and how long it wasn't, when the player gets close again use those times (just two ints you tracked) to calculate roughly what they should have gathered and maybe add a random number to make it less obvious. Those are the kind of tricks you should be thinking in. "Can I simplify this simulation and get the same result or pretty much the same result." Also the other anon mentioned state-machines which seemed to confuse you. Learn the concept, it's really not complicated and it's very useful to understand. It's basically a flowchart.
>>746093506I’m a retardIs that C or python?I’m thinking C
>>746118384I think it's game maker script
>>746118384Neither, its GML, Game Maker Language. It's the scripting language for the Game Maker engine. It is indeed similar to C though as well as JS.
>>746093506Ok smart guy let's see you do it!
>>746118128That's the coward's way and it leads to jank. Do like Factorio Chads, batch your data.
>>746116605That's fine if the NPC is simple, but it can get pretty frustrating down the line if their AI gets more advanced.For things that you want to check every frame, lock stuff behind timers as much as possible. If the NPC is moving on screen you probably want to update their position and animation every frame or physics update. But things like checking their schedule for what to do next or simulating movement off screen could be done once every second and so on(if at all).
>>746118912I genuinely don't know anything about how Factorio batches data, did the devs ever write something on it? I would actually be interested in reading it.
>>746121072The fast friday facts blogposts are loaded with information on how they optimized things and before and after benchmark comparisons. There's like a decade of posts to go through if you're interested in it