How can I...?

Pages: 12
How can I use c++ for things other than file work? I bought a book on the language, read it, and found nothing in it for work with networks (IE. Internet), graphics, CD or DVD reading or writing, using the mouse and keyboard or other input devices, making the computer type itself or use the mouse or input device itself, etc.

I've scoured the internet looking for a solution but I just can't find anything on the subject. I know video games, and other programs not involving the standard stuff I found in the book exist. These have been made but I don't know how to do this with C++. I've been thinking I'm going to be forced to find a new language(S).

Please help!
Last edited on
You've become bored with learning the basic C++ language and its Standard Library with its emphasis on stream IO. Try a tutorial on wxWidgets for cross-platform GUI stuff. Try one on SDL for simple cross-platform 2D graphics. OpenGL is good for 3D graphics. There are libraries for threads and for internet communication. There are many alternatives, but basically you have to pick a library for something you're interested in and learn how to use it.
Books don't cover any of that because their scope is teaching the language.

Internet
For download and upload to several protocols, including (i.e. these are the only one I remember) HTTP and FTP, there's libcurl.

graphics
For Windows only, there's DirectX (well, DX is an entire multimedia library, really, but I don't think each of the modules is distributed separately).
For cross-platform, there's OpenGL, SDL, Allegro. There are also some 3D rendering engines, such as Ogre.

CD or DVD reading or writing
Oof. That's a hard one. For reading, you can just use the standard library, but writing... I really have no idea. You could get an open source burning program and see what it does.

using the mouse and keyboard or other input devices
For what? You mean like in a GUI? For GUIs there are open source, cross-platform toolkits, such as Qt, wxWidgets, GTK+.

making the computer type itself
What do you mean?


You mustn't have been looking very carefully, because you can find any of these libraries pretty easily.
Last edited on
Helios to those last two questions, I mean how would I make the computer move and click the mouse, or type the keyboard on its own? Will I need to know math or anything important to use said libraries?

How do you make a library for a language for something the language does not have already (just curious)?

I've heard of Ogre3d, I've been visiting the website for years but I've stopped myself from using it because I don't know what to do with it, and I don't know the math. I've heard of libraries before and thanks to you guys answering my questions I've got answers, that were staring me in the face. Still need to know how to do mouse, keyboard, and other input device stuff (like joysticks).
Helios to those last two questions, I mean how would I make the computer move and click the mouse, or type the keyboard on its own?
Why would you want to do that? There certainly are ways to do it, but I want to know what you ultimately want to do with it to perhaps suggest a better approach.

How do you make a library for a language for something the language does not have already (just curious)?
Depends on what the library will be doing. For example, a library like libbz2 that only loads files and decompresses them only needs the standard library and the CPU, since compression is mostly number crunching. When this is the case, the library could just as easily be coded directly into the application, since it has no external dependencies.

A GUI toolkits like wxWidgets is an abstraction layer between the main application and the system calls (http://en.wikipedia.org/wiki/System_call ), which in this case do things like opening windows and such. These libraries could also be coded directly into the application, at the cost of losing the layer and, consequently, portability. However, depending on the kind of library, statically linking may not be practical. Qt, for instance, is ~1.5 GB total.

Multimedia, specially graphics, libraries like OpenGL, OpenAL, and DirectX also use system calls, but instead of using them to communicate with the OS, they use the OS to communicate with the hardware. In this case, statically linking is never practical.

Then, finally, kernel drivers. These are at the lowest level of abstraction right next to the kernel and communicate directly with the hardware. The OS uses them to abstract away from the hardware and to possibly enable special functions in the specific model.
So we have:
Hardware <- Firmware (if it exists) <- Kernel and drivers <- System calls <- 2nd type libraries* <- Language <- 1st type libraries* and user's functions <- Main application
*Following the types I used above. Libraries are only classified by their linking type, but I couldn't find any other short way to refer to them.

Will I need to know math or anything important to use said libraries?
I'll tell right now: only very few types of applications use anything more advanced than high school math. If you know what a logarithm is and know your boolean algebra, you more or less know all the math you'll need.
The exceptions to this rule are mathematical application, obviously, and graphics programming. So to answer you other implicit question,
I've heard of Ogre3d, I've been visiting the website for years but I've stopped myself from using it because I don't know what to do with it, and I don't know the math.
There isn't more math required to use Ogre then there is to use any other library. When I said "graphics programming" I mean actually writing your own rendering engine. Since Ogre is already written, you don't need to.


Phew! Okay, it's way too late, now.
I would like to know how to do that for applications like Aimbots for FPS games, and spam bots for just any chat room, etc. You are very helpful, most of what you said about making libraries was over my head. :) How would I read the screens output? Say I wanted to record screen output, what library should I use?

Also how do I get a library to work with my compiler? Its actually been a while since I last programmed, and I need to re-read my book, and I'm using MS Visual Studio Express Edition.
Last edited on
I would like to know how to do that for applications like Aimbots for FPS games
They simulate user input at the application level by sending signals to the game's objects.
spam bots for just any chat room
Not a good method. The computer is so fast you'll lose control of you program rather quickly. I know, this has happened to me.
How would I read the screens output?
Too slow. Auto-aimers work by asking the game about the actor's position and doing a little trigonometry. Otherwise it would require computer vision or something like that.

Also how do I get a library to work with my compiler?
Depends on the specific library and how it's distributed. Some people compile the library for many compilers. Some only fora few and you need to compile it to use it with a different compiler. Some only release the source code and you always need to compile it.
For example, Nokia only releases Qt binaries for GCC and MinGW, not VC++, so you have to compile it. It takes around five hours.
closed account (S6k9GNh0)
Why do people want to create aimbots... The worst part is that you...you...release them...PUBLICLY! *dies*

I've created a couple of aimbots myself but I don't use them nor do I release them for other people. NOR do I sell them for a profit and then somehow never get sued by almost every game developer alive. *cough**cough**HelioS*. AIMBOT RESPONSIBLY!
Last edited on
I wasn't planning on releasing the aimbot. :)

They simulate user input at the application level by sending signals to the game's objects.


Do you know how I might do that?

Not a good method. The computer is so fast you'll lose control of you program rather quickly. I know, this has happened to me.


I know that, but I was planning on making a simple program that enters text every time you press a button or something with a timer that puts the message in every few seconds. Tell me if this works and if I've got it right.

Too slow. Auto-aimers work by asking the game about the actor's position and doing a little trigonometry. Otherwise it would require computer vision or something like that.


I never said I wanted to make an aimbot that reads the screen, I was thinking of another idea of mine which is to make a screenshot/video recording application. If I were to make an aimbot instead of reading where the crosshairs were I would just tell the program to zero in on a specific XY coordinate (the center of the screen/crosshair). I don't know how I would get the location of the other players, I read somewhere that they read the computers memory for the location and zero in on that. I used to think that some aimbots mointor the internet communication between the computer and the server, and find the players that way. I know there is encryption but I surmised that the aimbot maker did something to get it decrypted (yes I know doing something like that would take 1,000X+ years). I found an aimbot on the web but it doesn't work with my game anymore (pesky patches and fixes). Hmmm, trigonometry thats way over my head (at least at this point in time, must learn more math!).

In some of the games I play, using an aimbot will just get you banned so releasing one would just end up getting a bunch of players banned which would not be good. These games have specatator modes. And the one I have in mind has a program that allows you to see the view of other players to see if they jerk around instantly locking onto other players, both hidden and in full view. So in a way you can see if they actually ARE aimbotting.

For example, Nokia only releases Qt binaries for GCC and MinGW, not VC++, so you have to compile it. It takes around five hours.


Does the compile time change based on how fast your processor is? I've got a not too fast one. 1.8 Ghz.
Do you know how I might do that?
No idea.

I know that, but I was planning on making a simple program that enters text every time you press a button or something with a timer that puts the message in every few seconds. Tell me if this works and if I've got it right.
Yes, that would work. It's called a keyboard macro.

I know there is encryption
I doubt it. Using encryption there would be pretty daft, since it needs to get the data as soon as possible.

Hmmm, trigonometry thats way over my head (at least at this point in time, must learn more math!).
If you plan on doing anything at least remotely interesting with 3D, trigonometry is a must.

Does the compile time change based on how fast your processor is? I've got a not too fast one. 1.8 Ghz.
Compile time is influenced the most by the CPU. RAM speed, amount, and HDD access time are also factors, but the CPU is definitely the biggest contributor.
Those times I gave you were for compiling Qt, which is an exceptionally large library, on a Core 2 Duo 1.86 GHz. Most libraries take nowhere near that much. An average library will take around ten minutes, and thirty minutes or more is already a lot. But this doesn't say much, since you only need to compile a library once for every compiler, assuming you even need to.
Do you know how I might do that?
No idea.

Never though I would see the day helios!

Hmmm, trigonometry thats way over my head (at least at this point in time, must learn more math!).
If you plan on doing anything at least remotely interesting with 3D, trigonometry is a must.

When you say trigonometry is a must, to what degree do you mean. Are we talking your basic sin, cos, tan, sine and cosine rule? ... Or some of the harder stuff like trignometric functions and identities and what not? ... Or even further that I don't know about?
He probably does know... he just forgot. Helios knows everything.

Probably just sin, cos, tan, hyp etc. General things like that.

It's not difficult really - Sin = Opposite/Hypotenuse, Cos = Adjacent/Hypotenuse, Tan = Opposite/Adjacent.

Good way of remembering it, although it sounds and looks weird, is ''SOH CAH TOA'. That's how I remember it...

On a triangle: http://mrhiggins.net/algebra2/wp-content/uploads/2008/05/righttri2.png
i.e the longest line is always the hypotenuse, the one opposite the hyp is the opposite and the one adjacent to (i.e next to) the hyp is the adjacent.
Last edited on
I certainly know a lot, but I'm definitely very far from knowing everything. The more you know, the more you realize you don't know.

The only aimbot I've seen working was for Quake 3 Arena. It was a program that you ran first, and then you ran Q3. I really have no idea how they managed to hook it with the game.

AFAIK, stuff beyond the big three isn't used much in 3D. The problem, is that in high school you learn about 2D trigonometry, and it's not always intuitive how to extrapolate that to three dimensions. A very common trigonometric operation is calculating the surface normal of a polygon, usually to apply lighting on it. Normals are used heavily in bump-mapping, I understand.

Of course, this only applies when you're writing a graphics engine. You don't need to know any of this if you're just using the engine.
Oh, stop being modest!

I've seen aimbots on Counter-Strike: Source and I can't stand the people that use them. On GTA IV it's a small problem; cheats and spawners are more prevalent. I hate cheaters in games. Some servers on CS:S are made for cheating on (i.e. the non-VAC ones) but the cheaters seem to be drawn to the 'secure' ones. I put 'secure' in inverted commas for a reason...
Last edited on
AFAIK, stuff beyond the big three isn't used much in 3D. The problem, is that in high school you learn about 2D trigonometry, and it's not always intuitive how to extrapolate that to three dimensions. A very common trigonometric operation is calculating the surface normal of a polygon, usually to apply lighting on it. Normals are used heavily in bump-mapping, I understand.

Yeah thats a good point, that didn't even come to mind.

I would like to know how to do that for applications like Aimbots for FPS games
They simulate user input at the application level by sending signals to the game's objects.

This is what I can't comprehend (probably a mixture of ignorance and lack of experience) but how would you know what the objects are?

This is what I can't comprehend (probably a mixture of ignorance and lack of experience) but how would you know what the objects are?


That's a good question, lol.


I wanted to ask a few more questions:

I've got a book on hacking (very difficult to read and understand) so I expect that when I'm done reading it I'll be able to hack into the game and read those objects, and other stuff. Let me state that I don't really have an interest in cheating, this is more of an exercise. I just want to prove I can do it. I was thinking I would direct the mouse by getting into the games controls somehow. The question I remember I wanted to ask (I thought this up last night right before bed) how would I search that memory for these objects and the controls? Would searching the games memory and my own be a lot of work? I have 2 gigs of RAM right now, and I'm running Window Vista.

Computer quip could you tell me how you directed the aimbot to control your aim? I don't know how to put this into better words... How did you get the program to direct the movements of the crosshair?
This is what I can't comprehend (probably a mixture of ignorance and lack of experience) but how would you know what the objects are?
If the game has an API for modding, it's easy. All one has to do is include the header, link to the .lib, and that's as far as I know, since I've never been into game modding.

I've got a book on hacking
What's its name? Most books on hacking are related to computer security. Finding exploitable vulnerabilities in programs, services, and so on. For example, there was one vulnerability on Windows XP previous to SP2 that allowed a specially crafted JPEG to execute arbitrary code if loaded through the OS.
Finding out how software works involves reverse engineering, and isn't necessarily related to computer security. For example, you could reverse engineer a program to find out if it's violating some patent.

Would searching the games memory and my own be a lot of work? I have 2 gigs of RAM right now
LOL no. It makes no difference to search 2^16 or 2^32 bytes. First, because the system won't let you, and second, because you have nothing to search for. You have no idea how the program represents its data internally.
For example, there was one vulnerability on Windows XP previous to SP2 that allowed a specially crafted JPEG to execute arbitrary code if loaded through the OS.

Yeah i remember this. If i remember correctly wasn't this quite popular with forums because anyone who opened the web page which showed an infected jpeg could potentially have their system compromised?

Is knowledge of reverse engineering required for a programming career? I remember looking at OllyDbg before and opened up a simple hello world program to see what the results were and just thinking to myself, 'yeah ok... maybe another time' lol...
Is knowledge of reverse engineering required for a programming career?
Not unless your specifically a reverse engineer.
What's its name?


Hacking the art of exploitation by Jon Ericson.

I thought if I could get into the game, I could do something like finding the angle of the players camera and set that using the hacking stuff.

I downloaded a library, Chillkat's game development library thinking that it would help, but I don't know how to use it. It came as a DLL and I put it into my window32 folder, used the register command in command and it still wouldn't run my program.

The reason I thought the computer could run the mouse and keyboard is because of this video I found:

http://www.youtube.com/watch?v=0fX98-qvjeM

and I've seen tutorials where the video shows the mouse moving very carefully, something I don't think the person who made the video did using his mouse. I think a computer moved it while the person just recorded video of it.

PS the game has no API.
Last edited on
Pages: 12