A cross platform pre-configured C++ game development setup. It uses Meson to build a bouncing game using SFML, ImGUI, and Box2d in the smallest C++ example possible.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Zed A. Shaw 0766a2aacb Wrong directory name for the setup script. 4 weeks ago
scripts Wrong directory name for the setup script. 4 weeks ago
wraps A fix that locks all dependencies at a specific version. 2 months ago
.gitignore Start of the starter pack so I can get the installs up and write a blog post about it. 5 months ago
LICENSE Initial commit 5 months ago
README.md Fix a few typos and some formatting. 5 months ago
click.mp3 Start of the starter pack so I can get the installs up and write a blog post about it. 5 months ago
imgui.ini Start of the starter pack so I can get the installs up and write a blog post about it. 5 months ago
main.cpp A fix that locks all dependencies at a specific version. 2 months ago
meson.build Start of the starter pack so I can get the installs up and write a blog post about it. 5 months ago
sprite.png Start of the starter pack so I can get the installs up and write a blog post about it. 5 months ago

README.md

Game Dev Starter Pack

This repository contains a simple C++ project with the basics you need to get a game in C++ going. It's meant to be an educational starting point for people interested in learning to make games in C++ from scratch. It also would be a decent starting point for building a game with other frameworks like Raylib, SDL2, or anything that needs to be compiled. This setup also works on Windows, OSX, and Linux and includes a "meta install" script for Windows that installs a complete C++ development environment.

I recommend you get this project working with SFML and then rework it for the other framework you want to use, but honestly SFML is really good and works well.

If You Just Want to Make a Game

This project is more geared toward people who want to learn C++ by making a bunch of little games, or people who want to learn how to make games from almost nothing. If you have a burning desire to craft a game, then I recommend not using this project and instead go learn any of these:

  1. Defold
  2. Game Maker Studio
  3. Godot
  4. Unreal Engine
  5. O3DE

Keep in mind that I've only played with each of these, and have not made a full game in them, so my opinion is highly suspect. You should probably just download each one, think of a tiny little game to make, and try to make it. Pick the framework that gets the most of your game done with the least effort.

Windows

If you have nothing installed then you'll want to run the scripts/windows_setup.ps1 script to install everything. This script will run and prompt you for admin passwords as it installs what you need, so be sure to stay near your computer to type passwords in when requested. To run it do this:

  1. Start a normal non-Administrator PowerShell window.
  2. irm https://learncodethehardway.com/cppsetup.ps1 > cppsetup.ps1
  3. powershell -executionpolicy bypass .\cppsetup.ps1
  4. STAY HERE. For some dumb reason many installers have a timeout that will cause the installer to fail if you don't enter a password fast enough, so stay close until this is done.
  5. Close this PowerShell window and then you can run Windows Terminal and everything should work. If not please email help@learncodethehardway.com to tell me what happened.

The cppsetup.ps1 file and the scripts/windows_setup.ps1 should be exactly the same. I'm having you use the cppsetup.ps1 file since I assume you don't have git yet. Once that's done you should then be able to build the project:

  1. Run .\setup.ps1
  2. meson compile -C builddir
  3. .\builddir\sfmldemo -- That should run it and you see a window with ImGUI's demo panel.

WARNING: You should look in the setup.ps1 and reset_build.p1 files for how a build is actually configured. The most important line is at the bottom meson setup -Ddefault_library=static builddir which properly configures the build so that the sfmldemo.exe program actually runs. Without the -Ddefault_library=static the sfmldemo.exe file will not have the .dll files it needs and will silently fail. If it fails to start then run start builddir and double click on it to get the error messages. Then run reset_build.ps1 to get a good build.

OSX

  1. Get XCode and Meson installed.
  2. Run ./setup.sh
  3. meson compile -C builddir
  4. .\builddir\sfmldemo -- That should run it and you see a window with ImGUI's demo panel.

I'll have more extensive instructions in a later blog post, but if you have time try this out and let me know how it went at help@learncodethehardway.com. Please let me know if you tried a different compiler, Windows version, etc. If you're on OSX or Linux it should work the same but Linux people might want to use their package manager instead.

"Keyboard without any keys"

If you get a weird error message of, "We got a keyboard without any keys" it's because of a security feature in OSX. Go to Security settings->Input Monitoring and select your Terminal. Check it, enter your admin password, then restart your Terminal. Now you can...read the keyboard in your own software.

No, this does not enhance security at all. These people have gone full on insane at this point.

Linux

I actually don't have a Linux computer ready to test, but if you have a brand of Linux you like then try the OSX instructions and email me at help@learncodethehardway.com.

Next Steps

I want the main.cpp to hit all the major features of SFML without getting too large, so these are some of the features I need to add:

  1. Joystick control.
  2. Drawing a floor and walls that work with the physics.
  3. Possibly using the networking and threading capabilities of SFML, but not really sure for what.
  4. Some kind of hit point calculator, since most everyone needs that.