/Who-wants-to-be-a-millionaire

Who wants to be a millionaire game in c++ made with (SDL)

Primary LanguageC++

Who wants to be a millionaire?

Gameplay.mp4

(Refresh page if you have problem with the video)

About the Game

This game was created in c++ made with Simple DirectMedia Layer (SDL).

The program contains more than 5,000 questions in English, German and Hungarian.

In conclusion the game has a full version of English, German and Hungarian.

Important to know before start

  • The game was designed for hungarian play.
  • The original questions are hungarian so the english and german versions are translated with google translater -> There can be a LOT OF anomaly.
  • There is no memory leak according to the CrtDumpMemoryLeaks().
  • The "Windows.h" include was used in the program -> Game can be run only on WINDOWS.

How to compile and run the project form TERMINAL

  1. Download the Only Source Files project form my github.
  2. Extract the project and open the Only Source Files directory (You should be where the .cpp files are) then create a new directory named as src
  3. In the src directory create two new directories named as include and lib
  4. Download SDL, SDL_image, SDL_mixer, SDL_ttf libraries.
SDL libraries Description
SDL https://www.libsdl.org/release/SDL2-devel-2.0.22-VC.zip
SDL_image https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.6.2-VC.zip
SDL_mixer https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.6.2-VC.zip
SDL_ttf https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.20.1-VC.zip
  1. Extract the downloaded libraries. Every library will contain an include and lib directories.
  2. From the SDL include directories move all the .h files to our project's src/include directory.
  3. From the SDL x64/lib directories move all the .lib files to our project's src/lib directiory.
  4. From the SDL x64/lib directories move the SDL2.dll | SDL2_image.dll | SDL2_mixer.dll | SDL2_ttf.dll libraries to our project's directiory. (These files should be where the .cpp and .h files are.)
  5. At this point you should see this.
Main Directory Src Directory Include Directory Lib Directory
image image image image
  1. Open a terminal in the directory and compile the files with this command:
    g++ -Isrc/include -Lsrc/lib *.cpp -lSDL2main -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -Wall -Wextra

  2. Run the a.exe file and you are ready to go.

Problem with Threads while compiling the project.

At the 10. step you might get an error like this.

image

Try this first

Compile the project with -pthread and -std=c++17. <br>

Problem

If the above advice did not work then it is likely that your version of the c++ compiler does not support threads by default. 
I used to have the same problem with this version of g++. 

image

Solution

The solution was to download another g++ compiler with the posix version.
I downloaded the `prebuild MinGW-w64 x86 posix` version and everything works fine with it.
(With this version you don't need to use the -pthread and -std=c++17 operators.)

https://www.mingw-w64.org/downloads/#mingw-builds

image

How to run Project from Visual Studio 2022

  1. Download Visual Studio 2022 and set up for c++.
    VS2022 c++ does contain thread by default so probably you won't get a thread error like the above
  2. Download the Visual Studio 2022 Version from my Github
  3. Create an directory named as SDL2 recommended in C:\
  4. Create an include, lib, bin direcory inside of the SDL2 directory.
  5. Download SDL, SDL_image, SDL_mixer, SDL_ttf libraries.
SDL libraries Description
SDL https://www.libsdl.org/release/SDL2-devel-2.0.22-VC.zip
SDL_image https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.6.2-VC.zip
SDL_mixer https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.6.2-VC.zip
SDL_ttf https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.20.1-VC.zip
  1. Extract the downloaded libraries and move all their .h files from include directory to our SDL2\include directory. (C:\SDL2\include)
  2. Move all their .lib files from lib\x64 to our SDL2\lib directory. (C:\SDL2\lib)
  3. Move all their .dll files from lib\x64 to our SDL2\bin directory. (C:\SDL2\bin)
  4. At this point you should see this.
SDL2 Directory Bin Directory Include Directory Lib Directory
image image image image
  1. Open a terminal and create a virutal disk using this command:
    subst T: C:\
  2. Open the Visual Studio 2022 project and you are ready to go.

Start Display

kép

On the start display there are 3 buttons.

  • The first will load the Select display. If you want to create a new game then click on this.
  • The second button will load the LeaderBoard display. If you want to check the top 10 player of all time then click on this.
  • The third button will load the Results display. If you are curious about your results then click on this button.

LeaderBoard display

kép

  • On this display you can check the top 10 player by the different game modes.
  • After you played a game your game state will saved in a file.
  • If you did well you will be shown on the leaderboards.

Results display

kép

On the Results display you can check the game results of a given player.

  • Click on the input text field and start to type your or somebody else's name.
  • For capital letter use the CAPS LOCK key.
  • After you typed a name click on the green check mark, and all the results will be shown.

Select display

kép

  • You must choose a game mode and a name.
  • If you didn't choose any of them you can't start the game.
  • The chosen game mode will be green.
  • After you click on start game button the INGAME button will be displayed.

InGame display

kép

At the left side you can find the helps.

  • 50 / 50 -> This help deletes 2 answers
  • Phone -> You have 30 seconds to "phone" a friend
  • Ask the Audience -> The audience votes and you can decide to belive them or not.
  • The used helps are rendered with a red X and they are unavailable.

At the right side you can find the values you can win.

  • The current winnable prize is marked as yellow.
  • The completed prizes are marked as green.
  • Language is hungarian the prizes are in HUF, otherwise they are in DOLLAR

Option display

kép

Available game languages:

  • English
  • German
  • Hungarian
  • You can set the language while being on any of the displays. After you set it every text will be displayed according to the language.

Available game font types:

  • Times New Roman
  • Minecraft
  • IndieFlower Regular

Music Volume (0 - 10)
Chunk Volume (0 - 10)

About the Game Sounds

The full sound track: https://www.youtube.com/watch?v=MForOVuA6hs
Click sound: https://www.youtube.com/watch?v=h6_8SlZZwvQ
Hover sound: https://www.youtube.com/watch?v=caezQznghGE
Error sound: https://www.youtube.com/watch?v=FwVRkhy5G04