Skip to content

theo543/asteroids

Repository files navigation

Asteroids

This project was written for the OOP course at the University of Bucharest in 2022-2023 (first year, second semester). The basic stuff (game loop, menus, ticking, rendering, collision detection, creating and destroying entities) is working (and I got the max grade for the project 😁).

I may come back to it later to make it an actual game (instead of just shapes flying around).

Resources

CMake and GitHub Actions

The code used for CMake and CI comes from our lab teacher's template repository, with some modifications, mostly to the CMake setup.

Libraries

Assets

Misc. Online Resources

  • Linking SFML into the executable
  • Embedding data into the executable:
  • Game Programming Patterns
    • Most of these are too advanced for this project, but the Game Loop and Update Method chapters were helpful
  • Physics of JellyCar: Soft Body Physics Explained (Collision Detection section)
    • Very useful info about collision detection, though this project doesn't have soft bodies
    • I wasted a lot of time here from a very stupid bug: I was starting the loop over edges from P2->P1, P3->P2, ..., but forgot I also needed P1->PN. If any ray got into the polygon through the missing edge it'd flip the result. Since this was letting rays into polygons without incrementing the intersection count, it completely broke the algorithm. Since SFML circles have 20 edges, it would sometimes line up right and work, making it seem like the square player had another bug. Wasted a lot of time with theories about floating point errors or the ray hitting a corner and incrementing the count twice.
  • Point in polygon Wikipedia article
    • Describes the ray casting algorithm
  • Shoelace formula
    • Used to calculate the area of a polygon

Open Source Licenses

All dependencies are under their own licenses, mentioned above. They are all permissive licenses (MIT, BSD, Zlib, ISC, Public Domain CC0), so I can add them into the executable without any issues (besides OpenAL which is dynamically linked).

TODO: add a credits screen with the licenses to the game