What makes this particular language the cornerstone for developing videogames?
>>715865647 (OP)doesn't support user defined genders
cheap high-level abstractions
>>715865647 (OP)because it's just C with more features. it's still a bloated mess but at least it doesn't force them on you
This + SDL is all you'll ever need
>>715867095raylib is better
Is C++ really as difficult to learn as people make it out to be, or is it just all a meme? I hear that it's confusing compared to regular C, but I've watched a two-hour video before of some guy who haven't touched the language before but was able to make a game out of it for the Nintendo DS
*implicitly converts ur object*
>>715865647 (OP)It doesn't. Almost every game from the 70s up to the PS2 era were written in either assembly or C. C++ didn't catch on until the XBox 360 and PS3 generation.
Also, C++ is a dogshit language for games. Ask any C++ developer and they'll tell you that they basically code in a C-style way, just with .cpp file extensions. A lot of C++ "features" like the STL are totally ignored, for instance.
>>715867224Any of the big languages is fine to learn programming with. C++ just has things inherited from C if you want to be more optimal, but no student needs to start with those
>>715867245>Ask any C++ developer and they'll tell you that they basically code in a C-style way, just with .cpp file extensionsDid you get this opinion from your twitch streamer?
>>715867356I got it from Casey Muratori and Mike Acton.
>>715865647 (OP)In theory? Closer to the metal than C# and in return "more efficient".
In practice? Game projects being as big as they are, the better readability due to programming shortcuts and automatic garbage collection leads to a more efficient system in C# once the project spans a certain level of complexity. To keep C++ to be efficient the amount of work becomes exponentially harder increasing complexity. So C# STARTS as less efficient than C++ out of the box, but given enough time/complexity it often ends up being the more efficient one.
Readability of code is generally underappreciated and in a team project it can absolutely be worth it to sacrifice a bit of code efficiency if it means the code is much more readable because code that is readable is code that can be maintained for many years to come by multiple people beyond the guy that initially wrote it (and even the initial author will likely forget it within a few months of writing the code).
>>715867532>automatic garbage collection leads to a more efficient system
>>715867224Just a meme
>hear that it's confusing compared to regular CBecause c++ came with more tools. Like in C you need to make data structure your self while in C++ you can just choose
>>715867532Ant this shit is why games have more and more hardware requirements every year while not becoming more complex in visual and technical sense (by optimistic estimate that is, often they are worse.
"Readable" code that jeets can work with is more important than releasing high quality product, and programmers that can properly use a fast programming language are too expensive.
And no, I'm not a programmer and whatever arguments you may have are literally not my fucking problem, because I am a customer, and as a customer, I observe obvious degradation in terms of production quality compared to times where games were made by competent software engineers.
>>715865647 (OP)You can't go with python for good performance in a resource-intensive AAA game.
>>715867592>ignores the further clause still determining what anon meant here>failing at English grammarOK jeet
>>715865647 (OP)ASM is unreasonable unless you're retrodeving for an older hardware.
C is quite lacking for larger projects.
C++ is a bloated mess.
so people tend to use C++ but just limited parts of it, that make C more flexible, like operator overloading and data structures.
>>715867960>trying to convince people that leaning on garbage collection is better than just properly architecting a system>calling literally anyone else a jeetpeak irony
>>715867095Sure, but I prefer C+++SDL.
I think C++ is right in the middle of readability and efficiency as far as coding languages go. There's a lot more languages out there that are easier to read and have a lot less cruft, but those won't let you get closer to the metal like C++ does. Most of the time when you're coding games you won't need to worry that much about that kind of hardcore optimization, but when you do need to worry about it, you really need to worry about it. That's why (I assume) alternatives like Rust or whatever the latest language of the month is haven't taken off, besides just the momentum. If there was a better language for coding games, the AAA industry would've taken steps to switch already, but it hasn't happened yet.
>>715868221Stop calling it "coding games" and "coding languages".
It's programming.
I'm sick of this faggot zoomer "coder" nonsense.
>>715868289Brits have always called it "coding" since the 70s/80s. Go watch some BBC specials about the rise of the microcomputers.
>>715865647 (OP)It's C but with more features and comforts, it shouldn't be that surprising. Even if you hate all the bloat it has accumulated over the years, you can just choose not to use those parts of the language and instead do C style C++
>>715868398Then brits have been faggots since the 70s
>>715868289>pro gamingIt doesn't matter if you're a pro at games. Keep it to the e-tournaments/fighting threads.
>>715867224I wouldn't say it's hard to use.
But it's hard to understand code since everyone codes c++ in their own way, as there's just so many ways to do things as so many features have been added to it over time.
But what gives it its infamy is the weird hacky techniques that people use to make their own features such as "SFINAE" and "PIMPL" (this one isn't difficult but other programming languages don't do it).
>>715865647 (OP)Do I have to learn Hindi before learning C++
>>715869009Only for Java.
how come there wasn't a single de/v/ thread for the past week?
>>715867095If that's the case, then post the games you've made with that combo.
>>715865647 (OP)As fast as C but way less brittle.
>>715867224It's not hard to learn.
Some people seethe about it because it has a very large standard library compared to most languages, and very flexible language features, so you're able to write a LOT of different styles of code in it, and that makes it so that you can learn a particular subset of C++, and have a complete toolkit for everything, and some other dude can learn a different subset of C++, and also have a complete toolkit for everything that doesn't overlap with yours at all - so it's possible to know C++ and write in C++ and then run across C++ that you can't read at all.
Whereas if you learn say Java, you're going to be able to read all Java. If you learn C, you're going to be able to read all C.
If you learned C++ as "C with classes" you're probably not going to be able to read modern C++ that's using all the standard library algorithms and lambdas and such. If you learned modern C++ you're probably not going to be able to read template metaprogramming. If you're not deep on the inheritance sauce, you're going to have a lot of trouble reading inheritance-heavy C++. If you don't work on the standard library and try to read standard library code you'll be appalled. Etc. They're all part of the same language but at the same time they're different languages.
>>715867224It's not
I actually found Java to be harder than C++.
But the problem is there's a difference between being competent and being a master.
>>715867245>A lot of C++ "features" like the STL are totally ignored, for instance.grim
>>715867425Ah so you learned it from grifters and clowns.
itsover
md5: aba2d78f820482484b0072a43c9b2eeb
🔍
it's super flexible. you can develop around templates and generics, which lets you make functions operate on multiple data types. you can overload operators, functions, classes, and so on. you have multiple inheritance so one class and acquire the attributes of several others. it's versatile as fuck, which means it can solve many problems that other languages can't given only one paradigm or design ruleset.
>>715870779Java has all of that but with proper reflection
>>715870635Mike Acton was the lead engine dev for insomniac for over a decade and current tardwrangles unity engine.
Casey is the handmade hero guy who has inspired countless developers. Ginger Bill, the Odin guy came out saying in a recent interview his language wouldn't even exist if not for Casey.
These aren't idiots.
>>715870973It also has dogshit performance because of the JVM.
>>715867532Languages like C# and Java are better for enterprise purposes, but they do sacrifice performance for maintainability. In big projects, there's almost always a moment when abstractions stacked upon abstractions stacked upon abstractions start weighing things down, affecting user experience, and someone has to pinpoint the biggest chokepoints and refactor or optimize these parts to-the-metal.
>>715871023You aren't programming embedded systems where you need 2ms response times
>b-butNo, you're not
>>715871076Look at what board you're on.
Performance optimization matters for games.
>>715871076all game logic and rendering needs to fit within a 16ms window per frame to hit 60fps, so you’re retarded
>>715871378Minecraft is notorious for its garbage performance due to it being written in Java.
>>715871378yeah, don’t expect to make anything more graphically interesting or complicated than minecraft in java
>>715871118>>715871306Not him, but pretending high abstraction languages are at fault for shit optimization is a very dunning-kruger take. Properly used, they're fine, because you should not and you are not going to write the graphics renderer with them. In context of games, they really replace things like LUA, which were even worse, and their problem is that more people use them, creating unoptimized abstraction monsters that people blame the tool on. And that's without going into the fact that a bulk of performance issues in games are GPU-bound, with incorrect draw call management, unoptimized materials, etc., which has little to do with the languages themselves.
Honestly I don't know. The few times I have been privy to in-house C++ code, often running alongside unreal engine for graphics, it has looked like absolute garbage. C++ seems way to verbose to do even simple shit. I think it's just a combination of being the only viable alternative at the time in terms of C's speed but with muh shitty classes and inhertiance, lots of shilling from Bjarne and MIT troons, and obviously adoption by key players using it for engines.
It's not a good language. It oozes tranny like rust. Not comfortable, not simple to pick up. Filled to the brim with legacy garbage and poor design choices which do not make sense in this millenium.
>>715871634I was with you until your obsessions shone through.
>>715871707>obsession is when thing is thrown in your face every day of every week and you notice it
>>715871864You're the first one to bring that shit up in this thread. Kill yourself.
>>715871927there's literally a blahaj thread right now
>>715871076nta but i did on a teensy microcontroller that had to provide me a measurement, automation, and control system over the web via node-red with RTOS levels of performance.
>>715865647 (OP)Because it's essentially C but with support for object-orientation, which is important in any developmental task that involves giving objects in code certain properties that allows them to interact with one another, like games or scientific simulations.
>>715867224It's not confusing at all really. C++ is just a bit more robust in terms of the tools you can use for a project and how things can be designed.
>>715868428Also C-tards might hate this, but the object-oriented nature of games and simulations makes it a perfect language to use for the medium. Not that you can't use C with games (like people have done before), but as games have gotten more complex, the purely procedural based methods of C just don't cut it in terms of actually making a viable game product or a simulation.
>>715871010Casey still hasn't finished his game in like a decade now and Mike Acton's credentials aren't that impressive. Even your standard scientific programmer has done more than him.
noFilter
md5: c215d395c8d3bc7715da604080468f96
🔍
>>715872106akchually real-time just means that you have dealines, i.e. the results you have to return provide 0 benefit after a certain cut-off point, and the actual timing of these deadlines is not defined by the name
>>715871520What are you talking about? If the abstraction has a baseline cost then that has nothing to do with shit optimization. The JVM has unavoidable cost, and it’s pretty heavy. Next you’re going to tell me python doesn’t run like a turd.
Lua wasn’t ever intended for writing heavy core game logic. Its purpose in game dev has always been to let non-software engineers extend the game, like artists or modders. Or to be used for very light logic, like scripted events. In 2025, it has mostly been replaced in function by blueprint style node programming but it’s still useful for novices making small game projects.
>everyone on /v/ knows how to code
>0 finished projects
curious
I'm working on a 3D game with GLFW.
Should I switch to SDL for the extra functionality, or just combing GLFW with other libraries for whatever else I need?
I'm not too far into the game, so I can probably make it work easily enough.
I wouldn't use the built-in graphics stuff in SDL. just the window to draw opengl to.
>>715872384>combing*combining
not sure what happened there. I'm on desktop, so it's not autocorrect.
low-level, organized, fast, powerful, and is still the best language for software development
>>715872384>>715872420You're better off just using SDL since it's more fully featured and more oriented towards game development. You could use GLFW like I am for a robotic simulation project I am working on, but It would be a pain to mix and match it with other libraries to handle inputs, polling, game events and so on.
>>715872384I've found SDL3 very intuitive and easy to use, but I've never used GLFW so I don't know how they compare.
If you are really early, I'd at least do some quick prototyping/experimenting with SDL to see if you want to switch over.
>>715872384The the version of SDL that has the most compatibility with everything.
>>715872384My current engine uses GLFW and I haven't run into a lack of features but I somewhat regret using it as SDL has far better support for platforms other than PC and I've considered porting my game to the Switch. If there's features you need that are in SDL but not GLFW I would for sure use SDL at that point, it's the gamedev standard anyways. Or just try to abstract over everything so that it doesn't really matter which is used and its easy to swap.
Out of curiosity, what functionality does SDL have that you want to use?
>>715865647 (OP)It runs on everything, has lots of features, there's plenty of documentation, and it's cheap computationally
>>715867224On the surface it's like any other OO language, if you want to write a simple calculator it's gonna be as easy as with Java or C#
However it gives you more control over memory and parallelism, which allows you to be both more efficient and fuck up big time. No garbage collection is a great pajeet filter.
I remember in back in uni when i had to write shit for an exam in x86ASM, it was all compiled trough C++
>>715865647 (OP)Manual memory management, compile-time computations, natively compatible with C, allows fast and easy prototyping.
>>715867224High skill floor, unreachable skill ceiling.
>>715865647 (OP)performance, memory footprint and flexibility
everything beyond c/c++/zig/odin/jai is too bloated for videogames which need to run at 60fps
>>715867224For the last time, you don't "learn" a programming language. You learn the rules of programming, then you apply those rules to with a language. There's a reason why you can't just memorize all the syntax and expect to be a good programmer.
All programming is the same, languages only dictate the amount of time it takes to implement something. With JavaScript, it might only take one line to do something that takes c++ hundreds of lines.
>>715871378that has nothing to do with java. it's just that the scope of minecraft's simulation, and the fact that most of it can't be parallelized (due to deterministic simulation order) makes it really hard to optimize. Especially since they keep adding features and new worldgen algorithms that are more expensive to process.
In fact, the c++ version of minecraft achieves better performances because they've gimped almost every feature of the game to make it run smoother. They've heavily gimped a lot of features from the original game; redstone, the spawning algorithm and random ticks, etc.
On the client side, most of the time rendering a frame is spent on the gpu, so not java by all means. Everything java does is process user inputs, build meshes to send to the gpu, send packets to the server (yes even in single-player, ever since 1.13) and that's it.
The only part where java doesn't shine is the memory usage and the GC spikes you'll get after playing for a long time. Especially since the game is known to have had memory leaks for a while. As those accumulate, the GC spikes get more and more extreme, to the point where every 5 seconds your games freezes for 1 second.
In general, java is expected to be between 1.5-2x slower than compiled languages, but that may vary a lot depending on which java features you rely on. If you rely heavily on jvm reflections, then it's gonna run like dogshit, but overall minecraft is pretty well optimized for that.
You'll be surprised to know that many AAA games are in fact coded in some interpreted scripting language, like lua or papyrus (bethesda's). The only C++ code is what's responsible for initializing everything, handling inputs and talking to the GPU via DirectX or Vulkan. But like most games, most of the time is spent by the gpu rendering stuff.
t. modder since 1.6
>>715865647 (OP)It's literally just C with classes allowing for OOP. It's got a lot of bloat but if C had classes without the bloat called C+, C+ would be the main gamedev language.
>>715877280That exists, it's called C#
>>715872194You don't make a game's rendering engine using python, java or c++. These languages don't even run on your GPU. You must always use a domain specific language like GLSL for opengl or HLSL for Metal.
If you open any game inside a profiler, you'll find that 95% of the time, your cpu is waiting for the gpu to finish rendering the current frame. The rest of the code, the part that runs on the cpu, doesn't need to be even remotely optimized or fast for a game to hit reliable 60fps.
>>715877321Are you retarded?
>>715877087>All programming is the sameJavascript doesn't compile to machine code. It's not at all the same as C++.
>>715877280>It's literally just C with classes allowing for OOPRetarded take. Templates alone are language within language, C macros don't come close to that. If you just need classes and OOP, C can do that, for example Linux uses OOP in C all over the place.
>>715872178coding with a timer deadline is absolute hell. Once you start putting many component together, you must ensure that in all code path, the worst case scenario never exceeds that deadline. this can takes month to validate even for mid-sized projects. Thankfully these chips don't fit in a lot of ROM so you're kinda limited to smaller projects.
>>715870973Java does not have multiple inheritance of classes, only interfaces.
>>715877472OOP was a mistake. The only good part of OOP is virtual dispatching. In C you can just have a pointer to an array of function and be done with it. But they had to slap the whole inheritance thing on top which makes dealing with it a pain in the ass.
>>715877472I'm not saying that C++ is just that, I'm saying that's why it's popular.
You can write just C, using just classes and it works the exact same. Everything else is sometimes nice sometimes not but that's the reason why it became the popular language of choice.
>>715877087for the basics this is true, but you will need to know the specific quirks to use it at max potential
you don't have to worry about memory in javascript
>>715876973You'd be surprised to find out that most triple-As video games are in fact written in slow interpretated languages like lua or god forbid, javascript. If you need performances, then you write a better rendering pipeline. That has nothing to do with whatever language you decide to use.
The only exception being simulation-based games like rimworld, df or paraslop where pathfinding and game simulation takes a significant portion of the time.
>>715877727Memory is a bit more than a language specific quirk.
It's fundamental to how computers work.
If you don't know how memory works or how to manipulate it, you're not a programmer, you're a script kiddie.
>>715877743>You'd be surprised to find out that most triple-As video games are in fact written in slow interpretated languages like lua or god forbid, javascript.I'm not surprised because AAA games for the past decade have had dogshit performance for both the CPU and GPU.
>>715868042>ASM is unreasonable unless you're retrodeving for an older hardware.C/C++ compilers nowadays are so advanced that they write more efficient ASM code than a human can. One of the last great pre-AI achievements in computer science.
>>715867224Yeah it's pretty hard. C++ is not for fun and you need to know how your code will compile.
>>715877727>you don't have to worry about memory in javascriptNot worrying about memory management is not the same as not worrying about memory
>>715867224programming language difficulty depends on how much you know about actual computers. the more you know, the lower level language you can grasp. retards use lua because its high level but dogshit performance, c++ is much faster than lua but harder to write.
>>715866945C fags are so pathetic and always failed cpp beginners
>>715877926and it has nothing to do with the games' code. it's just that they always choose a shitty pipeline because they want their game to look better than the competition's. Most games since the windows XP era are always written using pure GPU/Driver calls. Even when you use a library (e.g SDL) that runs an abstraction layer over those. Internally these calls are compiled binaries that actually do the stuff you've asked them to.
In fact, most AI slop tools (even chatgpt) is written in python, but that has nothing to do with it's performances, python is just another glue to call the driver routines that gets usually called in video games.
>>715867245>Also, C++ is a dogshit language for games. Ask any C++ developer and they'll tell you that they basically code in a C-style way, just with .cpp file extensions. A lot of C++ "features" like the STL are totally ignored, for instance.>>715868042>C++ is a bloated mess.>>715868428>It's C but with more features and comforts>>715870017>It's not hard to learn.>>715872147>Because it's essentially C but with support for object-orientation,>>715877280>It's literally just C with classes allowing for OOP.there should be the death penalty for retarded no-coders
>>715878535talk big eat a fig n00b
Why is Rust so disliked here? Aside from the fact that it needs more time to mature, but that was never an issue for /v/
>>715865793Go back to /gpol/
>>715879691>15 years old language just needs 2 more weeks to matureit's basically too old for its average user taste already
jon_blow
md5: d2e46c7fce4310ced91f9f0c7be11a31
🔍
>>715879691one compiler, depends on Visual Studio, no hardware backwards compatibility, community full of rabid pedo-trannies, memory safety is a myth
>>715865647 (OP)The C family of languages has the best syntax.
That's what I think of when I think of programming is like the C/C++/Java/C# style of formatting.
Stuff like PYTHON and the boomer languages looks too weird.
That's not programming.
Lol.
>>715867224C++ is overly complicated because it's a language where the people who maintain it only ever add more stuff to it, and it always has to be backwards compatible, so they never fix poorly implemented old features or rework them, rhey just tack on the fix to the broken system as a new tool/feature in the latest version without fixing said broken system because that would threaten backwards compatibility.
So C++ is basically pic related.
>>715867224To learn? No. But you will never have a full picture of the language, and some of the more advanced stuff you'll probably never have to know.
>>715880786My coworker does this to our game engine and it makes blood shoot out of my eyes from the stress
>>715880786that is good, I'm sick of updates to things breaking them, maintenance is gay
>>715880747> That's not programming because I don't like the way it looks.Tranny tier.
>>715880541>depends on Visual Studioyou can compile with mingw
file
md5: 970e8d0eca7bef17b0c09c2c0c8fa1c5
🔍
>program in C++
>have to type in "sexually transmitted disease" every other line
What were they thinking?
>>715880786in business world retro compatibility and stability is king, that's why windows has maintained a monopoly in offices for over 30 years, and why servers run on debian stable
>>715881452>being homosexualhave you tried using contraceptives? maybe then aids won't live in your head rent free
>>715881452>name isn't a wstring
>>715881452>this->Huh? Somebody who isn't dumb explain why he's dereferencing this
>>715868439Brits have been faggots for decades, maybe even a century at least. They used to be hardcore enough to tell the King to fuck off with his bullshit taxes and trying to abolish Parliament, and when he wouldn't knock it off they held the bloodiest war fought on the island, charged King Charles with treason and beheaded the bastard. Now they're letting the invaders in, suck up their cash and rape their women.
Is GameMaker's language hard to learn?
>>715879691Most people who dislike Rust got filtered by it.
>>715881782this->member is the same as (*this).member
It's just an oddity 'this' is a pointer and not a reference. If it was a reference you could do this.member
>>715882073I'm pretty sure you can just do name = name;
>>715881782this is a pointer.
It's also pointless to ever do this->member because just typing member will always implicitly be the member of this.
That's AI for you though, being retardedly verbose in an attempt to be have more readable code.
>>715882115Oh I didn't actually read it.
You could also write the constructor as Person(std::string name, int age): name{name}, age{age} {}
lel
>>715882115Then you'd just assign the value back into the parameter, retard
>>715882158>adds this->>doesn't add const& or std::move to string argumentsasuga
>>715882158My favorite part is the comment. NO WAY THE CONSTRUCTOR THAT TAKES NAME AND AGE IS THE CONSTRUCTOR TO INITIALIZE NAME AND AGE
>>715882295I bet you're the kinda nigga who writes a move and a copy constructor
>>715867095I tried it for a little bit and can't find any detailed documentation or at least up to date examples on youtube. How are you supposed to use something like that?
>>715881452I'm pretty sure it's bad practice to have the parameter names in the copy constructor be identical to the class's member names.
The only reason this faggot AI needs to type this-> before the members is to avoid the variable shadowing.
>>715882459Have very specific problems instead of general ones
>>715882459>can't find any detailed documentationYou couldn't find the official documentation?
https://wiki.libsdl.org/SDL3/FrontPage
I managed to figure out how to into SDL without looking up any tutorials and just reading those pages, and I'm a newbie proogrammer.
>>715882330yes, I also overload for & and && getters because I'm not h1b1
>>715882467>in the copy constructorin the constructor*
Not sure why I wrote copy there.
>>715882594Based and optimization pilled.
>>715882467>I'm pretty sure it's bad practice to have the parameter names in the copy constructor be identical to the class's member names.Naw, nobody cares. See
>>715882223
>>715882564Doesn't look very detailed. I liked Qt's documentation for ther qgraphicsscene visualisation framework more.
>>715882805It doesn't look that detailed because SDL is pretty simple to use.
>>715867224It's not hard, but bootcamp webdev niggers with no computer science background don't understand how memory works and make it out to be some black magic feature
>>715882459Read comments in headers, they are more detailed than any documentation you come upon online.
>>715882709Just because nobody cares doesn't make it not bad practice.
>>715867224just use chatgpt unironically
>>715883094But what if I want to use it as a comic relief?
>>715882970I'll try doing that next time, thanks.
>>715867224Its difficulty comes from being a very bloated language but nothing is stopping you from keeping things as simple as you want.
>>715881934No, but it's bad
Mess with it for a year or so and move on to Godot or Unity
What the FUCK do macros even do?
>>715884531they fuck. really hard and long
>>715884268Is GMS 2 good? Does it have indexed color / palette support?
>>715884531If you do:
>#define SHIT "ass"Before your source code compiles, the preprocessor will copy-paste "ass" anywhere you wrote SHIT.
It's that simple.
>>715884898It doesn't, you have to add it manually
The thing with GM is that GML language is really slow, so retro things like that, you have to do in shaders, which really complicates things needlessly.
Though, because it used to be quite popular, there are extensions people have made through the years, like this one:
https://pixelatedpope.itch.io/retro-palette-swapper
So you might be able to squeeze through just modifying existing code, like people do on RPG Maker.
>>715884531not an expert, but from what I understand it's just text substitution at compile time
It can also do function-style stuff, which I use to replace ugly and often called lines with something like FUNC(a,b,x)
If C is so good, why isn't there D?
>>715886418You're in luck
https://en.wikipedia.org/wiki/D_(programming_language)
>>715865647 (OP)OOP is just vibe coding
>>715884531On a basic level, optionally enable/disable parts of the code and copy-paste file content inside another file before compilation. On advanced level, there's macro metaprogramming that's as powerful as it is ugly and undebuggable.
>>715881452using namespace std; // fuck anyone who cries about it
>>715867224C++ is a committee designed general purpose programming language rather than simply an Object Oriented one. This means that the set of features it has is wide many things feel tacked on with many old things left in the background that have to be backwards compatible. So when a beginner starts it the path to A to B can be obscured by the shear amount of options available, combined with a fairly messy package managing system, and multiple ways to write code due to Templates and backwards compatibility with it's earlier versions, and various build systems, and you get a mountain of things to learn. This very intimidating for a beginner.
Compared to that, C is far easier, and gives you the same amount of knowledge of low level programming without decades of bloat. It's syntax is very succinct and very stable, you can go back 30 years and still easily read it, so mostly everything from old forums remains true. Once you understand pointers, their relationship to arrays, and the standard library, your essentially done. I'd go as far as to say C is an excellent first programming language because of it's simple syntax, influence on other languages, and it's relation to hardware.
>>715878218I thought Lua had good preformance compared to other interpreted languages due to the LuaJit compiler being written with C and Assembly
>>715887026>general purpose programming language rather than simply an Object Oriented oneHow many times do we have to teach you this lesson, Cnile man.
>>715887814c kiddies are known liars and homosexuals
>>715867224it was the first one i learned, just from a textbook, and i didn't think it was particularly hard
actually learning other ones after there was a lot of times i'd write shit expecting it to work perfectly fine and it just wouldn't because other languages are typically more restrictive
of course this all depends on your frame of reference, c++ actually has certain restrictions that if you, say, learned c first, might drive you up the wall with you wondering why the standard limits you from doing x when it works perfectly fine in every other language
anyways tl;dr yea i didn't think it was that bad
>>715882459Like the other guys said, you CAN learn SDL from the wiki and the header comments, but of course there are tutorials too:
https://wiki.libsdl.org/SDL3/Tutorials/FrontPage
>>715879691It genuinely filters everyone the first two times they try it
Once you've got the actual majority of the syntax and control flow down it becomes fast to learn because you're just reading more of language from the documentation to learn the standard library and the language features. Every detail being marked up explicitly eg. between variables and mutables or passing by reference or by moving values in. By fumbling around in Rust a lot of decently written C++ turned readable for me.
One massive upgrade to C++ is that things are what they say on the tin, there's no jungle of ten different versions of a same or almost same function written at a different time than what you should be working with. This matters especially when learning.
okay but how do i make my 2d rpg in 1 month?
>>715865647 (OP)just use c
+1 is just bloat
>>715867224wait until you hit compile and get alien error message
>>715889831but how do i use it to make my game?
>>715889831c kiddies are known liars and trannies
>>715878535>there should be the death penalty for retarded no-coders>>715868042 was right about C++ being (in large part) a bloated mess. Basically C with OOP forcefully tacked on in an overdesigned yet messy way. Templates are kino, tho.
But overall, C ANSI still feels so much more pleasant to use for me.
>>715877621>OOP was a mistakeyeah thinking this
>>715879691sounds like you spend all your time getting it to compile rather than actual development
>>715890190It's a very common trope in the IT industry.
1. Imagine a new architecture/tech/pattern that will save us from technical debt, bad code and improve productivity.
2. Push to absurd and idiotic extremes (ie : see Java OOP hell)
3. Back to step 1
In the end, nothing beat having good and competent programmers on board, everything else is secondary.
>>715889949put char's into arrays to make names, texts and ASCII tilemaps and just print that shit to console.
(be really careful to always only read and write inside the arrays, otherwise you do the most classical programming oopsie)
have some numbers that hold some x and y positions of some dudes and some objects, paint them at those coordinates into your screen or whatever and then move them around by changing the x and y values (make the actual game happen here)
have one big enum like "GameState" with variants for all the game situations like main menu, options menu, overworld, town, battle, cutscene or whatever situations your game's made up of. Then run the appropriate part of code based on what this gamestate is. now changing the game state variable will change the game mode, like from main menu to new game etc.
>>715877621You don't struggle with a lack of polymorphism in C?
i like programming. what do people do in c++ nowadays? i thought games moved to c# and stuff but idk i'm out of touch.
>>715865647 (OP)Speed. Hardware is designed around it.
>>715865647 (OP)Inertia
Thankfully much better designed languages such as C# are taking over now
>>715889542i hate rust because it's full nanny
>oh no you can't compile this, you're leaking memoryyes i fucking know i'm leaking memory, this is a test run to see if shit crashes immediately or later, i'll deal with the "leak" later
>but then you should explicitly declare that you are using unsafe rust and i'll still complain because you're not supposed to ever ever use unsafe rust because it's unsafe and you can get hurtfuck off
>also you can't touch this memory, it's from another functionyes, it's my memory and i need it, i got the pointer let me fucking use it
>no compile for you
file
md5: 467b398bce8a2e95d3b5b2c631e9bf9f
🔍
Jai will save us.
file
md5: a5c0cb069a7c2af4a60a98e0cd643c64
🔍
Internet discussions in a nutshell:
>>715867245>>715867356Neither party either proves their claims or debunk it. Instead we use appeal of authority on the issue.
The reason for this (I'm paraphrasing Acton from his talk) is that C++ STL/newer features are too general and thus too slow for the problem. E.g. virtual methods: looking up which function to use takes too much time. Exceptions/templates too take up too much computing time.
This is why C (or C++ in C style) is used in these spaces: because the language ITSELF is just a fancy assembler. You can get comparative assembly to C code that you cannot with C++, which might not seem like a lot, but can add up. But even he says that assembly would have been the language of choice if infinite time was on the table.
Next time you guys debate something, actually TALK about it, don't quote fags on the internet.
>>715891252C# is for unity scripting.
>>715891423>>oh no you can't compile this, you're leaking memoryConsidering leaking memory is not just memory safe but also a purposeful feature you don't trigger accidentally in Rust I gotta ask, wtf are you smoking?
>>also you can't touch this memory, it's from another functionAs in heap memory you allocated in another function? If it was in form of a stack-allocated smart pointer to heap (like String), then that heap memory gets deallocated when that stack-allocated String goes out of scope. Either you carry the smart pointer over like return the String and you actually have it, or no you didn't actually have the memory and that's why it doesn't even compile.
Figure out what new() and drop() on most things actually do and it gets easier to understand. If you were instead toying with something in the global memory then good luck nothing else.
>>715885803Alright probably will stick to my opengl game then. I still havent figured out sprites but whatever
>>715891252c# is not c, it's fucking java 2, and microsoft has dropped it and went with golang instead lmao
of relevant things, only unity still uses c#, but you shouldn't be using unity
>>715865647 (OP)it's old and well-known
>>715891753>The reason for this (I'm paraphrasing Acton from his talk) is that C++ STL/newer features are too general and thus too slow for the problem. E.g. virtual methods: looking up which function to use takes too much time. Exceptions/templates too take up too much computing time.my iq just dropped by like 20 points reading this
file
md5: d686dcd8552b299c8fd206408fb23ac2
🔍
>>715891753You're utterly clueless, non-trivial C codebases roll their own vtable implementation, or even use double dispatch in non-performance-critical sections. And with C++ compiler is aware of vtables and tries to aggressively optimize them away, which in C you'd have to painstakingly do manually.
>>715892997Why would you store void pointer instead of an index to a table of functions or to a switch-case that had all the functions?
>>715893213game engine architecture
>>715893269im not buying a book full of stolen techniques. I he's ok with stealing than he should be on with me pirating
>>715893453it's ok to be poor anon
>>715893591never said it wasnt
>>715892735What's supposed to be the problem here? Besides whatever it does for the CPU caching and lookahead when the actual code is behind more pointer, the less specific and more general the code the compiler must generate, the less the compiler can optimize the generation of that code.
>>715889614Start with a level editor
>>715867224Any individual part of it is simple enough to understand but when you mix all of them together, along with years of new C++ versions adding more and more convoluted stuff, people coding however they please, preprocessor magic, bugs and pointer fuckery it becomes very complex and hard to follow.
>>715893927>the less specific and more general the code the compiler must generate, the less the compiler can optimize the generation of that codesource: it was revealed to me in alcohol-induced delirium
>game engines don't make sense to me
>coding the whole thing makes sense to me
>everyone says making game this way is impossible
>>715872178based fellow real time systems course taker
>>715872384if you make the right refactors this shouldn't be a big lift
>>715894754I think some people have a special kind of autism where they don't work well with high-level abstractions unless they know exactly how everything works under the hood.
If you're working with some commercial engine, you don't know what the fuck's going on in there.
If you make your own engine, you know exactly how everything works and how to get it to do what you want.
I'm like that too. One day I'll finish my engine, so I can finally make my game.
I haven't coded/programmed in a long while and have been slowly getting back into it. What's a good game engine to learn and use if I want to get into making 2D/2.5D games with C++?
>>715895242x86 asm is interpreted by CPU, it's not precise. Have a nice day.
>>715895346>cppreference.com
>>715865647 (OP)Sega Mega Drive Assembly
>>715867224For me, it's hard to learn, because I started with C and when I moved to C++ I realized pretty quickly that like 90% of the features it has I don't like and don't want to use, and I'd rather stick to a mostly C programming style, and as a result I never build up familiarity with C++ code features so when I go to read somebody else's C++ code it's unintelligible gibberish to me. In theory, I could fix this problem, but as a solo hobbyist with no aspirations towards becoming a professional, I've yet to find a reason compelling enough to bother. If you actually want to program C++ professionally, you presumably would need to dedicate a good chunk of time to learning all the ins and outs of the language's features, even the parts that only belong in a chicken nugget.
>>715865647 (OP)One of the few things the OOP paradigm is actually good for is video games. Most other applications do everything possible to not use OO features in C++, or use them in a way that subverts the intended OO functionality, because OO is shit for literally every other application.
>>715867095SDL3 is magical so far
snibsnab
md5: ceb05c65f65798631464e0f8370a6262
🔍
It's over, sepple is DEPRECATED.
>>715867224Learning it is easy. Debugging it however is extremely gay and tedious due to the actual cause of a problem like a dangling pointer not crashing until possibly a very long time after the cause. Also the compiler error messages are the worst shit you'll ever see in your life. I feel like I do more work trying to decipher them than actually programming.
1I
md5: 9e440fce166ce06f03550b7aba2f27a3
🔍
>>715865647 (OP)>>715865647 (OP)>Duuude just use Godot, it's le beginner friendly!!>it's literally indecipherable >try Unity and Unreal>also impossibleI now respect gamedevs.....
>>715895818GUI is primary usecase for POOP, with videogames you have to actively use DoD if you're CPU-bound.
>>715894552It's not some rocket science, the compiler can't for example inline otherwise inlineable functions if it only knows you're calling functions from some function pointer.
>>715895265Defold iirc uses C++.
You should probably use SDL and make your own basic 2D engine, it's not that complicated.
>>715877621>OOP was a mistake.everytime I hear this, my eyes gloss over and I remember that most programmers in the world are python and javascript users. And then it clicks why such shit tastes like this exist in the wild.
>>715896223Ah, you mean C is slow because it's stuck with function pointers. That's common knowledge.
>>715879691It is Javascript of system programming that managed to attract tranny subculture / cult
It has extremely poor standard library and relies on 3rd party packages to do basic things
Plus borrow checker is just training wheels that hinder your progress instead of helping you
>>715867224The problem with C++ is that there's always a million different ways to accomplish the same thing and no agreed upon standard on what the best way is. As an autist I can't handle that kind of freedom.
>>715896408damn, it is actually well put together and 100% true
>>715896716all that speed and no one to maintain it...
>>715878109You mean you need to be aware of implementation-defined behaviour? Because if you mean that, you're wrong. Relying on undefined behaviour in C++ is a sign of a bad programmer.
>But how can anyone know which behaviours are defined?Read the standard.
>>715896716They're also slow for the similar reason why vtables are slow. Or, why the access through pointer in the example text is slow. The compiler can make less assumptions beyond all sort of pointer use to optimize the code and dereferencing is still slower than having the thing at hand in your your stack frame. But this has jack shit to do with language and more about how much indirection you use, beyond the fact that C++ abstractions allow you to make total spider's webs of pointers which does slow shit down.
>>715897469vtable is actually slower than just a call through function pointer, but it does more than you can do with the latter. I'm not going to read you a lecture about good software architecture design or why decoupling is important in large codebases.
we have both indie and AAA devs writing code that loops through all objects on tick, if you're worrying about 1 picosecond of cpu time on a virtual function call you're focused on the wrong things for game development
leech
md5: 379e6f90f116351196cc09c7733d2eff
🔍
>>715897290>Read the standard.AAAIIIIIIIEEEEEEE NOOOOOOOOOOOOO
>>715889614Use RPGmaker and ruby
>>715869571I don't know. There's even less of the usual green gay dragon shit flinging, and last thread I've seen was very tame and civilized.
>>715878297He's right. It's pretty common for game developers to use C++ as "C with convenience features".
>>715897290>But how can anyone know which behaviours are defined?by running a linter altho it doesn't always help, I just recently tripped over accessing an uninitialized std::optional, no warning from clangd or cppcheck, only abort from asan
>>715898392"game developers" are not serious devs. I mean lol. lmao even.
>>715898147You WILL read the standard and you WILL be happy.
>>715898487some of them are alright, like factorio devs
>>715898647and they are not using C++ as "C with convenience features". because that is only something a mongoloid would do (-> self proclaimed "C devs")
>>715879691the compile times are really bad, but otherwise I like it. Almost love it
though I am not sure if its for game development
>>715865647 (OP)It's been around for forty years with it being the first language of many and other languages built from it.
>>715867095>no classes and inheritance>no templates>no RAII>no generics or function overloading>the disgusting garbage that are c stringsdie die die die die
>>715899804It can't be worse than C/C++ compile times. Right .... right?
I underestimated how hard coding was, holy fuck. Toby Fox is inhuman for how he did it by himself.
>>715867095for me, it is c++ and sfml autism
>>715900396>>no classes and inheritance>>no templates>>no RAII>>no generics or function overloadingGood
>>the disgusting garbage that are c stringsFair point
>>715900569Toby can't code for shit either lol
>>715900496lets just say when anki switched to using rust in its code and I compile it on arch...it seriously takes like 8 minutes to compile it
>>715900569Robert Fucks used Gamemaker
Much easier than coding it all yourself
>>715869626game? nah, I wrote an HMI application at work. They sell it for BigMoney™
>>715900569Don't worry. It'll click, eventually.
>>715900396>the disgusting garbage that are c stringswhat do you mean
c strings are perfect
just an array of char, nothing more, and it shouldn't be anything more than that
>>715900668Gamemaker still needs a lot of coding to make anything decent tho. It's not like RPGMaker where there really is no coding, it's just drag and drop assets which anyone could do.
>>715891753You can use CRTP to get rid of virtuals any time you know the type at compile time. Free abstraction for the same inline performance.
>>715867095this, with OpenGL
>>715898909Which C++ bloat features are actually good?
>>715889542Memory leaks aren't even prevented by Rust. In fact, memory leaks are impossible to prevent in any Turing-complete language. It's mathematically provable.
>>715880786In large overly complex systems you do need a language that doesn't break at all though, otherwise you get python which breaks everything in every update.
This is one of those things where different languages actually have different purposes.
>>715900396>>715900608As someone who started learning C recently I find C strings quite curious. That's such a clusterfucky hacky pants on head retarded yet such elegant implementation, I can't even be mad.
>>715901001They're mostly all good if you're aware of how they work under the hood.
>>715901001i think there are a lot of good improvements C++ has over C, which arent bloat, such as raii (ignoring the implications of all the C++ value semantics that came with it), but one admittedly bloaty feature which is really nice are std strings
>>715901239>make overloaded function that can either take a std::string or an int>call it with foo ("test");>int version gets called cause char[] is closer to int than to string
>>715901239>elegantstrnggrtngmnscnnyhitlerhimmlerfggt_s("nigger", "tongue", len + 1 + forgot_the_fucking_terminator);
>>715865647 (OP)It's taught at Universities in introductory classes. I understand that it's due to it being c-styled and object oriented. Apparently, C does not have function and operator overloading.
Just use function pointers
>>715901001>bloatdid your favourite streamer tell you that?
>>715901448Heh. Not that kind of elegant, the kind that it fits everything that is happening in C so well.
>>715900569>decide to learn programming after years of putting it off>turns out I overestimated how hard it would beI'm just built different, I guess.
>>715901367>raii good>but this container that automatically handles text storage and common operations in a memory-safe manner (except operator[] and other fun surprises) is bad
>>715867826>i dont know what any of this means but i'm going to argue about itretard
>>715901448>>715901669And so far I don't like string.h as well. just write your own functions lmao
>C
char *data = malloc(size)
>C++
char *data = (char *)malloc(size)
why?? just auto cast void pointers wtf
>>715901774Let's see your games then, smartguy.
>>715891753>templates too take up too much computing time. What? Templates are processed at compile time.
>>715901768imagine pass data that larger than eight bites
>>715867224the language itself is pretty standard
but the reason you use c++ is because you want really optimized code
and writing optimized code is difficult
there's a lot of little tricks you can use that aren't common to other languages to save a few clock cycles
and you WILL be asked about them during interviews
>>715901983>what is type safety
>>715865647 (OP)>What makes this particular language the cornerstone for developing videogames?It's fast and has all the bells and whistles. It's pretty awful to use though.
Why should I ever need to use Malloc?
>>715902190You can't put everything on the stack.
>>715901983>ever using malloc
>>715902190if you use C then you need it but in C++ dont bother and learn the modern type safety ways
>>715902167yeah but with void pointers its basically expected youre gonna cast it manually to some type so its worth it for that convenience, and also now a lot of code that would work straight ported from c has to be combed through to fix all these
>>715867095what if I also want a job?
>>715902008I'm learning OpenGL. Give me a few months.
>>715901983>I want a strongly typed language>nooo not like this
>>715902440You learn Java sir.
Or Rust ma'am (sir).
>>715902402dont use void pointers. dont be stupid
>>715901983std::unique_ptr<char[]> data{std::make_unique<char[]>(size)};
>>715902454>strongly typedYeah man implicitly converting bool to int is very strongly typed
>>715901983>not casting malloc's return valueheretic
>>715902291lol babby
>>715902190When you want to allocate memory?
>>715901983std::string data;
>>715902634>boolNo such thing.
wallah
md5: 977765ba955f63de30e9604abc88dae0
🔍
>>715884531I like to use them to make my own macro function calls to static functions that I make or other libraries provide, e.g. spdlog. it's so simple and useful once you know how to do it, and it can be very useful for a 1 liner. here's an example of logging.h for the part of the backend of my project https://pokestonks.xyz
the logging macros are at the bottom. you can then call them with 1 parameter, or many parameters e.g. LOG_INFO("AAAA") or LOG_INFO("{}", "AAAA")
>>715902718That wastes memory on storing the length
>>715902454>>715902585c and c++ type checking is basically the same expect for this one difference which has basically been proven to be a big nuisance and not worth it. has cost everyone more time than it's saved. anyone using void pointers is aware its unsafe just let them do it ffs just focus on the features youre adding dont make it barely c compatible just for this one check
>>715902748>malloc>memory allocate>doesnt mean memory allocate
imagine not using smart pointers
>dude I'm such a LE EPIC hacker, I'm gonna make my codebase unmaintainable
>>715902190To overload the new operator
>>715902787You always need the size stored somewhere if you want to do anything with that data and not segfault. What do you think the "size" in malloc(size) is?
>>715872384SDL's just better and with 3 they put more effort into documentation
What would the ideal programming language for making video games look like?
>>715902972Already kept track of externally. Clearly, there is no need to duplicate it.
>>715865647 (OP)high performance + powerful abstractions
there's no other language that gives you both of these
I don't understand why Godot repeated Gamemaker's mistake of needlessly introducing its own custom scripting language.
>>715867592the funny irony of memory management, is C and C++ users vehemently reject GC, but eventually implement their own worse version, the more automated and sophisticated their memory management strategy becomes.
file
md5: a32c3e1d3468c667673642fc983d8d01
🔍
I just think it looks nicer.
>>715871010>Mike Acton was the lead engine dev for insomniac for over a decade and current tardwrangles unity engine.Mike Acton was fired from Unity after 10 years working on their ECS system which is STILL half-baked
>Casey is the handmade hero guy who has inspired countless developersCasey has LITERALLY never made a game, or a game engine
>>715903017scratch because video games are for children
>>715903097Both are bottom-tier because the font isn't monospace
>>715903031Write a function that retrieves the size of malloc'd data from this "external" source.
>>715902838It's just the local malloc schizo. He want you to use mmap and the windows equivalent even if your use case can be handled with a single malloc call and proper memory management.
>>715903181Where did you attain the variable "size" from?
>>715901872im saying its bloated, not that it's bad
>>715903071RAII isn't a garbage collector thoughbeit
>>715903097left is more readable when viewing nested code in a simple editor
>>715897893The issue is that your everyday generic hidden vtables that C++ introduces trash the cache.
Here's what C looks like to a normal programmer
*auto const& *var = const& (*)(getValue(&input) const*;
>>715903062https://docs.godotengine.org/en/stable/about/faq.html#what-is-gdscript-and-why-should-i-use-it
>>715903062Does this shit have proper C# support yet?
>>715903304It literally is
>>715903226>malloc>mmap this is a c++ thread
>>715903304Automatic reference counting is a form of garbage collection lad.
C++ users are just building their own ad-hoc GC every program they write.
>>715903256Holy fuck you are a dumb fuck. You're saying that a std::string wastes memory keeping track of the data size, like using an external variable to track the size of malloc'd data doesn't itself use memory.
>>715903306Not really, it's a question of what you're used to. You know that an if is a counterpart to a closing bracket so an if at the same indentation has the same effect when reading as an opening bracket would
>>715903017I don't think there's one-size-fits-all solution for it, because you have the engine portion, the gameplay logic and data driven things (cutscenes etc). Engine side of things you might want to be performant and closer to the metal, but for writing cutscenes something quick and simple to iterate might be nicer.
So, C++ and lua is a fine combo, for example.
>>715903405But the variable "size" already exists. There is no need to create anything.
>>715903341It has better C# support than Unity. It's still treated as a second-class language that is only supported out of spite, however.
>>715903341Yes, C# is full featured, has access to anything GDScript has. I'm making a 3D action game in C# and came across no road blocks at all.
Unless you're talking about web export support, that's still missing. But that's Microsoft's fault.
>>715903314>var is a pointer to a reference toI don't think you can add a star to auto
>function call mixed with function definition syntax????
>>715903473With a std::string you never need an external size variable at all.
>>715867224>Is C++ really as difficult to learn as people make it out to be, or is it just all a meme?Yes, it is difficult. Memory management filters a lot of people. If you just want to make games it's probably not the best place to start.
>>715903681>Memory management filters a lot of peopleno it doesn't
shitty pointer semantics is usually the thing about C that filters people
>>715903681If I just want to recreate RPG Maker what should I use?
>>715867224im a software monkey at one of those big tech companies. I see all these hotshot cream of the crop engineers constantly make mistakes and cause problems when landing c++ code. I hate using it too.
>>715903808That's called job security
>>715903753For that you could use just about anything
>>715902780and logging.cpp to complete it
>>715903753any language you want that has raylib bindings
https://github.com/raysan5/raylib/blob/master/BINDINGS.md
>>715903753RPGMaker. Don't overcomplicate things - use the appropriate tool for the job.
>>715903902i::fucking::love::c++::syntax
>>715903181It's not portable, but you can do that.
>>715903753>If I just want to recreate RPG Maker what should I use?Unity.
>>715903902>void set_log_filename(const std::string filename){>void set_default_logger_name(const std::string& logger_name){explain why one needs a ref
>>715879691Trannies jumped on rust to take ownership of it, like Mozilla and mainstream linux. They want to re-write all software in rust and force it on people and cancel them if they refuse.
>>715903985>It's not portableSo it's a hacky, non-performant work-around to using at most, 8 bytes of extra memory.
>heh you can't run it an an ENIAC? uhh not portable sweaty! ;)
why are cniles so obsessed with running on 9000000 obscure platforms
>>715879691Horrible syntax, horrible compile times, horrible culture of "just pull in 80 libraries to do one thing", horrible borrow checker shit, makes everything more painful and to no real benefit beyond memes about memory safety. (that even the fields supposedly affected like embedded don't believe in)
No real interesting programs made by the people shilling it non-stop either. If they'd stop acting like activists and more like programmers and code some fucking programs it'd have a better rep.
>>715904516Rust is becoming too powerful and they're running out of excuses. LLVM not being able to target niche long dead 8bits cpu is their last cope.
carbon
md5: 1df9958c6a9b8b42722fde8bdcc70fc3
🔍
>>715903985>>715904119was gonna say this, if youre gonna copy values, you might as well make them plain value parameters, so that callers can choose to move them in the call (or otherwise copy), and you can then move the parameter into your value
>>715904659>Rust is becoming too powerfulhow are those compile times doing champ?
>>715904271I'm not arguing that you should use it instead of storing size inside object, just pointing out that it's possible to do.
>>715904795Fair enough. It is interesting that such a function exists.
>>715904729oh I wasn't intending to slam anon, I genuinely wanted to know the reason for using const& on only one of them
>>715904738>how are those compile times doing champ?9ụSegmentation fault (core dumped)
>>715904985im not slamming either jus making a suggestion :-)
>>715865793template<typename T> Woman* MakeWoman(T&& person) const { return reinterpret_cast<Woman*>(&person); }
>>715865793literally rent free
>>715905014Yeah i don't use C shit either
>>715905123where's the IsWoman constraint
>>715868968SFINAE is not hacky at all what the fuck. It’s literally a compile time check to ensure a generic function only operates on a some allowed subset of generics, and with concepts from cpp17 or 20 I don’t remember where they got added now you even get sane compile time errors
>>715905248You don’t need one. C++ is the most trans friendly language ever.
>>715905351SFINAE is everything wrong with C++ in a nutshell
A whole rabbit hole of behaviour that comes from an unintended side effect of feature that was just hacked into the language, also has a name that makes no sense to people who don't inhabit the astral plane of autism
>>715903097Left can claim to have 4 lines of code, which will impress idiots.
I just use boost::shared_ptr and call functions and stuff
>>715905579>C++ users HATE him
>>715905472It’s not hacky and it’s not wrong. Generic functions don’t have to be fully generic, why would you think otherwise? Not only that but concepts and template argument interpretation is so deeply embedded in IDEs that you get warnings while you're working. You may want a template to operate on text-like data, why would you take a fully generic argument that accepts from ints to random objects? Add an SFINAE constraint via concepts and now you’ve got a typesafe constrained generic function. If you think SFINAE is bad maybe JavaScript is the language for you because it’s probably an IQ issue
>>715903401The only reference-counting type in the C++ standard library I'm aware of is std::shared_ptr. It's not used very commonly, and everyone is well-aware of the performance impact. This is unlike Rust developers, who will happily wrap every object in Arc<T> because they don't know how their language works.
std::shared_ptr is not GC. I will explain the difference.
>std::shared_ptrThe object is reference counted. As soon as the reference count reaches 0, the object is destroyed at the point that its last reference goes out of scope.
In order to implement this, the program must check the reference count EVERY time a reference goes out of scope and it must conditionally perform the object destructor. This creates a significant performance hit due to the possibility of branch misprediction.
>GCThe object is reference counted. When the reference count reaches 0, no additional operations are performed. There is a separate thread called the garbage collector that regularly scans through a global database and destructs any object whose reference count reached 0.
The performance of GC is much better than std::shared_ptr because it doesn't inject a branch into the main program logic. The garbage collector has very little requirement of being performant, so generally, when there are a lot of objects with complicated destructors whose references regularly go out of scope, relegating this work to a dedicated garbage collector thread can greatly improve the performance of the main threads. Also, since there's only one garbage collector thread, there is no need to synchronise any resources that are accessed by the destructors, which could greatly simplify writing thread-safe programs.
So simple reference-counting is not GC. It's significantly worse in large and badly written applications. But it's better when it's applied in the correct contexts. Such as when you aren't writing code like a Java or Rust developer.
>>715867245This is exactly how you use C++. You use its C++ to navigate the AIDS parts of C classic, and you use its C parts to circumvent the C++ bullshit.
>>715905248bool Person::IsWoman() const { return chromosomes.sex[0] == "X" && chromosomes.sex[1] == "X"; }
>>715905678It is hacky, it's hacky language design, it results in very complex side effects and it makes compile times much slower
>>715905678JS causes constant screeching by low IQ footguns. You should have used Python which takes you by the gloved hand to lead you to your goal like a babby.
>>715905729>using an array with strings for something you know only ever has two entries with 2 possible values
>>715905815Sure it does make compile times larger, and yet, I’m working on a MLoC code base and through incremental compiling it’s barely noticeable. Saying they’re slow is literally an internet meme repeated by people who don’t use it in practice.
And it’s not hacky. The side effect is that literally just the right types will be accepted as arguments.
what all those self professed coding gurus itt have in common:
>0 github repos
>0 commits or pull requests
>0 minutes worked as a software engineer in any industry or position
>0 education
>0 projects bigger than 100 lines written
>0 games or software released
>>715905990>The side effect is that literally just the right types will be accepted as arguments.And the right type is deduced by instantiating the entire template and seeing if it fits or not
So to see what template is actually being instantiated you have to have a mental model of the entire function and the type being used as a template parameter
The right type should be specifed at the template parameter definition via a constraint
>>715905843Oh but my problem isn’t with JavaScript. It’s with JavaScript programmers. JS is an amazingly performant language that requires millions of work hours by extremely intelligent people to squeeze performance out of what was a toy language. My problem isn’t with JS is with the average JS programmer which is very different.
>>715905684anon all those words were just discussing how the GC strategies differ, not how one isn't GC.
Anyway, beyond shared_ptr, you also have std::unique_ptr, which is another GC strategy primitive.
>>715905882I was considering simply writing X without quotations to imply use of enums, but I didn't think it would be clear enough. I guess if it was an enum class they'd be namespaced as something like SexChromosome::X but I thought that would be needlessly verbose. I was just making a silly joke pls no bully. Also technically there can possibly be more than two sex chromosomes with rare genetic conditions (klinefelter syndrome, triple x syndrome, etc.)
>>715906234some people think GC only means "mark and sweep deferred collection"
>>715906307those are undefined behavior
>>715906135I can accept that sometimes if you’ve got a family of related generic functions it can be complex, but I can’t imagine an example of how it would be as confusing as you’re making out to be.
>>715906317yep, that's the problem.
C++ users need heavy reeducation, so we can start building better ones and leave the manual meme behind us for good.
> The object is reference counted. As soon as the reference count reaches 0, the object is destroyed at the point that its last reference goes out of scope.
> In order to implement this, the program must check the reference count EVERY time a reference goes out of scope and it must conditionally perform the object destructor. This creates a significant performance hit due to the possibility of branch misprediction.
def one of the tradeoffs of making EVERYTHING scope-based RAII, its obviously convenient but when you have 10 different destructors doin random shit when some object leaves scope it's going all over the place and the CPU wastes more time on these things than if it were scheduled better. RAII is good but it needs some more intentional usage
>>715906395It's like saying that land mines are ok so long as you don't step on them
Yes you can avoid the complexity of SFINAE
But some people don't, some people use it to do crazy shit, and it's something that shouldn't even be there in the first place
>>715906503>something that shouldn't even be there in the first placeWhat if you get invaded and have to hold a static position? A system of trenches, pre-sighted artillery, drones, and SFINAE is amazing for that scenario
>>715906503What is your proposed solution? The only thing I find disgusting about C++ is the retarded std::visit stuff
>>715906482oops forgot to reply to
>>715905684
>>715906621I just said it, template parameter constraints
Which I believe are being introduced to C++ now but they really should have been there from the start
>>715906709Are you talking about concepts and requires? That is quite literally what I was talking about when talking about SFINAE. Are you talking about pre cpp20 SFINAE or something?
>>715906835I have no idea what concepts are in relation to C++
>>715906871Right. I figured as much
>>715906871Not that anon but they're template parameter constraints
https://en.cppreference.com/w/cpp/language/constraints.html
>>715906871custom templates with constraints (C++ users are discovering contract programming)
>>715906914Saying "C++20 fixes this" is no justification for 20 years of bad language design, and because they never break backwards compability it's always going to be in the language
>>715906995>20 yearsAnon...
>>715907052How long have templates been in C++?
>>715907110closer to 40 than 20...
>>715906482>In order to implement this, the program must check the reference count EVERY time a reference goes out of scope and it must conditionally perform the object destructor. This creates a significant performance hit due to the possibility of branch misprediction.see this shit, children? see this? that's exactly the kind snake oil you should avoid. because of this and similar retardation many beginners will avoid using shared ptr because they are "slow". without ever saying what it means and in what context.
this is called micro optimizations and should be avoided. when a shared ptr becomes the bottleneck, and you can only know this when micro benching your code, then yes you can use something else. but the chance is that you will never ever write anything performance critical that this would pose a problem.
>>715906995dw cpp2 is on the way!
>>715865647 (OP)30 years of support for low-level libraries and APIs makes it the go-to for writing the rendering/input layer of video games.
Most game logic is done in higher level scripting language nowadays.
>>715907135You can't micro bench shared pointers because adjusting the reference count is something that happens everywhere a shared pointer is used
>>71590711035 years or something
>>715907135>but the chance is that you will never ever write anything performance critical that this would pose a problemc++ is used for video games which have a soft deadline of 5-16ms for simulating and rendering the game, i would say it warrants considering
>>715907286Just turn on DLSS
C++ is a shit game scripting language due to compile times. You want iteration to be as fast as possible, which is why interpreted languages are better.
>>715895818OOP has kind of fallen out of favor in vidya. These days its all about Components.
It's a little more flexible than OOP.
Good for situations like if you need two very different objects to perform the same functions. Like in an RTS you have a tower and an archer and you want both of them to shoot arrows.
>>715907447Components are not an alternative to OOP
>>715891030interesting. you sound just like my coding teacher in college. guess i'll dust off these decade of rust
>>715907431> interpreted languages are better.Ask Godot users how much they love GDS lol
>>715907226of course you can because you must do an ungodly amount of copying shared ptrs in some critical section to ever reach a measurable impact from a couple atomic operations
>>715907431>he doesn't know about hot reloadingSub-second segfaults, can your stinky interpreted (((language))) do that?
>>71590744799% of games are still using OOP and having components doesnt make something not OOP
>>715907447I really don’t think you know what you’re talking about, sorry to be so blunt but you couldn’t possibly name a list of popular games using ECS. Components as used in games are more like a strategy pattern which is a pillar of vanilla OOP
why isn't it called ++C, pre increment is more efficient
>>715907527Changing a reference every time you access a pointer has a significant performance cost
>>715867224lol no, probably CSfags who think everything they do is high IQ
>>715867224>Is C++ really as difficult to learn as people make it out to be, or is it just all a meme? I hear that it's confusing compared to regular CI don't know where this myth comes from. Raw C is probably more difficult than C++ because you have to allocate memory yourself and rethink your abstractions because OOP is closer to how humans think about problems.
It's like carving a statue with a chainsaw vs a "smart" chainsaw that has a bunch of features that will help you but you couldn't possibly learn all of them.
>>715907590>Changing a reference every time you access a pointer has a significant performance costwhat does that even mean, the shared ptr makes +1 when copied, -1 when destructed. it has 0 overhead when dereferencing .
Why are you arguing so fiercely about shared pointers? They’re supposed to be a niche kind of pointer not something you use all the time. Shared ownership is extremely flimsy. If you’re running into performance issues because you’ve got 10k shared pointers you’ve got a bigger issue, an architectural one
Unique pointers with raw pointers as observers if you need to pull data from somewhere else is usually the standard approach.
>>715907883the point was originally how C++ users are sometimes unaware of the automatic memory solutions they use while bemoaning gc
>>715907829that's what i meant
>>715907883Even if you need to access a pointer, the standard approach is to do so as an observer (raw or weak) not as a shared owner. There’s minuscule cases where you can actually justify shared ownership.
>>715907776Okay, have that guy explain what std::forward does
>>715879691rust is getting shilled to me by my coworker who is constantly shilling some inane technology-of-the-month to everyone in the office so I know for a fact that it will be around for a few years and fade back into obscurity when the its userbase gets bored and moves onto the next piece of trash.
>>715907590>>715907971Show me the benchmarks in a real-world scenario. I promise you it's a nothingburger
>>715908009forwards something as an rvalue or some shit
>>715907883>Unique pointers with raw pointers as observersdont do that. it only needs 1 jeet that delete the dangling pointer
>>715908131Anon, shared memory ownership is a far bigger can of worms.
>>715908046yeah let me write a program of significant size that I can remove the shared ptrs from real quick
>>715908158>Shared ownership is extremely flimsyplease explain
>>715908131It's fine as long as the observers never leave scope of the owner.
Which they inevitably will.
>>715908131Option Types would fix a lot of problems in C
>>715908394option types dont solve that problem and option types are trivial to implement in C++
>>715908441>implementit's a standard library wrapper
>>715907971if reference counting has a nontrivial performance impact on your software you're probably doing something wrong
doosex
md5: d6df056867ba89c5b154e4e1a89299f3
🔍
>>715900569>>715900626>>715900668Reminder that most video games are programmed like shit, and most developers who are actually making fun games aren't obsessing over code quality like a /g/ autist.
>>715908548yes, that thing is using reference counting too much
>>715908585If you think you posted an example of shit code you're a retard
>>715908618it only does that when YOU copy or destroy it. it's all YOUR fault
>>715908208It means you don’t understand the object’s lifetime.
>>715908237This doesn’t solve the issue. It’s literally the same problem, if you need shared pointers or if you’ve got an architecture where an observer outlives the object’s lifetime, in both cases you’ve got the same problem, you don’t understand your own program. Shared pointers is like sweeping the rubbish under the bed.
It lets you hide the problem yes but you didn’t fix anything
>>715908585what is this language
>>715908825>It means you don’t understand the object’s lifetime.No it doesn't, it means it has a complex lifetime
>>715908441they would because some(none) wouldn't crash your program like null does.
>>715908825I dont think you ever wrote anything more substantial than hello world
>>715908917you don't understand what you're talking about
>>715865647 (OP)doesn't force you into a programming style.
>>715908618What makes you think incrementing or decrementing a reference count when you create/destroy a pointer is non-negligible performance cost? Are you doing this hundreds of millions of times a second? Or are you scared of atomics or something?
>>715908672>boolean galore for defining behaviorsIt's not great, but there are worse examples in Deus Ex's code base. I just don't have a lot of other screenshots.
>>715908841UEScript
>>715909025>What makes you think incrementing or decrementing a reference count when you create/destroy a pointer is non-negligible performance cost?I've been working on a language and I've been benchmarking the cost of different garbage collection schemes
>>715908208For example, an object may outlive its ideal lifetime because it didn’t get cleaned up. RAII means an object will clean after itself, but only if it’s destroyed. If you’ve got shared ownership you may leave network or file handles open, leak memory, etc. You should know when objects need to be created and destroyed but shared ownership hides this.
They also allow for circular reference chains where the objects will never get cleaned up. It’s also a general code smell because again, if you can’t quickly and in a few words answer who owns this object then you don’t understand your program.
>>715908972how am i wrong exactly?
>>715909056>>boolean galore for defining behaviorsThere is nothing wrong with this
>>715868042>bloated messyou only pay for what you use
>>715909086an option type won't save you if it's pointing to something that got deleted somewhere else
>>715909080Great! So you've benchmarked shared pointers vs raw pointers in a real-world scenario then?
>>715909196May I see the benchmarks?
>>715909237I didn't save them
>>715908618Commenting every like is fucking retarded.
>>715908860Assuming the shared pointer is being used properly, yes. But anyone overusing them is simply enforcing a complex muddied lifetime because they don’t understand their own software.
>>715908951On the contrary. Unique pointers are the standard anywhere there is large complexity. I’ve only ever seen shared pointers used as the norm in UI systems where several windows may own some resource. But everywhere else in the system the default is unique pointers. Shared pointers are amateurish and common on internet code bases written by redditors and students. Unique pointers are the default in any professional application outside or some systems like I mentioned with UIs
Benchmarking the performance of shared pointers vs raw pointers is impossible because they solve different problems
>>715909085it's true that cpp doesnt stop you from doing stupid mistakes or misusing stuff. but cant see how any of your scenarios throw shade onto the shared ptr.
>>715909161the entire point of them would be allowing safe handling of invalid pointers
>pointer isn't valid hence it's some(none)
>>715909308You can simply turn all the shared pointers in your program into raw pointers and benchmark that
But again, meaningless result because it still depends on other things like what your program is actually doing
>>715909396Anon, that would lead to objects outliving their lifetimes
I mean yeah, not destructing anything could improve performance on the short term, but eventually the program will crash
I wish there was a modern C++. Rust and Zig are VERY close but not quite there yet.
>>715909347Cpp relies on RAII. RAII doesn’t work unless the object is destroyed. Objects aren’t destroyed if you overuse shared pointers and have ownership bugs.
Again, using shared pointers everywhere is simply wrong and not standard cpp. You need to know who owns which resource, understanding resource lifetime and ownership is the core of RAII. If you use shared pointers for no reason you're writing amateurish sloppy cpp.
>>715909114>There is nothing wrong with thisYou're retarded if you're still using booleans as properties for your classes. They should only be used as temporary variables that are calculated in functions.
It'd be better to use a strategy pattern for behaviors, and a list of what kind of gibs it leaves (blood, debris, etc)
But of course, this is a game that was actually released. And that's because people who get shit done don't care about scalability or code quality. They just get shit done the best way they know how to.
>>715909536https://tour.dlang.org/
>>715909576If you actually believe this, you should be able to explain why it's bad
Because it is used in Unity, which is an engine for people who actually develop (and finish) their games
>>715909536Just write down your requirements in the English language and ask Claude to write it in x86SAM for optimal performance.
>>715909671What? C++ is not used in Unity.
>>715909671Anonette, unity uses c#.
>>715909602>null valuesroflmao
>>715909167he doesn't because a real-world scenario would be a poor benchmark for comparing garbage collection strategies because memory management is only ever a meaningful variable if you've done something wrong. if the cost of copying a shared_ptr is expensive compared to whatever you're doing with the object the pointer is referencing you've fucked up.
>>715909524>Anon, that would lead to objects outliving their lifetimesso? it just means you waste some memory, that's fine for a benchmark
>>715909719>>715909724My bad thought OP was talking about C# for some reason lol
>>715909576>It'd be better to use a strategy pattern for behaviorsCan you actually explain why?
>>715908585As with most tech subjects, pure efficiency discussion pales in comparison getting the thing done. I've been a programmer for seven years making internal tools and backend tech for a consumer goods company, and efficiency is always just a background concern. "Code Quality" refers primarily towards readability, consistency, and maintainability.
Whether a game is programmed "Well" is not as important as whether you have a game at all and whether people like playing it.
>>715909576>It'd be better to use a strategy pattern for behaviors, and a list of what kind of gibs it leaves (blood, debris, etc)No that's not better you fucking retard, it requires way more code and it's much slower
Who tought you how to program?
>>715909758>he doesn't because a real-world scenario would be a poor benchmark for comparing garbage collection strategies because memory management is only ever a meaningful variable if you've done something wrongI have no idea what you're talking about, that's completely wrong
>>715909756you're not going to avoid null unless you go into functional languages.
>>715909838>Who tought you how to program?the same person who tote you englishe
>>715909761Resource freeing has a significant impact on performance. The benchmark isn't going to give you meaningful info if you don't include it.
>>715909559>Cpp relies on RAII.it does not. there is something called functional
>>715909918The benchmark is simply the cost of reference counting vs not reference counting
>>715910004No, the second scenario you're suggesting would also not free resources
>>715910049I'm suggesting you don't free resources in either scenario and simply measure the difference between changing the reference counts vs not changing them
>>715909302you make big claims, my nigga. smart pointers have 0 to do with complexity and calling shared ptrs "amateurish" just shows that in fact you are the amateur with strong opinions and 0 understanding.
>>715902787technically all 3 C++ library implementations implement small string optimization, which means the string wont allocate memory if the string is below 15 letters long, which is arguably a more measurable performance improvement compared to removing a size (if it's able to be utilized).
but the real issue is that std::string will zero initialize the memory on resize (unless you use the weird C++20 allocator callback thing).
But this is also true for std::make_unique, if you use new[] instead it will leave the variables uninitialized.
([code]std::make_unique<char[]>(size)[/code] is equal to [code]new char[]()[/code], the () makes the value initialized with zero)
>>715909889As if functional programming didn’t have the same problem.
>ackshually we don’t have null pointers ever because we wrap them in an option monad And what do you do with the option type to use it? Check if it’s null. Now you never have nullptr issues but you have null wrapper issues. Kek
>>715909661if (bBlood){
spawnBlood()
}
if(bDebris){
spawnDebris()
}
>hey anon we need some projectiles to spawn sonic waves upon impact, can you do that? K thanksSure, boss. Just let me write another bool and if statement.
>and hey, we need some projectiles to spawn blood, but ONLY if they're in a room with no gasOh, so ALL projectiles that spawn blood shouldn't spawn blood if they're in a gas room?
>No, this needs to be another propertyOkay, will it effect the debris spawn if that flag is checked?
>No, but we might want conditional debris spawn later on.Adding a bunch of booleans to your object means you have to track WHERE they're being used, is a violation of SOC (because why the hell should a projectile itself dictate whether or not blood spawns instead of the object hit by a projectile?), and adds complexity later down the road if your conditions need conditions.
But again: that's the difference between actual developers and programming autists who never get shit done.
>>715867095The new gpu wrapper is pretty wicked, beats the fuck out of writing a vulkan rendered from scratch. Apparently the 2d api is getting shader support in 3.4 according to some rumours/git commits
>>715910084>change reference count>maybe reference count reaches 0>maybe we free the resource>it takes timevs
>don't change reference countThis comparison is pointless
>>715910241the difference between changing ref counts and not changing them is the difference between memory management using shared ptrs vs manual freeing or unique ptrs
>>715909838>it requires way more codeInitial overhead is higher but the implementation means LESS code, more reusability of behaviors, and something more straightforward for designers to work with so they can leave the programming autists alone.
>and it's much slowerAre you gaming on a 8086 CPU?
>>715910228You're inventing theoretical edge case scenarios that would make the pattern poor practice, but it means nothing because the scenario is made up
You could do this for literally everything, how you code things is based on how your game works and what you know it does and doesn't have to do
>>715910210>you have null wrapper issues.which would be what?
Alternatively, how do you have pointers (being able to do real things) without null at all?
>>715910228>that's the difference between actual developers and programming autists who never get shit done.You're critiquing the code of what is widely regarded as one of the best games of all time and you're somebody who hasn't made a game
Your criticisms are stupid and out of context
>>715910357Designers don't work with code. The most straightfoward way of adding a condition to a projectile is to add another boolean. This game was made 25 years ago, but attaching fucking linked lists to projectiles is going to be slow even on a modern system
>>715910427Data is data. Even without pointers some operation may fail or some thing may not be in the proper state. It’s not a pointer issue it’s a data validity issue. Maybe a in Haskell is no different from a pointer in the sense you still have to check if it’s valid. And functional langs can support pointers, see ocaml
>>715910228>NOOOO YOU MUST FOLLOW THE CODECAMP RULES-AAAACKShut the fuck up retard, you have no idea what you're talking about and you've never had to make anything in a short period of time. If you've already thought out the game mechanics and design then making dozens of classes and abstractions you might not need just wastes time, effort, and makes it more complicated than it needs to.
>>715910228Nta but I think you're getting into mixing data and logic territory. Your projectile data should use flyweight that's read from a file, and which in fact uses bools (or bitmask if you wanna bee a haxxor) for its behavior quirks.
Then the function that decides whether something (blood etc.) spawns uses both projectiles and environment (higher-level abstractions), which works fine.
>>715910210>Now you never have nullptr issues but you have null wrapper issuesWhich are caught at compile time.
>>715910241 (Me)
I can't read.
>>715910084>>715910338Unfortunately, resource freeing DOES NOT take a fixed amount of time due to the surrounding logic and hardware considerations.
To see the issue, compare two scenarios:
>we change reference count>maybe it reaches 0>maybe we free the resourcevs
>we change reference count>it doesn't matterIn the first scenario, we need to implement a branch in the program logic to determine whether or not the destructor needs to be called. This can cause a very significant performance impact BEYOND just the cost of the destructor itself, since CPUs perform much better when executing branch-free code.
If we get to hand-pick when to free the resource, this branching cost can be avoided, or at least minimised by placing the free in a context where a performance hit is permissible. That additional cost isn't being included in the comparison you're suggesting, since neither scenarios that you suggest include a branch.
>>715910645You're not making a coherent point.
null values are bad sure, but you didn't specify a concrete alternative.
>data validity issue.is incredibly abstract and vague
Shared pointer users are not human.
>>715910763How in the actual world is the compiler going to know if some web request will succeed or not? The only thing the compiler may enforce (depending on the language) is that you’re handling the case where data is invalid. Which is no different from making sure you’re checking every pointer which depending on the situation may border on the pedantic
cool thread as a nonprpgrammer i found it interesting, any good recommendations for resource/course to learn? i assume there's as much shitty advice out there as there is good
>>715910779Yes you still add the check if needs to be freed check, you just don't free it if it passes
>>715910785I’m not suggesting an alternative. As long as programs have side effects data validity will be a potential issue. I’m saying using a functional language won’t save you from that, which seems to be something I keep hearing people say (wrongly)
>>715910394>You're inventing theoretical edge case scenariosAlmost like good programming patterns are for handling edge case scenarios and ever-changing requirements. Fucking poojeet lmao
>>715910428I guess you have no reading comprehension skills. The point of the discussion is that most games worth playing are coded like shit.
> widely regarded as one of the best games of all time Yeah and it's also one of the buggiest games of all time so make of that what you will.
>>715910527Doesn't matter, you still need a low to no code implementation for creating dynamic assets and levels.
>This game was made 25 years ago, but attaching fucking linked lists to projectiles is going to be slow even on a modern systemYou fucking retard. Do you really think iterating over a list of 2-3 behaviors when a projectile collides is going to do ANYTHING to performance?
You are actually retarded.
>>715910945Something more productive then.
What IS a modern C++ successor to you then?
>>715910959Storing a list in a projectile is going to be bad for performance
A bool flag is literally a low code solution, it's the lowest code solution there actually is
>>715906407goto fail;
goto fail;
>>715910959>You fucking retard. Do you really think iterating over a list of 2-3 behaviors when a projectile collides is going to do ANYTHING to performance?depends on the game, but then you're a no-coder so you wouldn't get it
>>715910959>Almost like good programming patterns are for handling edge case scenarios and ever-changing requirements.Programming patterns that overcomplicate and slow things down to accommodate for edge cases and changing requirements that YOU KNOW AREN'T GOING TO HAPPEN BECAUSE YOU ALREADY KNOW WHAT YOU'RE MAKING is poor programming practice. You wouldn't have lasted a fucking second back in the days where performance and efficient memory usage actually mattered, holy shit
>>715907286>16ms144Hz gamerchads did not like this
>>715911036C# if you don’t mind some performance hit compared to cpp. It’s still fast unless you’re doing very demanding work
>>715911041>Storing a list in a projectile is going to be bad for performanceTell that to literally every AA/AAA game made since 2003.
>A bool flag is literally a low code solution, it's the lowest code solution there actually is>SAAAAAARRRR
>>715911254every AA/AAA game made since 2003 does not store linked lists in a projectile lil bro
>>715910924That would only introduce a short jump, which CPUs perform much better than long jumps.
Also, if destructors are potentially called everywhere, then we either need to always keep the destructor code in CPU cache or to dynamically load it in every time to destruct, which is another performance hit in both cases.
And also, if we can destruct multiple similar objects in the same place, then their destructors will presumably access the same resources, so we yet again need to swap out the CPU cache less often.
>>715911071Worse than C# as a language but it has a much better ecosystem for enterprise. Most people don’t need that at all.
in reality, you'd actually want to use bitarrays because they'd also simplify your networking
>>715911145>overcomplicate>my poojeet brain cannot understand abstractions and I must write if/else statements for all my logicBe quiet YandereDev, you haven't been relevant in 10 years.
>>715911071Java is more of a successor to COBOL than anything at this point.
>>715911306No you can call to a remote function that just does nothing
You're trying really hard to make a point here but you don't have one
>>715911360"Overcomplicate" as in making your program do more work than it has to.
Making an entire system to handle something that could have just been a boolean is peak midwit shitter programming.
Your nodev is showing
>>715911450This does not address the second and third issue.
>>715911465>that could have just been a booleanIt shouldn't be a boolean, because that couples unrelated behavior to the projectile.
Booleans should rarely if ever be properties on an object.
But you wouldn't know that because you're a retarded poojeet.
>>715911465I’ve never seen one good opinion coming from anyone using internet meme words like that. And I’m pretty open minded to conflicting opinions if they can provide arguments for them. But I’ve never seen anyone speaking in memes be able to justify their ideas. People like you are like toddlers throwing a tantrum when they see something they don’t like
>>715911145>changing requirements that YOU KNOW AREN'T GOING TO HAPPEN BECAUSE YOU ALREADY KNOW WHAT YOU'RE MAKING is poor programming practice.You've never worked as a software developer
>>715911649Good programmers understand that that these hard and fast rules should situationally be deviated from when it's simple and efficient and fits the case. Shit programmers treat them as law and don't even consider why they're a thing or when you could break them while still having proper code.
>>715911601destructors do not access the same resources, they're freeing different pieces of memory
like I said, you're reaching to try and make a point that you haven't thought through
>>715911657So are you actually going to refute anything I said or
>>715911902The heap allocator is a resource. Destructors may also make 3rd party API calls in some cases, and who knows what they're accessing then.
>>715910916Read a book,
>>715867095 for C or C++ programming principles and practices, or if you want something casual (but still practical), python crash course.
>>715912013You don’t refute a tantrum.
>>715912094I accept your concession!
>>715911897so you think projectile reactions should reside as booleans within the projectile? Not even handled by the object it's reacting to? Or even encapsulated in some kind of reusable behavior that other objects can use? What kind of niggerbrained solution is that?
>>715912065The cost of freeing memory is fairly consistent and it doesn't really matter when you're freeing it in relation to other free calls
>>715912138In an extremely minimalistic case like this, that's fine, yeah. Slapping a fucking linked list onto every projectile when that functionality is totally pointless is poor practice.
>>715912183Unless you don't use the standard allocator.
>>715912383Yes, if you use a custom allocator it's even more consistent because you know exactly what's happening