All GameDev.tv Unreal Courses

Just finished making my version of the TripleX game. Had a lot of fun learning and was very easy to understand.

void PrintIntroduction(int Difficulty)
{
// Prints out the intro message
std::cout << std::endl;
std::cout << “Welcome Detective Jackie, the entire building complex is under my control.\n”;
std::cout << “If you wanna catch me you better clear each floor without me knowing.\n”;
std::cout << “Cause’ if I catch you in the terminal, it will be all over for you Detective.\n”;
std::cout << std::endl;
std::cout << "Current floor security level " << Difficulty;
std::cout << std::endl;
}

bool PlayGame(int Difficulty)
{
PrintIntroduction(Difficulty);

// Declares the  variables
const int CodeA = rand() % Difficulty + Difficulty;
const int CodeB = rand() % Difficulty + Difficulty;
const int CodeC = rand() % Difficulty + Difficulty;

const int CodeSum = CodeA + CodeB + CodeC;
const int CodeMultiply = CodeA * CodeB * CodeC;

// Prints out values of "CodeSum" and "CodeMultiply"
std::cout << std::endl;
// std::cout << CodeA << CodeB << CodeC << std::endl; // Only to see the randomized values
std::cout << "\n* There are three numbers in the code";
std::cout << "\n* The codes add-up to: " << CodeSum;
std::cout << "\n* The codes multiply to: " << CodeMultiply <<std::endl;

// Store player guess values
int GuessA, GuessB, GuessC;
std::cout << std::endl;
std::cin >> GuessA >> GuessB >> GuessC;

int GuessSum = GuessA + GuessB + GuessC;
int GuessMultiply = GuessA * GuessB * GuessC;

// Print out win or lose statement 
if(CodeSum == GuessSum && CodeMultiply == GuessMultiply)
{
    std::cout << "\n*** Override code accepted, current building level unsealed, rebooting local security system. ***\n";
    return true;
}
else
{
    std::cout << "\n*** I found you detective, should have guessed better, releasing the neuro toxins ***\n";
    return false;
}

}

int main()
{
srand(time(NULL));

int LevelDiffuculty = 1;
int const MaxLevel = 7;

while (LevelDiffuculty <= MaxLevel) //Loop game until all levels are completed
{
    bool bLevelComplete = PlayGame(LevelDiffuculty);
    std::cin.clear();
    std::cin.ignore();

    if (bLevelComplete)
    {
        ++LevelDiffuculty;
    }
    
}

std::cout << "\n*** Looks like you caught me detective. Congrats. ***\n";

return 0;

}

1 Like

Hope nobody takes this out of context but here is my TripleX quarantine game…

#include <iostream>
#include <ctime>

void PrintIntroduction(int Difficulty)
{
    //ASCII Art
    std::cout << "\n\n|_____|__________|_";
    std::cout << "\n|     | | | | | || |_______________";
    std::cout << "\n|_____|__________|_|              ,";
    std::cout << "\n|     |          |                ,\n";
        
    //Pring welcome messages to the terminal
    std::cout << "\nYou have been level " << Difficulty;
    std::cout << " quarantined because of a virus outbreak and have been infected...\nTo recieve each level's vaccine and be released, you must enter the correct codes to all 5 levels.\n";
}

bool PlayGame(int Difficulty)
{
    PrintIntroduction(Difficulty);

    const int CodeA = rand() % Difficulty + Difficulty;
    const int CodeB = rand() % Difficulty + Difficulty;
    const int CodeC = rand() % Difficulty + Difficulty;

    const int CodeSum = CodeA + CodeB + CodeC;
    const int CodeProduct = CodeA * CodeB * CodeC;

    //print CodeSum and CodeProduct to the terminal
    std::cout << "\n+ There are 3 numbers in the code";
    std::cout << "\n+ The code numbers add-up too: " << CodeSum;
    std::cout << "\n+ The code numbers multiply to give: "<< CodeProduct;

    //Store player guess
    int GuessA, GuessB, GuessC;
    std::cout << "\n\nEnter your guess: ";
    std::cin >> GuessA >> GuessB >> GuessC;

    int GuessSum = GuessA + GuessB + GuessC;
    int GuessProduct = GuessA * GuessB * GuessC;

    //Check if player is correct
    if (GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        std::cout << "\n***You are correct and have recieved the level " << Difficulty;
        std::cout << " vaccine!***";
        return true;
    }
    else
    {
        std::cout << "\n***You are incorrect and have NOT recieved the vaccine! You must stay in level " << Difficulty;
        std::cout << " quarantine! Try again!***";
        return false;
    
    }
}

int main ()
{
    srand(time(NULL)); //Creates new random sequence based on time of day

    int LevelDifficulty = 1;
    const int MaxDifficulty = 5;

    while (LevelDifficulty <= MaxDifficulty) //Loop game until all levels are completed
    {
        bool bLevelComplete = PlayGame(LevelDifficulty);
        std::cin.clear(); //Clears any errors
        std::cin.ignore(); //Discards the input buffer

        if (bLevelComplete)
        {
            ++LevelDifficulty;
        }
        
    }

    std::cout << "\n***You have received all 5 vaccines and may leave quarantine! Congratulations!!!***";
    return 0;
}
1 Like

This post is in response to the Unreal Engine C++ Developer course.

Lesson 21: Statements & Comments:

  • I’m assuming that the Preprocessor Directive which calls on the library is what allows is to
    use functions and/or statements which that library posseses?
  • The main function is what gets called by the program and then all actions within its body are executed when called?
  • The Expression Statements are statements which result in an effect being returned to the user interface and is visible to the user; in the case of this lesson the interface is the console.
  • The Declaration Statements are statements which perform some function within the program that is stored, but not returned in any way?
  • The return statement ends the program if the program returns 0.
1 Like

hello, can you help me?
i have a similar issue, but nothing that is displayed

1 Like

Looks like you need to add the below, this would sit above the “return 0” line;

System(“Pause”);

1 Like

Hello, I am new to the course and already having trouble. I believe something went wrong during the download and install process. The Developer command prompt will still open code, but I can not compile or run any of my program that I have started working on. I am thinking the set up is going to have to be rather complex since it was not set up for me during the download and install process, but let me show you want I am getting

1 Like

Hello,

I’m on step 105 of the C++ Developer course with Building Escape. This video deals with trigger volumes. As you can see by the screenshot, I’ve included the correct “Engine/TriggerVolume.h” file. However, when I go to type in ATriggerVolume, it’s coming up as some random integer rather than a class. As a result, I’m unable to use this correctly in the next video. Any ideas as to what’s going on?

1 Like

I’m not sure what was wrong. I tried to compile and it worked. The doors open with the pawn walking into the trigger volume. However, what I find odd is the ATriggerVolume still appears as a variable rather than a class. Very confused. But, I guess it’s working and that’s all that matters lol!

1 Like

My TripleX game so far :smiley:

2 Likes

hi so i am doing what the classes says exactly but when compiling what is the extra stuff i see thats highlighted yello? it makes me think i am doing something wrong because its not in the video.

1 Like

Not sure if I’m in the right spot, but I think main() is a method for the game, meaning it will contain the command which will execute a certain part of the game when the method is called upon. Starting my C++ journey, wish me luck!

3 Likes

Can Anybody Help me out ?!

After my direct PC shutdown (during compiling) I’ve lost all the codes (even tho I was saving files per 10min using ctrl +S ) , When I recoded everything my codes compiled successfully but Unreal Game engine 4.25 is’nt reacting to those codes ! and showing nothing but a blank bood with dollo sign in it !
Please help I needed to reslove this problem for taking futher classes of the course.

1 Like

I’m having the same issue have you been able to fix this?

1 Like

Hi.
I Just finished the Bulls and Cows game. I made it easier by showing which letters are the cows and which are the bulls.

In this example I tried the word speak.

2 Likes

What course should i take first c++ or blueprint

2 Likes

i need help installing unreal engine

1 Like

You should choose a file that isn’t buried too deep into other files on you computer. Put it on one drive and it should work. Applies to only windows.

1 Like

TripleX so far…

grafik


Guys I’m. Having this error can anyone help me.

Please start a new thread, since it’s unrelated to this one.
And when you do, please share what you’re typing in, this looks like only half of the output.

Privacy & Terms