It is interesting when the creator have the following quote: “C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.” ― Bjarne Stroustrup
I'm generally not a fan of cheating due to competitive integrity, but I'm huge into modding, so these tutorials are pretty appealing, especially as I'm also learning c++ rn
In this context the difference between modding and hacking mostly relies on wether you have a publicly exposed modding api which abstracts some of the game functions for you or you pattern scan in memory to hook certain game functions first before implementing any mods.
@@jenkathefridge3933 building cheats is fun, but cheating is the most mind numbing shit in the world. Like you're playing a video game, you might as well have fun. People who take games so seriously that they have to ruin others fun to have fun themselves should just get a life, because that is something they are completely devoid of.
It's misleading to say cpython translate python (the language) to C. Python is translated to bytecode that is executed on a virtual machine stack-machine. This machine was originally written in C, but is obviously already compiled to native binary code by the time it's running.
@@Scotty-vs4lf it's misleading saying that python is tranlated to c, when it's actually translated to machine code that originally was compiled from c (thus you technically never natively run c code, you compile it to binary first) Don't mind correcting me if i got something wrong
It is misleading to state that 'the machine is created in C' without elaborating on the technical nuances of CPython's implementation. The primary components implemented in C are those necessary to efficiently execute Python bytecode, not to wholly recreate the Python abstract machine in C. The Python abstract machine is defined by the bytecode instruction set and semantics, which are handled by the bytecode compilation phase preceding and separate from C-level execution. While the C virtual machine components are instrumental to CPython's performance, they do not subsume or reimplement the core abstract machine as defined by the bytecode and its execution model. By conflating C implementation of performance-critical execution logic with definition of the language's abstract machine, the statement obscures the distinction between translation of source to bytecode and bytecode execution via C. A more technically precise phrasing would clarify the separation of compilation and execution phases in CPython's translation pipeline. CPython's implementation of the Python language entails an intricate translation pipeline comprising multiple phases, rather than a simplistic translation to C code as the misleading statement suggests. Source code is first parsed into an abstract syntax tree (AST), representing code structure. The AST is then compiled into stack-based bytecode instructions, which serve as the principal intermediate representation retaining the dynamism and higher-order characteristics of Python, including first-class functions and dynamic type resolution, using a Python-specific instruction set. The bytecode is executed by a virtual machine implemented in C, but the primary role of its C components is efficient bytecode execution, not recoding Python semantics into C abstractions. By eliding the distinction between the parsing, AST, compilation, bytecode, and virtual machine execution phases, and implying a more straightforward translation to C than occurs, the statement obscures the engineering complexity of CPython's implementation and the conceptual distance between the bytecode intermediate representation and C code. The bytecode is central to preserving Python language semantics in the implementation, not an ancillary artifact of translating Python to C.
Python code (P) is compiled into bytecode (B) by the CPython implementation. The bytecode is executed by the Python virtual machine (V), which is implemented in C. The bytecode is then compiled into machine code (M) by a just-in-time compiler (JIT), which uses various optimization techniques (O) to generate highly efficient and platform-specific code: P → B → V → JIT(O) → M The optimization techniques used by the JIT include loop unrolling, instruction scheduling, register allocation, and constant folding, which are designed to eliminate redundant instructions, minimize memory access, and maximize instruction-level parallelism. The resulting machine code (M) is highly optimized, and can execute the Python program with maximum efficiency.
Yeah I kinda find C++ to be in a weird spot. If I wanted an OOP language, C# is almost always a better pick, but if I wanted something low level, C is a better pick. The only real benefit is the industry wide support in the gaming industry
Yeah I kinda find C++ to be in a weird spot. If I wanted an OOP language, C# is almost always a better pick, but if I wanted something low level, C is a better pick. The only real benefit is the industry wide support in the gaming industry
The windows api is just an abstraction over system calls, which can only be written in asssembly/machine code and are only available in C because it allows you to use functions defined in assembly
And much of the Windows API is antediluvian hacks that are no longer required and only serve to be backwards compatible with code written in like 1986. Try and use the same old code now and Visual Studio will bark at you. Literally got linker and multiple declaration errors because I included and a Winsock header. Silly me for not knowing that Windows.h magically now includes everything and you don't need the other stuff. That was especially annoying because I was following a Microsoft Learn tutorial from 2022 and you'd expect it to be slightly up to date, no?
You have stated zero to none benefits of using C++ over C for doing operations on memory, though. C++ conteptually is very different from C, since it is compiled for "abstract machine" and relies on heavy optimizations, often removing a lot of operations on raw memory that are deemed UB by the Standard. C on the other hand allows a larger variety of operations on raw memory. Also, when you inject or modify app's memory, you don't use "C or C++ code" (or even assembly), you use *binary machine code*. There's no difference whatsovere between an optimized compiled machine code of an application compiled from C/C++/Rust or even CPython. So, again, yoh have stated absolutelly no reasons "why one should prefer C++ for hacking".
I feel the same way about the video. I am a bit confused about the part where he states that you gain from using C++ when writing hacks if the OS is written in C and the game is written in C++. This makes no sense to me as in the end every application whether the used language is interpreted or compiled (ahead of time/just in time), it is translated into platform and os-specific machine code. When i want to write a hack it all comes down to understanding how the game works, how it's structured, how it accesses memory and stuff. Things like - buzzword bingo incoming - calling conventions, bitwise operations, memory allocation, polymorphism and stuff are interesting, but not the programming language you used to write your hack in. Use the programming language that suits you well and that's capable of making syscalls and that let's you manipulate memory. Almost any programming language i touched let you do that.
@@ar-l but C is more forgiving and less strict in terms of operations on raw data. Type punning via Unions is UB in C++ but is perfectly legal in C. In C++ you have to jump through hoops when working with raw bytes. Prior to `std::start_lifetime_as` you have to PRAY to some compiler god that your `std::copy` will be optimized to no copy of received byte array. I am myself a C++ engineer and would prefer it for developing over C because of its idioms and fetures (RAII, Pay for what you use, compile-time polymorhism and function overloading). But advising someone to learn a VERY COMPLICATED and TIME CONSUMING language just to use a very limited subset of functions is totally insane. C would be perfect for memory manipulations, also Winapi is pure C.
@@sergeykolesnik1171 What about using std::bit_cast (C++20) for type punning? Btw I agree that using C++ over C makes no sense in this case, in general you should learn very low level stuff for hacking/modifying app's memory.
@@j4viersitox7 idk why RUclips doesn't show my reply. std::bit_cast copies bits to a new value, thus you would have to copy those back if you want to modify the original memory. (Original reply contained a link to Stack Overflow answer)
@@SoggyBagelz no lol. sql is just a database, and the "code" you type in isn't code. its just a command you are issuing to the database to, say, query something for example. its not a language. Can you do loops in sql? if statements? oop? anything? no, you can't. oh and lets just not talk about the validity of the "most in-depth lenguage", sql doesn't even have basic programming concepts, guess why? its not a language.
I don’t think that Python code gets converted to C code as you said at 5:20. Sure, maybe the Python interpretar was written in C, but once it was compiled it became machine code that when executed interprets Python.
5:38 saying that Python is so slow because it’s interpreted, (and saying it applies to node.js) - is wrong. Python is so slow because: 1. expressions like "x+y" cause a search at runtime to determine which overload of + to invoke (ints addition? floats? strings? maybe cast one? maybe raise error?) These checks run on almost every command you write, and add up to a lot of overhead. 2. The lack of JIT optimizations. V8 (node.js) has spectacular runtime spells that solve many cases of problem 1. For example, in node.js if you call a function 500 times with objects of the same shape, the JIT will write a function that operates over struct memory offsets like in C- instead of a regular “hash map” object. Some of those JIT optimizations will (finally!) come in Python3.11 3. The infamous GIL which was a mistake decision made in the 90’s when they mis-predicted multicore CPUs. Now it’s too late to reimplement CPyhton differently.
0:35 I was watching from the RUclips home page (you can hover over a video and it will play in the thumbnail without opening it in a new tab). Probably the best strat for getting someone to click in that scenario is having a sponsor. I was just intrigued enough and my fiery hatred of ads so strong that I clicked.
This video should be titled "What is C++?" and not "You Should Learn C++ (for hacking games)", because you literally cover *nothing* about why you even should learn C++ for hacking games, you only talk about the difference between it and other languages without linking it back to the topic. This video also feels very uninformed about game modding in general. Many games use interpreted languages (Java, C#, Python, Lua, ...) and require *NO* understanding of compiled languages whatsoever to mod them; they are also much simpler to change. Not to mention, games built with compiled code require a knowledge of *assembly* to mod them, not C++. Knowing C++ will not help you interpret machine instructions. This video is in a format that makes it seem like you didn't put a lot of research into this, and are just spewing forth some random observations you found out recently.
i mean this was true for me when i was learning C, once i learned that i could get a hold of other easier languages pretty fast despite me only having a basic background of python
@@ThatOpinionIsWrong Nah man, I know both and C++ is way harder. Also, classes and first-class functions don’t really exist in C, which makes it not really compatable with modern programming paradies such as OO and FP.
hit the nail on the head with the freedom point, the ability to do anything to a stupid level is what makes me love cpp tbh. nice way to just fuck around and experiment, good outlet for creativity in that way imo
Yeah man. Sometimes I get bored of C++ and look for something to replace it with but it's difficult. Once you know your way around C++, thee isn't really anything to replace it 1:1 in this field.
I was thinking about explaining some reverse engineering stuff with WT but I'm not sure it's a good idea. Might put me on Gaijin's radar. None the less, good idea and thanks for the suggestion
@@devinpaulsen3658 Yes, you will learn many important and valuable things if you learn C++. You'll learn how computers work. If you use your operating system's user mode APIs, you'll also learn something about how operating systems work. You'll get much more out of your experience with C++ than you would with a toy language like Javascript.
I see a lot of people using C++, but C# seems to accomplish the same just as much. Hearing supporters of both C++ and C#, I start to believe that nothing really matters - both provide you with the necessary freedom you need, if you decide to go deeper, and the necessary tools to keep you safe by default.
You're completely right. For 90% of situations C++ and/or C# will work perfectly. In-fact, C# would be less complicated and take less time than C++. Ultimately though, it is my opinion that C++ comes out on top in those 10% of situations thanks to it being fully compiled, speedy and having all the memory access in the world.
@@cazz Can you give me some sort of an example where C++ accomplishes it better? I don't quite understand how it's more compiled or has more memory access.
I would really suggest using C as an alternative or at least trying both of them out before choosing one over another. I personally don't like C++'s syntax and it feels too restrictive for editing memory. As Bjarne Stroustrup said "C++ makes it harder to shoot yourself in the foot" - he could really be talking about type safety, etc. That's exactly what I don't need when unprotecting memory, overwriting values, hooking functions... On the other hand it indeed makes a lot of stuff easier to do - especially in this case, where speed is not critical / algorithms running in the background are no cause for concern. Altough you could just as well write some python script which would miraculously get injected into a running process and hook functions - those are likely only just a few challenges of what to overcome, but that's super high level and everything (except switch cases lol) is at your fingertips.
I'm actually of the opposite opinion. I've done some game hacking in my time and some game programming as well and there isn't anything you can do in C++ that you can't do better in C. C++ doesn't improve your ability to not shoot your foot off, in fact it becomes easier because of OOP and clusterfuck STL. I'd recommend avoiding it and sticking to C. In the end if you do go with C++ you are just going to be using a subset of C++ that makes it almost identical to writing straight C code. Professional, high end C++ looks almost exactly like C.
@Ayy Leeuz I don't know why you would come on here and lie but anyone can open windows.h and the other headers it includes and see for themselves. If there were any C++ in there C compilers would not be able to build against it. I am literally working on a project written in pure C and any mention of std:: or classes or templates would throw syntax errors. There is none of this bullshit in the Windows API. Just because the examples are written in C++ doesn't mean anything.
@Ayy Leeuz I think I must have taken some kind of bait responding to this, but just in case I'll try one more time. There is no C++ code in windows.h or any of the other WinAPI headers. Its C. The DLLs are not implemented in C++ either, its all C. There are no C++ objects in WinAPI. There is no v-table in WinAPI. No namespaces, templates or any other C++-isms in the WinAPI implementation. C++ can not be compiled by C compilers. You said "windows API is c++" and it is not. It is C. No emotion, you just stated something that is factually wrong and I corrected you.
The Linux kernel is written in C, but many of the overlay programs such as the GNU command line tools and especially the UI elements (using Qt framework) are written in C++.
@@dfsfsdfd Yeah for sure it is training wheels, but I don't get why anyone would want to move away from these set of training wheels. For example, I'm really into ML, and python is top-dog for anything ML related. Libraries are made in C++ and used in python so it's fast and easy to use.
@@vixguy Because many of us aren't ok with just using something someone else built? What if you wanted to write your own machine learning engine? Or anything that isn't just a wrapper someone else made around their work?
@@dfsfsdfd Python is easy to learn because its forgiving compared to c++ in terms of syntax errors, and you don’t have to worry a lot about type matching or memory management, but it isn’t simple to master.
@@marshallsweatherhiking1820 Syntax is syntax, you could argue it's more intuitive, however, neither language is forgiving in that aspect. One yells at you during compile, the other just crashes at runtime when you get to it. Memory management isn't hard, use new then delete. Typematching imo is easier, you know what the variable is and leads to less accidental data mismatches. To be fair it isn't simple to master any programming language, but python scripting is relatively easy in my experience relatively speaking.
Thank you for the resources, Cherno was like the best teacher for getting more advanced c++ aspects to stick. I was wondering if you have Java resources because I’m trying to learn mobile development. Thank you again ❤
Just going to say, this video barely goes over why one should learn C++ for hacking games, but instead goes over a neat little history of the C language.
I am trying to learn c++ with learncpp and its very hard i give up after 3 weeks and then I am trying again. Its my first programming language and I don't think I manage to learn anything. I was more a visual learner but can't find a good resource for cpp a lot of them are outdated and the others I need atleast some experience with programming. Should I start with another language like c# or java? or even python?.
I didn't realize I'm more experienced than you in C++ until you said that you have 3 years of experience in that programming language! To me that's crazy! I have 6 years of experience in C++, bro! Well, that's because I graduated Computer Science in high school and now I study Artificial Intelligence.
my thinking to choose what i was gonna use for coding was python is very easy to learn and its easier to learn coding after you already know how to code another language so i choose python for optimal speed
I am not denying what you are saying, as frankly i have 0 experiance in reverse engineering and game hacking, but i don't think you gave a actual reason to use c++, yes you said it's very compatible with c and that it can be used to modify the system, but why don't one just use C, or assembly? frankly with hacking, doing something that the programmers didn't intend for, i think you would want full freedom without any safeguards, i don't say there are no valid reasons to use c++ over the alternatives, but i don't see them being presented well
I do want to learn c++ so I can get into hacking mortal kombat deception but from what I have been told it's definitely a learning curve and I don't know where to start learning c++
When you said that the entire Windows operating system was written in C, that was a lie; the bootloader still had to be written in machine language, as did the portion of the kernel allowing for a C runtime environment.
"C++ was coded in C" Yeah, that was true when first C++ compilers were released, but today even GCC (including C compiler) is mainly written in C++. Some C enthusiasts are mad of that fact;)
You can actually use C++ within C projects (and this boils the blood of many other programmers). Just compile the C files with a C compiler and the C++ files with a C++ compiler (into object files) and then you can link them together with a C++ compiler.
@@v01d_r34l1ty not only C++ then, many compiled-to-native programming languages implement FFI that allows to communicate with binary files compiled from other langs
@@vicshcher Yup! Rust is a prime example! A Rust file, C file, Zig file, and C++ file can all be compiled into the same binary! Edit: I didn’t want to mention FFIs just because I’m not all too familiar with them as I mainly use C++ and C. I know my place and I try to stick to it lol
@@v01d_r34l1ty same. I'm pretty comfortable with paradigm that C++ provides. Tried Rust once, I kinda understand fact that memory safety requires some effort, both from language designer and end user, but those imposed restrictions are too strict for me. Anyway, that would be useful to learn some new programming and design techniques, including Rust's ones
@@vicshcher Rust is dirty until you get into building with it, kinda like with JavaScript. I found I had to use a different learning approach than with C++. Overall, it has more restrictions but more or less comparable compatibility and interoperability and capability as C++ with some of the bargaining chips of C.
What are your thoughts on using rust instead of c++ for hacking games. While you lose the advantage of writing in the same language as the game and operating system, do you think the additional memory safety is worth it?
The problem is that, writing cheats is an inherently memory-unsafe activity. Most cheating is memory exploiting. The result of this is… 70% of your rust code base is going to be in between “unsafe” tags, so what’s the point. C++ will let you shoot yourself in the foot and that’s extremely powerful in the right hands, that edge of danger is what makes C++ so powerful. There are certainly use cases for rust though, it really depends on your goals.
@@cazzRust isn’t only about memory safety, it provides much more (it’s just that’s what many people advertise about it). The syntax, dependency manager and build system, the traits, macros, etc.
@@FaZekiller-qe3uf well I'd argue with that if we're talking hacking or reverse engineering in general. C++'s RE ecosystem is richer and since most games are written using OOP anyways, the class/struct mapping will be very convenient
In the end, you're changing game machine code in memory. Expertise in Assembly language is a must if you want to prove what you're changing is correct...of course, unless you are using 'tools'.
I used to like CPP with basic stuff, then classes and pointers came and I hated it. I wasn’t bad but too much stuff especially pointers that I kind of gave up. I’d rather do Python any day than CPP.
“There is no best language” is WRONG. Machine code is by far the best programming language, most efficient in time and space, and doesn’t even need a translator. The writing of it is completely logical, and you have direct access to memory
I only really have experience in C# and I’ve spent most of my coding time with Unity. Given unreal is largely C++, I’m really curious how it compares to C#.
Bro, I have a question for you. Look, I did implement the minimax algorithm in Python and create an AI Tic Tac Toe player that is invincible. However, in C++ it's a daunting task for me. Can you help me implement the minimax algorithm in C++?
So this six minutes long video explains what are some few uses of any half decent system programming language, which includes manipulating memory manually. AFAICT this can be done in Rust, C, C++, Go and probably many others. There's a lot of tutorials written in some dialect of C++ so it is a good reason to have some knowledge of it. Personally, I would stick to C for game hacking as manual memory management is where it excels, and you would end up written C in C++ anyways (well try writting game hacks with only "modern C++").
I don't know why anyone would need OO or templates to write a hack. That stuff is for developing projects that get large and complicated. Almost any c++ compiler will compile straight c as well, but the low level memory manipulation libraries you'd probably want to use are not actually part of the c++ standard, even if compliant equivalents can be included.
I am not a fan of the rhetoric that c is a systems language, and therefore can’t have any memory access rules. Is Rust not proof that a systems language can add a bunch of protections without compromising speed most of the time?
The way I interpreted "systems language" was that it meant giving the most degree of power of the underlying hardware, which is directly not what Rust is. (for better or worse)
Technically, any non compiled language is a program compiled by a compiled language that interprets commands in a more abstract manner. Such languages are: Python, Java, C#, Javascript and many more.
I was wondering if u could make an aim bot by making the game realize enemy as a certain entity and making it to aim on it for gta V role play servers. Can you please help me to code an aimbot for RAGE MP GTA V RP servers
I think the language itself is fine, however the stuff and frameworks and overloading etc people build with the language is very complex and sometimes unneccessarily so.
2:26 explanation for those who didnt got it: basically theres a thing called "bootstrapping", which is, in short terms, basically code that reads code let's take javascript, people already managed to make a javascript interpreter, written in javascript, so we can call it a "bootstrapped javascript interpreter", its running on 2 layers, the first interpreter (let's say nodejs), and then the second one (the one people made it). the main problem with this method is that it needs to be HEAVILY optimized, or else it wont work properly and it may slow down a LOT the performance, so it's usually more doable with statically typed languages. great video btw :)
I have tried to write my own toy programming language after learning compiler design and automaton theory. At the end i said fuck interpreting languages.
I love how well put this video is, and in the end when you linked down @thenewboston and @TheCherno is where you earned my respect because these two are abosolute legends in terms of teaching people new language and how it works!
It is interesting when the creator have the following quote:
“C makes it easy to shoot yourself in the foot;
C++ makes it harder, but when you do it blows your whole leg off.”
― Bjarne Stroustrup
From my experience, it's all templates that actually aim you at the foot
@@maddsua Templates are a big part of it, but it's the worst when mixed with half assed OOP.
@@maddsua I haven’t written any C++ in a bit (thanks unity) but when I did I couldn’t wrap my head around templates at all.
@@kserrata I already don’t like C#, I ain’t touching no generics.
So c is a pistol and c++ a shotgun?
As a kid I had the same curiosity of how injectors accessed memory when I couldn't with my code, but then it made sense
As a kid I thought sausages were cow udders...
@@b3at1 as i kid i thought they were weaners of dead men
As a kid i played spider man games and need for speed
@@QmVuamFtaW4 did you eat them? 😟
I'm still wondering how a speedhack works. Speeding up and slowing down an application.
I'm generally not a fan of cheating due to competitive integrity, but I'm huge into modding, so these tutorials are pretty appealing, especially as I'm also learning c++ rn
In this context the difference between modding and hacking mostly relies on wether you have a publicly exposed modding api which abstracts some of the game functions for you or you pattern scan in memory to hook certain game functions first before implementing any mods.
hacking in this context can mean modding, its not necessarily referring to cheating
Creating cheats isn’t a form of cheating, some of us just enjoy toying with these things. It’s the same as creating malware
@@JimCarrey2005 It's fine to create those things as long as it doesn't harm anyone in my opinion.
@@jenkathefridge3933 building cheats is fun, but cheating is the most mind numbing shit in the world. Like you're playing a video game, you might as well have fun. People who take games so seriously that they have to ruin others fun to have fun themselves should just get a life, because that is something they are completely devoid of.
It's misleading to say cpython translate python (the language) to C. Python is translated to bytecode that is executed on a virtual machine stack-machine. This machine was originally written in C, but is obviously already compiled to native binary code by the time it's running.
It’s misleading to say that CPython was _originally_ written in C.
@@fr5229 yeah it is
@@Scotty-vs4lf it's misleading saying that python is tranlated to c, when it's actually translated to machine code that originally was compiled from c (thus you technically never natively run c code, you compile it to binary first)
Don't mind correcting me if i got something wrong
It is misleading to state that 'the machine is created in C' without elaborating on the technical nuances of CPython's implementation. The primary components implemented in C are those necessary to efficiently execute Python bytecode, not to wholly recreate the Python abstract machine in C. The Python abstract machine is defined by the bytecode instruction set and semantics, which are handled by the bytecode compilation phase preceding and separate from C-level execution. While the C virtual machine components are instrumental to CPython's performance, they do not subsume or reimplement the core abstract machine as defined by the bytecode and its execution model. By conflating C implementation of performance-critical execution logic with definition of the language's abstract machine, the statement obscures the distinction between translation of source to bytecode and bytecode execution via C. A more technically precise phrasing would clarify the separation of compilation and execution phases in CPython's translation pipeline.
CPython's implementation of the Python language entails an intricate translation pipeline comprising multiple phases, rather than a simplistic translation to C code as the misleading statement suggests. Source code is first parsed into an abstract syntax tree (AST), representing code structure. The AST is then compiled into stack-based bytecode instructions, which serve as the principal intermediate representation retaining the dynamism and higher-order characteristics of Python, including first-class functions and dynamic type resolution, using a Python-specific instruction set. The bytecode is executed by a virtual machine implemented in C, but the primary role of its C components is efficient bytecode execution, not recoding Python semantics into C abstractions. By eliding the distinction between the parsing, AST, compilation, bytecode, and virtual machine execution phases, and implying a more straightforward translation to C than occurs, the statement obscures the engineering complexity of CPython's implementation and the conceptual distance between the bytecode intermediate representation and C code. The bytecode is central to preserving Python language semantics in the implementation, not an ancillary artifact of translating Python to C.
Python code (P) is compiled into bytecode (B) by the CPython implementation. The bytecode is executed by the Python virtual machine (V), which is implemented in C. The bytecode is then compiled into machine code (M) by a just-in-time compiler (JIT), which uses various optimization techniques (O) to generate highly efficient and platform-specific code:
P → B → V → JIT(O) → M
The optimization techniques used by the JIT include loop unrolling, instruction scheduling, register allocation, and constant folding, which are designed to eliminate redundant instructions, minimize memory access, and maximize instruction-level parallelism. The resulting machine code (M) is highly optimized, and can execute the Python program with maximum efficiency.
id rather put my leg in a meat grinder then touch C++ again
thats fine, not touching c++ i mean
Or putting your leg in a meat grinder, that's fine in my book.
Yeah I kinda find C++ to be in a weird spot. If I wanted an OOP language, C# is almost always a better pick, but if I wanted something low level, C is a better pick. The only real benefit is the industry wide support in the gaming industry
Yeah I kinda find C++ to be in a weird spot. If I wanted an OOP language, C# is almost always a better pick, but if I wanted something low level, C is a better pick. The only real benefit is the industry wide support in the gaming industry
@@kneesnap1041 you can write a very C flavored C++ and still get the benefits of the standard library
The windows api is just an abstraction over system calls, which can only be written in asssembly/machine code and are only available in C because it allows you to use functions defined in assembly
@xrag yes , those are system calls
fellow wizard!
???? You can call functions you defined in assembly from C++ as well, what you said makes 0 sense
@@fexty8776 Yeah, i shouldn’t say „only”
And much of the Windows API is antediluvian hacks that are no longer required and only serve to be backwards compatible with code written in like 1986. Try and use the same old code now and Visual Studio will bark at you.
Literally got linker and multiple declaration errors because I included and a Winsock header. Silly me for not knowing that Windows.h magically now includes everything and you don't need the other stuff. That was especially annoying because I was following a Microsoft Learn tutorial from 2022 and you'd expect it to be slightly up to date, no?
You have stated zero to none benefits of using C++ over C for doing operations on memory, though. C++ conteptually is very different from C, since it is compiled for "abstract machine" and relies on heavy optimizations, often removing a lot of operations on raw memory that are deemed UB by the Standard. C on the other hand allows a larger variety of operations on raw memory.
Also, when you inject or modify app's memory, you don't use "C or C++ code" (or even assembly), you use *binary machine code*. There's no difference whatsovere between an optimized compiled machine code of an application compiled from C/C++/Rust or even CPython.
So, again, yoh have stated absolutelly no reasons "why one should prefer C++ for hacking".
I feel the same way about the video. I am a bit confused about the part where he states that you gain from using C++ when writing hacks if the OS is written in C and the game is written in C++. This makes no sense to me as in the end every application whether the used language is interpreted or compiled (ahead of time/just in time), it is translated into platform and os-specific machine code. When i want to write a hack it all comes down to understanding how the game works, how it's structured, how it accesses memory and stuff. Things like - buzzword bingo incoming - calling conventions, bitwise operations, memory allocation, polymorphism and stuff are interesting, but not the programming language you used to write your hack in. Use the programming language that suits you well and that's capable of making syscalls and that let's you manipulate memory. Almost any programming language i touched let you do that.
C is compiled for an abstract machine as well, actually
@@ar-l but C is more forgiving and less strict in terms of operations on raw data. Type punning via Unions is UB in C++ but is perfectly legal in C. In C++ you have to jump through hoops when working with raw bytes. Prior to `std::start_lifetime_as` you have to PRAY to some compiler god that your `std::copy` will be optimized to no copy of received byte array.
I am myself a C++ engineer and would prefer it for developing over C because of its idioms and fetures (RAII, Pay for what you use, compile-time polymorhism and function overloading). But advising someone to learn a VERY COMPLICATED and TIME CONSUMING language just to use a very limited subset of functions is totally insane. C would be perfect for memory manipulations, also Winapi is pure C.
@@sergeykolesnik1171 What about using std::bit_cast (C++20) for type punning? Btw I agree that using C++ over C makes no sense in this case, in general you should learn very low level stuff for hacking/modifying app's memory.
@@j4viersitox7 idk why RUclips doesn't show my reply. std::bit_cast copies bits to a new value, thus you would have to copy those back if you want to modify the original memory. (Original reply contained a link to Stack Overflow answer)
Watching this video was like spending 6 minutes in the mind of someone that first heard of C, C++, and programming in general 6 minutes ago
thank you for validating that im not insane and that this is indeed a bad video
C++ is also as hates as java in these comments. There is a clear correlation between how verbose a language is an ho many people hate It.
Why do you say that?
Exactly, thank you so much! I love C++ but this video was bad.
I am leaning c/c++ for about a 2 years at this point and i found other languages so easy such as python and sql.
sql isn't a fucking language
@@Proferk what ever that is database language or some shii
@Ayy Leeuz This, once you know the logic the rest is just syntax and specific functions/features of that language.
@@Proferk yes it is It is the most in-depth language in use today.
@@SoggyBagelz no lol. sql is just a database, and the "code" you type in isn't code. its just a command you are issuing to the database to, say, query something for example. its not a language. Can you do loops in sql? if statements? oop? anything? no, you can't. oh and lets just not talk about the validity of the "most in-depth lenguage", sql doesn't even have basic programming concepts, guess why? its not a language.
I don’t think that Python code gets converted to C code as you said at 5:20. Sure, maybe the Python interpretar was written in C, but once it was compiled it became machine code that when executed interprets Python.
Nowadays I think it's interpretted to Python bytecode
@@sagarroy1125 no, it's compiled to bytecode, the bytecode is what's interpreted
Dude I just binge watched like 10 of your videos cause I find them so entertaining even if I dont know C++ and you post this. LFG
5:38 saying that Python is so slow because it’s interpreted, (and saying it applies to node.js) - is wrong.
Python is so slow because:
1. expressions like "x+y" cause a search at runtime to determine which overload of + to invoke (ints addition? floats? strings? maybe cast one? maybe raise error?)
These checks run on almost every command you write, and add up to a lot of overhead.
2. The lack of JIT optimizations.
V8 (node.js) has spectacular runtime spells that solve many cases of problem 1.
For example, in node.js if you call a function 500 times with objects of the same shape, the JIT will write a function that operates over struct memory offsets like in C- instead of a regular “hash map” object.
Some of those JIT optimizations will (finally!) come in Python3.11
3. The infamous GIL which was a mistake decision made in the 90’s when they mis-predicted multicore CPUs. Now it’s too late to reimplement CPyhton differently.
arent we already in python 3.11 now?
Congrats on your first sponsorship cazz :)
Thank you!! 😁
Even after years, I still write and read code in C/C++ and Assembly Language
What about languages like C# or Rust, that you can compile too? Do they compile to C code first or how do they work with the OS?
Oh trust me, I know. I’ve had to deal with annoying bots on TF2 Casual for the past 3 years
Really love your video style, find these pretty enjoyable to watch.
Thank you very much!
Ad ends at 1:48 btw
It will be cool a video introducing the basic concepts of a driver, and how to code your first driver
0:35 I was watching from the RUclips home page (you can hover over a video and it will play in the thumbnail without opening it in a new tab). Probably the best strat for getting someone to click in that scenario is having a sponsor. I was just intrigued enough and my fiery hatred of ads so strong that I clicked.
when you finish learning c++ and found out that you need to learn assembly language to hack games 😂
Creel on RUclips teaches assembly and C++.
@@jay22alco only basics of asm to understand and reverse game functions
This video should be titled "What is C++?" and not "You Should Learn C++ (for hacking games)", because you literally cover *nothing* about why you even should learn C++ for hacking games, you only talk about the difference between it and other languages without linking it back to the topic.
This video also feels very uninformed about game modding in general. Many games use interpreted languages (Java, C#, Python, Lua, ...) and require *NO* understanding of compiled languages whatsoever to mod them; they are also much simpler to change. Not to mention, games built with compiled code require a knowledge of *assembly* to mod them, not C++. Knowing C++ will not help you interpret machine instructions. This video is in a format that makes it seem like you didn't put a lot of research into this, and are just spewing forth some random observations you found out recently.
yap
Once you learn C++ all other programming languages will seem really easy to learn and use
Not python.
@@jdsaravaiya6468 going to python from c++ its so weird, it contradicts everything you know
Replace "C++" with "C" and that's correct
i mean this was true for me when i was learning C, once i learned that i could get a hold of other easier languages pretty fast despite me only having a basic background of python
@@ThatOpinionIsWrong Nah man, I know both and C++ is way harder. Also, classes and first-class functions don’t really exist in C, which makes it not really compatable with modern programming paradies such as OO and FP.
hit the nail on the head with the freedom point, the ability to do anything to a stupid level is what makes me love cpp tbh. nice way to just fuck around and experiment, good outlet for creativity in that way imo
Yeah man. Sometimes I get bored of C++ and look for something to replace it with but it's difficult. Once you know your way around C++, thee isn't really anything to replace it 1:1 in this field.
@@cazz you could just use rust ;)
@@RinLovesYou or you could become a Jehovah's witness instead. jokes aside, personally I prefer cpp for stuff I do
You should do a proper walkthrough of your WT crashed code, it is interesting, and is something new to the channel.
I was thinking about explaining some reverse engineering stuff with WT but I'm not sure it's a good idea. Might put me on Gaijin's radar. None the less, good idea and thanks for the suggestion
@@cazz Or you can make paid course on your website if v
for creating esp items for dayz or scum steam game, you need to learn c++ ?
Am I the only person who wants to learn C++ just because it's complex and interesting to look at?
that's why I'm learning it. started in JavaScript for Web dev but c++ is much more valuable.
@@devinpaulsen3658 Yes, you will learn many important and valuable things if you learn C++. You'll learn how computers work. If you use your operating system's user mode APIs, you'll also learn something about how operating systems work. You'll get much more out of your experience with C++ than you would with a toy language like Javascript.
If i want to unlock itmes in game(codm) by programming which language should i learn... ??
I see a lot of people using C++, but C# seems to accomplish the same just as much. Hearing supporters of both C++ and C#, I start to believe that nothing really matters - both provide you with the necessary freedom you need, if you decide to go deeper, and the necessary tools to keep you safe by default.
You're completely right. For 90% of situations C++ and/or C# will work perfectly. In-fact, C# would be less complicated and take less time than C++.
Ultimately though, it is my opinion that C++ comes out on top in those 10% of situations thanks to it being fully compiled, speedy and having all the memory access in the world.
@@cazz Can you give me some sort of an example where C++ accomplishes it better? I don't quite understand how it's more compiled or has more memory access.
I would really suggest using C as an alternative or at least trying both of them out before choosing one over another. I personally don't like C++'s syntax and it feels too restrictive for editing memory. As Bjarne Stroustrup said "C++ makes it harder to shoot yourself in the foot" - he could really be talking about type safety, etc. That's exactly what I don't need when unprotecting memory, overwriting values, hooking functions... On the other hand it indeed makes a lot of stuff easier to do - especially in this case, where speed is not critical / algorithms running in the background are no cause for concern. Altough you could just as well write some python script which would miraculously get injected into a running process and hook functions - those are likely only just a few challenges of what to overcome, but that's super high level and everything (except switch cases lol) is at your fingertips.
Hello. Nice video but I have one question. whats the name of the game in this video 3:35 ?
GTA 5 graphics modded
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off." - Bjarne Stroustrup
Damn, you’re at 22k subscribers already. Back when I watched you were under 1k. Time flies.
0:07 s what's the program name???
@@LeonardoCarlassare ida
I'm actually of the opposite opinion. I've done some game hacking in my time and some game programming as well and there isn't anything you can do in C++ that you can't do better in C. C++ doesn't improve your ability to not shoot your foot off, in fact it becomes easier because of OOP and clusterfuck STL. I'd recommend avoiding it and sticking to C. In the end if you do go with C++ you are just going to be using a subset of C++ that makes it almost identical to writing straight C code. Professional, high end C++ looks almost exactly like C.
@Ayy Leeuz This just isn't true. It's all C and maybe some ASM.
@Ayy Leeuz I don't know why you would come on here and lie but anyone can open windows.h and the other headers it includes and see for themselves. If there were any C++ in there C compilers would not be able to build against it. I am literally working on a project written in pure C and any mention of std:: or classes or templates would throw syntax errors. There is none of this bullshit in the Windows API. Just because the examples are written in C++ doesn't mean anything.
@Ayy Leeuz I think I must have taken some kind of bait responding to this, but just in case I'll try one more time. There is no C++ code in windows.h or any of the other WinAPI headers. Its C. The DLLs are not implemented in C++ either, its all C. There are no C++ objects in WinAPI. There is no v-table in WinAPI. No namespaces, templates or any other C++-isms in the WinAPI implementation. C++ can not be compiled by C compilers. You said "windows API is c++" and it is not. It is C. No emotion, you just stated something that is factually wrong and I corrected you.
@Ayy Leeuz I think you're confused here. Just because you can reference something in your C++ project doesn't mean it was written in C++.
@Ayy Leeuz I think you're trolling at this point. Either post proof or we're done talking.
Well, while Linux was written almost entirely using C, windows actually uses C++
(i know, same difference, but I thought I should mention it)
The Linux kernel is written in C, but many of the overlay programs such as the GNU command line tools and especially the UI elements (using Qt framework) are written in C++.
I’m a big fan of python. It makes things so much easier in so many ways
It's the fisher price of programming. Riding with training wheels is easy too.
@@dfsfsdfd Yeah for sure it is training wheels, but I don't get why anyone would want to move away from these set of training wheels.
For example, I'm really into ML, and python is top-dog for anything ML related. Libraries are made in C++ and used in python so it's fast and easy to use.
@@vixguy Because many of us aren't ok with just using something someone else built? What if you wanted to write your own machine learning engine? Or anything that isn't just a wrapper someone else made around their work?
@@dfsfsdfd Python is easy to learn because its forgiving compared to c++ in terms of syntax errors, and you don’t have to worry a lot about type matching or memory management, but it isn’t simple to master.
@@marshallsweatherhiking1820 Syntax is syntax, you could argue it's more intuitive, however, neither language is forgiving in that aspect. One yells at you during compile, the other just crashes at runtime when you get to it. Memory management isn't hard, use new then delete. Typematching imo is easier, you know what the variable is and leads to less accidental data mismatches. To be fair it isn't simple to master any programming language, but python scripting is relatively easy in my experience relatively speaking.
Thank you for the resources, Cherno was like the best teacher for getting more advanced c++ aspects to stick. I was wondering if you have Java resources because I’m trying to learn mobile development. Thank you again ❤
Just going to say, this video barely goes over why one should learn C++ for hacking games, but instead goes over a neat little history of the C language.
what is the game at 3:45
I am trying to learn c++ with learncpp and its very hard i give up after 3 weeks and then I am trying again. Its my first programming language and I don't think I manage to learn anything. I was more a visual learner but can't find a good resource for cpp a lot of them are outdated and the others I need atleast some experience with programming. Should I start with another language like c# or java? or even python?.
I didn't realize I'm more experienced than you in C++ until you said that you have 3 years of experience in that programming language! To me that's crazy! I have 6 years of experience in C++, bro! Well, that's because I graduated Computer Science in high school and now I study Artificial Intelligence.
your thoughts on Rust programming language?
python is not translated into C code, it's compiled to bytecode by cython which is then interpreted by the cython vmachine
brilliant sponsoring a video about hacking 😭🙏
you can say c++ is quite complex as compared to very abstract languages like python but definitely it's not massively complex
my thinking to choose what i was gonna use for coding was python is very easy to learn and its easier to learn coding after you already know how to code another language so i choose python for optimal speed
If I had a dollar for every time he said “C” in this video, I would make Jeff Bezos look homeless
All that you said in the video, the free pascal language also does it, right? (I'm using the translator)
I am not denying what you are saying, as frankly i have 0 experiance in reverse engineering and game hacking, but i don't think you gave a actual reason to use c++, yes you said it's very compatible with c and that it can be used to modify the system, but why don't one just use C, or assembly? frankly with hacking, doing something that the programmers didn't intend for, i think you would want full freedom without any safeguards, i don't say there are no valid reasons to use c++ over the alternatives, but i don't see them being presented well
Im glad i seen this,seeing as how C++ was the first language decided to learn
Me who learn C/C++ at school: Jokes on me, I want to learn this sh*t
I do want to learn c++ so I can get into hacking mortal kombat deception but from what I have been told it's definitely a learning curve and I don't know where to start learning c++
When you said that the entire Windows operating system was written in C, that was a lie; the bootloader still had to be written in machine language, as did the portion of the kernel allowing for a C runtime environment.
You got me! Sorry boss.
"C++ was coded in C"
Yeah, that was true when first C++ compilers were released, but today even GCC (including C compiler) is mainly written in C++. Some C enthusiasts are mad of that fact;)
You can actually use C++ within C projects (and this boils the blood of many other programmers). Just compile the C files with a C compiler and the C++ files with a C++ compiler (into object files) and then you can link them together with a C++ compiler.
@@v01d_r34l1ty not only C++ then, many compiled-to-native programming languages implement FFI that allows to communicate with binary files compiled from other langs
@@vicshcher Yup! Rust is a prime example! A Rust file, C file, Zig file, and C++ file can all be compiled into the same binary!
Edit: I didn’t want to mention FFIs just because I’m not all too familiar with them as I mainly use C++ and C. I know my place and I try to stick to it lol
@@v01d_r34l1ty same. I'm pretty comfortable with paradigm that C++ provides. Tried Rust once, I kinda understand fact that memory safety requires some effort, both from language designer and end user, but those imposed restrictions are too strict for me. Anyway, that would be useful to learn some new programming and design techniques, including Rust's ones
@@vicshcher Rust is dirty until you get into building with it, kinda like with JavaScript. I found I had to use a different learning approach than with C++. Overall, it has more restrictions but more or less comparable compatibility and interoperability and capability as C++ with some of the bargaining chips of C.
Memory editing can be done with pretty much any language, dont get discouraged if you dont know C++ or simply dont like it
a full sixth of this video is an ad read...
that's what I said to myself lol
First-time viewer. Vid felt too short!! Looking forward for more in-depth Games Hacking stuff ⚡
Noted!
@@cazz Omg seen your .dll vid. Eye-opening and awe-inspiring. Thank you sir!
Cool, but something more concrete would be nice, like 2 examples one in C++ and the other in another language showing why it's easier
What are your thoughts on using rust instead of c++ for hacking games. While you lose the advantage of writing in the same language as the game and operating system, do you think the additional memory safety is worth it?
The problem is that, writing cheats is an inherently memory-unsafe activity. Most cheating is memory exploiting. The result of this is… 70% of your rust code base is going to be in between “unsafe” tags, so what’s the point.
C++ will let you shoot yourself in the foot and that’s extremely powerful in the right hands, that edge of danger is what makes C++ so powerful.
There are certainly use cases for rust though, it really depends on your goals.
cazz is correct. Rust will get in your way literally on every step. C++ is the only sane option imo
@@cazzRust isn’t only about memory safety, it provides much more (it’s just that’s what many people advertise about it). The syntax, dependency manager and build system, the traits, macros, etc.
@@StealerSlainC is more sane using your logic, c++ gets more in the the way than C.
@@FaZekiller-qe3uf well I'd argue with that if we're talking hacking or reverse engineering in general. C++'s RE ecosystem is richer and since most games are written using OOP anyways, the class/struct mapping will be very convenient
3:35
What is this game
I wanna play it
GTA V with graphics mods 👌
In the end, you're changing game machine code in memory. Expertise in Assembly language is a must if you want to prove what you're changing is correct...of course, unless you are using 'tools'.
bro has guidelines, this ain't a discord channel dawg 💀
RUclips auto generated them for whatever reason 💀 I’ll make them more fun
@@cazz just kidding bro, you do you :)
I used to like CPP with basic stuff, then classes and pointers came and I hated it. I wasn’t bad but too much stuff especially pointers that I kind of gave up. I’d rather do Python any day than CPP.
“There is no best language” is WRONG. Machine code is by far the best programming language, most efficient in time and space, and doesn’t even need a translator. The writing of it is completely logical, and you have direct access to memory
I only really have experience in C# and I’ve spent most of my coding time with Unity. Given unreal is largely C++, I’m really curious how it compares to C#.
Assembly programmers: Hold my bear
Thx bro that answer my question when I was young.
You said that there isn't any best language for all things, but I have a proposition for you. 🦀✨Rust✨ 🦀
based
🚀🚀 blazingly fast
Came here to say exactly this.
Exactly what I wanted to say!
Rust is not best language it’s a hipster trash
Bro, I have a question for you. Look, I did implement the minimax algorithm in Python and create an AI Tic Tac Toe player that is invincible. However, in C++ it's a daunting task for me. Can you help me implement the minimax algorithm in C++?
So this six minutes long video explains what are some few uses of any half decent system programming language, which includes manipulating memory manually. AFAICT this can be done in Rust, C, C++, Go and probably many others. There's a lot of tutorials written in some dialect of C++ so it is a good reason to have some knowledge of it. Personally, I would stick to C for game hacking as manual memory management is where it excels, and you would end up written C in C++ anyways (well try writting game hacks with only "modern C++").
I don't know why anyone would need OO or templates to write a hack. That stuff is for developing projects that get large and complicated. Almost any c++ compiler will compile straight c as well, but the low level memory manipulation libraries you'd probably want to use are not actually part of the c++ standard, even if compliant equivalents can be included.
no thanks I hate c++. I would rather upload my consciousness into the god damn computer
I am not a fan of the rhetoric that c is a systems language, and therefore can’t have any memory access rules. Is Rust not proof that a systems language can add a bunch of protections without compromising speed most of the time?
The way I interpreted "systems language" was that it meant giving the most degree of power of the underlying hardware, which is directly not what Rust is. (for better or worse)
Is Python also good for game hacking?
and where do I learn
I think you meant "Blowing" your foot up there 3:09
Can you make introduction into mobile game hacking? Like how to implement same concept of injection or modified into mobile.
0:00 ah yes jQuery, the ultimate game hacking tool
Technically, any non compiled language is a program compiled by a compiled language that interprets commands in a more abstract manner.
Such languages are: Python, Java, C#, Javascript and many more.
I appreciate your videos and your work. Not sure why I got kicked from your discord by Maxim , but I'll keep enjoying your content.
Maxim isn't a mod or anything so he doesn't have the power to do that. Let me know your discord name so that I can look into it if you like.
I was wondering if u could make an aim bot by making the game realize enemy as a certain entity and making it to aim on it for gta V role play servers. Can you please help me to code an aimbot for RAGE MP GTA V RP servers
You really need a pop-filter for your mic, my man.
Yes :(
I think the language itself is fine, however the stuff and frameworks and overloading etc people build with the language is very complex and sometimes unneccessarily so.
You should try rust!
"in the world of game hacking, programming is simply a means to an end" **shows jquery** lol
Nobody can tell me that Rust is better than
C++
Rust is better than C++
Rust is better than C++
Rust is way better than C++
7 people did in mere hours so..
fr
If you've to pick one language, which one you would pick for anything??
For anything? Probably C#
2:26 explanation for those who didnt got it:
basically theres a thing called "bootstrapping", which is, in short terms, basically code that reads code
let's take javascript, people already managed to make a javascript interpreter, written in javascript, so we can call it a "bootstrapped javascript interpreter", its running on 2 layers, the first interpreter (let's say nodejs), and then the second one (the one people made it).
the main problem with this method is that it needs to be HEAVILY optimized, or else it wont work properly and it may slow down a LOT the performance, so it's usually more doable with statically typed languages.
great video btw :)
I have tried to write my own toy programming language after learning compiler design and automaton theory. At the end i said fuck interpreting languages.
a Cazz video is just like birthday but like a good one
Wise words that I once heard:
Low level languages provide functions such as free and allocate to shoot yourself in the foot
Nice name cazz!
"in the world of game hacking.."
**shows some jquery**
"There is one programming language that stands above the others..."
Oh no no no, I already hear unsatisfied Rusters trying to prove C++ is bad 😁
If you're afraid of pointers you're not a programmer, just throwing that out there. Manage your memory, not that hard.
could you do a video about saving multiple configs in a imgui menu
now I can understand behind JS technology
Me reading the title: I mean, I completed watch_dogs without knowing C++
I love how well put this video is, and in the end when you linked down @thenewboston and @TheCherno is where you earned my respect because these two are abosolute legends in terms of teaching people new language and how it works!
Great content. Tried out Brilliant thanks to you. Best purchase of the year by far :)