Skip to content

ThomasByr/pac-man

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

icon pac-man - A Clone in CPP

Linux GitHub license GitHub commits GitHub latest commit Maintenance

C/C++ CI CodeQL Publish

GitHub version Author Author

  1. โœ๏ธ Setup
  2. ๐Ÿ’ More infos and Usage
  3. ๐Ÿงช Testing
  4. ๐Ÿง‘โ€๐Ÿซ Contributing
  5. โš–๏ธ License
  6. ๐Ÿ”„ Changelog
  7. ๐Ÿ› Bugs & TODO

โœ๏ธ Setup

Note

This project is part of a M1 study done at the University of Strasbourg, France.

Please make sure you have libsdl2 installed :

sudo apt-get update && sudo apt-get install libsdl2-dev
For Windows 11 WSLg users (click here to expand) Please make sure you have graphical x11 support installed (should be installed by default) :
sudo apt-get install libgl1 libxkbcommon-x11-0

Also, make sure wsl --version outputs at least the following :

WSL    Version : 1.2.5.0
kernel Version : 5.15.90.1
WSLg   Version : 1.0.51

If not, please update your WSLg version by following the instructions here. tl;dr : type this in your powershell :

# will only work if you have the latest Windows 11 update
wsl --shutdown
wsl --update

Then compile a release version of the program with :

make release
Tip

To reduce compile time, you can use the -j flag to compile in parallel. For example, if you have 4 cores, you can use make -j4 release to compile in 4 threads.

This project uses the -std=gnu++17 flag to compile and the produced executable binary is to be found inside of the bin folder.

๐Ÿ’ More infos and Usage

Warning

We use SDL2 as the only external dependency. Others dependencies are compiled from source (please see lib folder). Note that if not specified, all files are written by @ThomasByr.

Notable ones are :

  • ctpl.hpp, a C++11 header-only library for thread pools
  • ini.hpp, a single-file header-only library for INI files
  • json.hpp, a single-file header-only library for JSON (by Niels Lohmann)

We provide a makefile to ease the compilation process. It is composed of the following targets :

  • make release : compiles the program in release mode
  • make debug : compiles the program in debug mode
  • make clean : cleans the build directory and the binary
  • make run : runs the program
  • make docs : generates the documentation (and opens it in your default browser)

There would be more to it, but these are the basics. To build the documentation, you will need doxygen and graphviz installed :

sudo apt-get install doxygen graphviz

The documentation is to be found inside of the html folder.

๐Ÿงช Testing

Oh god... please don't.

Still, make sure you have valgrind up and ready and then run :

cd tests && make check_quiet

๐Ÿง‘โ€๐Ÿซ Contributing

If you ever want to contribute, please begin by reading our Contributing Guidelines.

The standard procedure is :

fork -> git branch -> push -> pull request

Note that we won't accept any PR :

  • that does not follow our Contributing Guidelines
  • that is not sufficiently commented or isn't well formated
  • without any proper test suite
  • with a failing or incomplete test suite

Happy coding ! ๐Ÿ™‚

โš–๏ธ License

This project is licensed under the AGPL-3.0 new or revised license. Please read the LICENSE file. In addition :

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the pac-man authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

๐Ÿ”„ Changelog

Beta first minor release (click here to expand)

v0.1.0 first release

  • brought back ctpl.hpp (thread pool)
  • added ini.hpp (INI files) and json.hpp (JSON files)
  • made some header files for game logic

v0.1.1 fps counter

  • added fps with bitmap font
  • target fps is now respected (๐Ÿฅณ)

v0.2.x pacman entity logic

  • pacman correctly responds to user input
  • stops when hitting a wall
  • changes direction (if registered) when hitting a wall
  • eats dots

v0.3.x some system pause and wait stuff

  • added pseudo keypressed event checkers
  • wait_for_ms w/ internal chrono

v0.4.x ghost entity logic

  • ghost entity on display
  • added chasing algorithms
  • added scatter mode and frightened (pure random) mode
  • added timed mode switching

๐Ÿ› Bugs & TODO

known bugs (final correction patch) see Issues

bug type description
won't fix bug that won't be fixed ... maybe
future bug bug that does not appear in the current version but will appear as soon as the corresponding feature is implemented due to current core logic
logic bug bug that is not due to source code but rather to the way the core logic have been thought out
bug just a bug ... or a feature ... the base thing that won't last long I promise
  • target fps bypassed (resolved by re-updating timers after each frame)
  • pac-man speed is set to 1.0f (won't fix)
  • first animation sprite depends on current frame count (won't fix)
  • entity speed is not scaled by the window size (bug)
  • when ghosts go back to their home, they come out as frightened (future bug)
  • when ghosts go back to normal, they might re-enter frightened mode (logic bug)

todo (first implementation version)

  • show pacman (v0.2)
  • show ghosts (v0.1)
  • implement pacman direction and collisions logic (v0.2)
  • implement ghosts tracking algorithms (v0.4)
  • create levels, scores, lives and a save system
  • add fruits ๐Ÿ’

About

๐Ÿ•น๏ธ a pac-man clone in c++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages