Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Programming Tutorials › Game Development

Game Development

Posts 1–15 of 35 · Page 1 of 3
Toymaker
Toymaker
Game Development
C++ Game Development [Tutorial] p1
by Toymaker

0. Introductions
1. To Get Started
2. To Make It Run
3. For It's Engine
4. To Get It Safe
5. The GoodByes
6. Get The Quiz!
7. Common Questions


0.(Introductions) In light of MPGH's own Game Engine, (Jetaengine) being well on it's way, I decided to make this simple tutorial for those of you interested in getting started with learning to create and secure games.


1.(To Get Started) All you need to get started is the standard Bloodshev Dev-C++ compiler and this tutorial. It is your creativity that will bring the most success.

2.(To Make It Run) I've compiled and working and simple model of a text based game for you to use and/or add onto sometime, to get you started. You'll notice a key concept to game creation is 'running while playing,' as my while loop gives away. This is a simple model of you fighting the computer. It does not even do random damage or have a working SP system. I suggest you try it out to make sure you understand it. It is all too basic of code for me to waste time explaining to you.

Code:
#include <iostream>
using namespace std;
int uhp = 100;
int usp = 10;
int mp = 100;
int ms = 10;
int turn = 1;
int atk;
int dmg;
int main() {
    system("title GameName");
while ( uhp > 0 ) {
      if ( turn == 1 ) {
           turn--;
           cout<<"It is YOUR turn hero.n";
           cout<<"Your HP is: "<<uhp<<"n";
           cout<<"Your SP is: "<<usp<<"n";
           cout<<"Decide Your Next Moven";
           cout<<"1. Punch(10 DMG 0 SP)n";
           cout<<"2. Psyki(20 DMG 5 SP)n";
           cin>>atk;
           if ( atk == 1 ) {
           dmg = 10;
           cout<<"You do: "<<dmg<<" DMGn";
           mp = mp - dmg;
           cout<<"Monstr Life: "<<mp<<"n";
           }
           else {
           dmg = 20;
           cout<<"You do: "<<dmg<<" DMGn";
           mp = mp - dmg;
           usp = usp - 5;
           cout<<"Monstr Life: "<<mp<<"n";
           }
           if ( turn == 0 ) {
                turn++;
                cout<<"Computer AIs Turnn";
                cout<<"Computer Hits Youn";
                cout<<"Suffer: 10 Damagen";
                uhp = uhp - 10;
                cout<<"New HP: "<<uhp<<"n";
                }
                if ( mp < 5 ) { 
                     cout<<"You Just Wonn";
                     system("pause");
                     exit(0);
                }
                }
                }
                cout<<"Thanks For Playinn";
                system("pause");
                }
3.(For It's Engine) The idea of a game engine is to make an option for users to input unique information. It can be simple or complex. In my example, using the game above, you will see how to use a script file to determine the players name as if one small feature of a game engine. If you add the cpp code below to your game and create a few locations for it to output the variable, it will say the players uniquely set name every where.

Code:
Add To .Cpp

string playername;
ifstream b_file ( "script.txt" );
b_file>> playername;
cout<<"Welcome Player: " <<playername<< "n";

Add To .Txt
McAnthony

4.(To Get It Safe) This is the big one. You don't want users leaking or cracking your game! I will break this section up into two parts.

A. You don't want users to be able to leak a free version of your game. with that noted, you created a demo version in which you Trial protect so users can only load it so many times. You use the same concept as the engine code above but you want to hide it and change it a bit. In this example your players can only play 5 times before paying:

Code:
Add To .Cpp

int loudcount;
ifstream b_file ( "loadcounter.txt" );
b_file>> loadcount;
if ( loadcount > 5 ) {
cout<<"You've played to much!n";
exit(0);
}

Add To .Txt
1
B. You will notice, perhaps in cracking basic password programs, a common hacker can just debug your program and change one jump of memory to a no operation in memory and avoid it. In layman terms, in the "if you can use or not" code they can cancel out the 'or not' part so it always loads. A basic way to beat this, noting the Offset and Bytes are in decimal and not hexadecimal during compile time, is to check the memory's integrity. If the ASM code is like this:

4D0: 1111 | CMP YOURPASS TO CORRECTPASS
4D4: 2222 | IFWRONG GOTO WRONG LOCATION
4D8: 3333 | IFRIGHT GOTO RIGHT LOCATION

A hacker could simply 9090 (NoOperation) the 4D4 IFWRONG line so all that's left is the 4D8 IFRIGHT line. So you can use ReadProcessMemory to check for non changed values.

Code:
    int address = 0x4D4;
    int value;
    DWORD pid;
	GetWindowThreadProcessId(hwnd,&pid);
        HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
                 ReadProcessMemory(phandle,(LPVOID)address,&value,2,0);
                 cout << value;
                 getch();
                        if ( value != 2222 ) {
                        cout<<" You must be hackingn";
                        system("pause");
                        }
5. End Of Tutorial It's basic and quick but leaves room for a lot of learning direction and I hope you learn from it or are inspired with ideas. I must additionally credit using google to find certain code snippets and method ideas.

6.(GET THE QUIZ). As far as this quiz goes perhaps you can pass it! You simply need to achieve the following goals (Notice: If you do this quiz you can submit it here for additional group learning and thank you):

1. Add a working SP system to the TBG, (Text Based Game), so your player can only use the stronger attack two times total.
2. Increase the security of your safety measures through encryption or obscuring the information and or path locations

7.(Common Questions) Q. How do I do a save game feature? A. You simply ask the user to load a game or start a new one and if they want to load a game it reads from a .txt file that, if they saved the game saved, wrote information to. You could do an auto-save on escape and it'd store the HP/SP of you and the monster in a .txt file for auto-loading next execution, for testing and example.
#1 · edited 17y ago · 17y ago
SyrupyMonkeh
SyrupyMonkeh
Great TuT much appreciated, ty
#2 · 17y ago
Toymaker
Toymaker
Yeah, I get asked for tutorials like these a lot and am happy to help promote higher thinking in this programming section than calculators and hello world.
#3 · edited 17y ago · 17y ago
trenhryan
trenhryan
woah that crazy
#4 · 17y ago
joshzex
joshzex
i still dont get it
#5 · 17y ago
Toymaker
Toymaker
It's true I didn't exactly baby people through the tutorial. I am however going to continue the series very soon. You should be able to learn from it still by trying to use it and fixing it up, etc. You need motivation to 'get it.'
#6 · 17y ago
GG2GG
GG2GG
so i heard gg2gg prawnt this and waiting for next pvt lesson
#7 · 17y ago
PI
pingwasha
would packing your files be count as added security??
#8 · 17y ago
CH
chris12x1
i get this error:
56 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp variable `std::ifstream b_file' has initializer but incomplete type
57 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp expected constructor, destructor, or type conversion before '>>' token
57 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp expected `,' or `;' before '>>' token
58 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp expected constructor, destructor, or type conversion before '<<' token
58 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp expected constructor, destructor, or type conversion before '<<' token
60 C:\Documents and Settings\chris diaz\Desktop\Untitled1.cpp `Add' does not name a type
#9 · 17y ago
Toymaker
Toymaker
so i heard gg2gg prawnt this and waiting for next pvt lesson
Already in progress =p

would packing your files be count as added security??
In this case, yes but don't rely on it.

i get this error:
56 Cocuments and Settingschris diazDesktopUntitled1.cpp variable `std::ifstream b_file' has initializer but incomplete type
57 Cocuments and Settingschris diazDesktopUntitled1.cpp expected constructor, destructor, or type conversion before '>>' token
57 Cocuments and Settingschris diazDesktopUntitled1.cpp expected `,' or `;' before '>>' token
58 Cocuments and Settingschris diazDesktopUntitled1.cpp expected constructor, destructor, or type conversion before '<<' token
58 Cocuments and Settingschris diazDesktopUntitled1.cpp expected constructor, destructor, or type conversion before '<<' token
60 Cocuments and Settingschris diazDesktopUntitled1.cpp `Add' does not name a type
If you download and install the recent version of dev-C++ compiler and leave it standard, it compiles fine for me. I'm not sure if you made any changes or use a different compiler or version.

But, the errors make it appear you're missing some simple ; marks and are missing two definitions.
#10 · 17y ago
OR
orx
Yea in c++ its easy to just make a game using maths , anyways , downloaded directx sdk today , and a game programming ebook , 1035 pages to read <.< , about directx programming , as soon , as i finish learning this shit , i will release my own chess game or something , just for learning , but still , its 3d , and looks very good 8-)

OrX
#11 · 17y ago
WA
waqup08
so im guessing this is uh.. console application not a windows application? o.o
#12 · 17y ago
Toymaker
Toymaker
Yes, waqup08 it is. Jetamay has some examples of windowed ones. The point of this was to teach game flow and physical logic, quite briefly at that.
#13 · 17y ago
WH
whitten
nice post bro!
helped lots.
i may get into this shit.
#14 · 17y ago
rwkeith
rwkeith
Bravo, I am a game programmer myself. I found your tutorial easy to understand and I learned a little on game protection. Next open tutorial you should bring up key protection or user id's and password's.
#15 · 17y ago
Posts 1–15 of 35 · Page 1 of 3

Post a Reply

Similar Threads

  • Direct-X Tutorials (Game Development)By Dave84311 in C++/C Programming
    12Last post 17y ago
  • Game Development Section - Whos managing that?By jeremy6996 in General
    9Last post 15y ago
  • Game Development sectionBy radnomguywfq3 in General
    12Last post 17y ago
  • Game DevelopmentBy InsanityJ- in General
    12Last post 15y ago
  • If you could tell game developers one thing...By Retarded Cheesecake in General
    5Last post 16y ago

Tags for this Thread

#development#game#tutorial