HATPC remake
 
 
 
Go to file
En Yi 1e584c1dc3 Add hover on select text 2025-01-18 10:23:23 +08:00
engine Add hover on select text 2025-01-18 10:23:23 +08:00
res Add resource packing script 2024-12-21 20:11:32 +08:00
scenes Add hover on select text 2025-01-18 10:23:23 +08:00
tests Fix regression in AABB collision 2023-11-16 00:03:26 +08:00
tracy@5d542dc09f Experiment with Tracy profiler 2024-08-24 19:14:53 +08:00
.gitignore Use heaptrack for memory profiling on main 2024-08-24 14:41:10 +08:00
.gitmodules Experiment with Tracy profiler 2024-08-24 19:14:53 +08:00
CMakeLists.txt Significantly Update CMakeFile to reduce clutter 2024-12-21 18:42:45 +08:00
Conventions.txt Attempt to apply code style consitency 2023-04-15 22:52:38 +08:00
LICENSE Add MIT license 2023-08-14 23:10:11 +08:00
README.md Fix name mistake in README 2024-08-24 15:45:33 +08:00
assets_test.c Allow multi-rows sprites framing 2024-05-06 21:18:03 +08:00
build.sh Add convenience scripts 2023-03-11 22:50:17 +08:00
entManager_test.c Put more boilerplate inits into engine init 2023-10-13 21:08:48 +08:00
level_load_test.c Expose initial window size to scene 2024-05-04 18:28:53 +08:00
level_select_test.c Add mouse support for scroll area 2024-07-08 19:16:10 +08:00
level_test.c Significantly Update CMakeFile to reduce clutter 2024-12-21 18:42:45 +08:00
lsan_supp.txt Add convenience scripts 2023-03-11 22:50:17 +08:00
main.c Add basic window resizing 2024-10-12 15:02:08 +08:00
menu_test.c Add level select scene 2024-07-02 21:54:54 +08:00
particle_test.c Allow multi-rows sprites framing 2024-05-06 21:18:03 +08:00
run.sh Rework sprite render system 2024-05-01 11:55:34 +08:00
run_tests.sh Add simple test for mempool 2023-08-13 14:54:10 +08:00
scene_man_test.c Allow optional inits for scene 2024-08-24 14:42:11 +08:00
scene_test.c Experiment with Tracy profiler 2024-08-24 19:14:53 +08:00
water_test.c Add a rendering queue for sprite 2024-12-21 14:37:18 +08:00

README.md

Some Game Engine

Sandbox demo here: link

An attempt to create a game with the ECS architecture in C. This is mostly a learning experience about what goes into a game engine.

The goal of the project is to make a game similar to Hannah and The Pirate Caves from Neopets. I thought that's a nice game to aim for, plus I have fond memories of it. It is not a full-on remake though!

DISCLAIMER: There is no obligations tied to this project. For all I know, the project can just get abandoned at anytime. I WILL take my time with this project.

Implementation Notes

As mentioned, this is mostly a learning experience, so certain things are implemented for the sake of learning. However, there are certain things that I didn't bother with because dealing with them will open up another can of worms. Either that or I find it too large of a feature to implement on my own without hating my existance. For these, I will use libraries.

As this point of time (24/08/2024), these are the things I won't bother for now:

  • Game rendering: I remember dealing with OpenGL for a little bit and it being a not-so-pleasant experience. This is also a large topic on its own too.
  • Camera System: This is an interesting one. I would really like to implement this. However, this is sort of tied to game rendering, so no.
  • Windows and raw input handling: Not keen on this.
  • GUI: I'm not about to roll my own GUI library for this. I'll do a lite version, but that's about it.
  • Data structures: Will only do it for specific reasons. Otherwise, use a library.
  • Level editor: ... maybe. I already have a sandbox, so maybe I can turn that into an editor lite??? Won't think too much about it for now.

Libraries/Tools used:

  • raylib [link] + raygui [link]: MVP of this project. Basically the backbone of the game. I've use it for some past projects and it's always a pleasant experience. Can recommend!
  • rres [link] : For resource packing. Thank you Ray!
  • rfxgen [link] : For generate SFX. Ray carrying the project...
  • zstd [link] : For compression. I only used this because it looks cool.
  • cmocka [link] : For unit testing. Probably should write more unit tests...
  • sc [link]: For data structures. The library targets server backend usage, so it might not be the most suitable usage, and is likely to be replaced. However, it has been a good experience using this library, so no complaints from me.
  • LDtk [link]: A nice level editor. I haven't use it to its fullest extent, but definitely having a good experience so far.
  • Aseprite [link]: Used it to create sprites. Good tool!
  • Emscripten [link]: For web build. It's really a marvel of technology!
  • heaptrack [link]: For heap profiling. Simple and straightforward to use.

Progress

The engine features:

  • An Entity-Component framework with an Entity Manager + memory pool that is specific for this project
  • AABB collision system + Grid-based Broad phase collision detection
  • Scene tree management and transition
  • Assets management and sprite transition
  • Simple level loading
  • Simple Particle effects management

Current progress:

  • Simple main menu + sandbox scene
  • Player movement
  • Tiles: Solid tiles, water, One-way platforms and ladders
  • Crates: wooden and metal
  • Boulder
  • Chest and Level Ending
  • Arrows and dynamites
  • Water filling
  • Sound Effects
  • Simple Camera Update System
  • Demo level pack loading

Build Instruction

The build instructions are not great, so you might need to troubleshoot a little on your own.

  1. Build and install raylib.
  2. Clone this repository.
  3. mkdir build && cd build && cmake ..
  4. Run: ./HATPC_remake

Depending on you raylib installation, you may need to specify its directory. Use the RAYLIB_DIR variable to indicate raylib's installation path when running the CMake. It is the same thing with LIBZSTD_DIR for zstd library.

cmake -DCMAKE_BUILD_TYPE=Release -DRAYLIB_DIR=/usr/local/lib -DLIBZSTD_DIR=/usr/local/lib ..

You may also turn off BUILD_TESTING to avoid building the tests.

There are also other binaries generated for testing purposes. Feel free to try them out if you manage to build them.

Debugging && Profiling

All binaries except the main one are built with ASAN, which helps to detect memory leakage.

Heaptrack is used to do so for the main program to keep for memory leakage + heap usage. From my experience, it doesn't work with ASAN.

I'm looking for runtime profiler. Current candidates are: Orbit and Tracy. For small-ish gameplay, the program still runs fine.

Note on assets

This repository will not contain the assets used in the game, such as fonts, art, and sfx. However, the program should still run without those. Assets are placed in the res/ directory.