A retro style homage to 80s dungeon crawlers hand crafted in C++.
Find a file
2025-02-21 12:37:16 -05:00
amt The tracy directory now has an experiment in getting Tracy to work. It's _not_ as easy as it is touted to be. 2025-01-19 12:58:05 -05:00
assets Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
magick Some quick hacks that do the seamless texture splits. 2025-01-22 11:14:57 -05:00
scratchpad Now the sprites are rendered in the 3d scene with just SFML sprites. 2025-01-23 11:24:06 -05:00
scripts Did some work checking the build on OSX. Looks like clang 14 is too old, will try later version. 2025-02-13 13:15:23 -05:00
shaders The lighting now uses the original grid based lighting calculations rather than a global single source from the player. 2025-02-11 13:31:39 -05:00
tests Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
tracy The tracy directory now has an experiment in getting Tracy to work. It's _not_ as easy as it is touted to be. 2025-01-19 12:58:05 -05:00
wraps We now have a full map that's basically the same mapping system from Roguish. There's a bug right now where it needs you to move once to calc the light and it's not being centered, but it does work. 2025-02-07 19:32:00 -05:00
.gdbinit My gdb debug thing. 2025-01-13 13:39:12 -05:00
.gitignore First build that actually works. SDL_main errors before but didn't figure out the cause. 2025-01-02 11:47:02 -05:00
.vimrc_proj First build that actually works. SDL_main errors before but didn't figure out the cause. 2025-01-02 11:47:02 -05:00
animator.cpp Tiles now record their textures and this is loaded from the map then converted to an indexed integer on the fly. 2025-01-31 13:37:01 -05:00
animator.hpp Implement a little junk camera on its own that we can use later for movement and views. 2025-02-03 11:08:17 -05:00
ansi_parser.cpp Did some work checking the build on OSX. Looks like clang 14 is too old, will try later version. 2025-02-13 13:15:23 -05:00
ansi_parser.hpp We now have a full map that's basically the same mapping system from Roguish. There's a bug right now where it needs you to move once to calc the light and it's not being centered, but it does work. 2025-02-07 19:32:00 -05:00
ansi_parser.rl Did some work checking the build on OSX. Looks like clang 14 is too old, will try later version. 2025-02-13 13:15:23 -05:00
camera.cpp More refactoring of the gui. Now most things are out of the FSM and MainUI is responsible for the rayvew and its overlay. 2025-02-21 00:50:54 -05:00
camera.hpp More refactoring of the gui. Now most things are out of the FSM and MainUI is responsible for the rayvew and its overlay. 2025-02-21 00:50:54 -05:00
color.hpp I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance. 2025-02-18 01:10:56 -05:00
combat.cpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
combat_ui.cpp Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing. 2025-02-21 03:00:56 -05:00
combat_ui.hpp Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing. 2025-02-21 03:00:56 -05:00
components.cpp You now have blood on your screen when below half health. 2025-02-13 13:15:20 -05:00
components.hpp You now have blood on your screen when below half health. 2025-02-13 13:15:20 -05:00
config.cpp Amit's code mostly converted to use the new texture.hpp but there's an error on line amt/pixel.hpp:472 2025-01-17 11:36:03 -05:00
config.hpp Finished the first pass of moving everything around and cleaning up as much as possible. 2025-01-17 03:45:05 -05:00
constants.hpp Quickly pulled out some of the magic numbers but this isn't the ideal way to configure this stuff. 2025-02-19 08:56:34 -05:00
dbc.cpp Fixed that crash and cleaned up more variables for some study next. I might also try out my debug macros. 2025-01-18 00:44:25 -05:00
dbc.hpp First cut at a replica of the python raycaster. Left side almost works the same but have to sort out math differences. 2025-01-04 12:20:41 -05:00
dbg.h Fixed that crash and cleaned up more variables for some study next. I might also try out my debug macros. 2025-01-18 00:44:25 -05:00
devices.cpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
dinky_components.hpp Fix up the colors and rendering so that tilemap just uses components::Tile all the time. Need to load all of the config data from json one time on system start instead of constantly, although constantly does make debugging live easier. 2025-02-09 15:54:17 -05:00
dinkyecs.hpp Finally get rid of this weird thing in dinkyecs where I was passing a const& to an _integer_ when a copy of the integer is exactly the same. 2025-02-18 11:39:27 -05:00
events.hpp Enemies now turn into a lootable device witha grave_stone sprite so you know they died. Need to implement noclipping on items with collision. 2025-02-19 23:18:33 -05:00
fsm.hpp Trying out an FSM for controlling the main loop. 2025-02-04 00:52:54 -05:00
guecs.cpp Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing. 2025-02-21 03:00:56 -05:00
guecs.hpp Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
gui_fsm.cpp Fix the mouse so that it's discrete and one click means on action. 2025-02-21 12:32:55 -05:00
gui_fsm.hpp Remove some dead functions. 2025-02-21 12:37:16 -05:00
inventory.cpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
inventory.hpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
lel.cpp I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance. 2025-02-18 01:10:56 -05:00
lel.hpp I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance. 2025-02-18 01:10:56 -05:00
lel_parser.cpp New design on LEL that's way more sane and allows for more flexible columns and rows. 2025-02-16 11:50:14 -05:00
lel_parser.rl New design on LEL that's way more sane and allows for more flexible columns and rows. 2025-02-16 11:50:14 -05:00
levelmanager.cpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
levelmanager.hpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
lights.cpp Did some work checking the build on OSX. Looks like clang 14 is too old, will try later version. 2025-02-13 13:15:23 -05:00
lights.hpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00
main.cpp Fix the mouse so that it's discrete and one click means on action. 2025-02-21 12:32:55 -05:00
main_ui.cpp Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
main_ui.hpp Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
Makefile Fix the mouse so that it's discrete and one click means on action. 2025-02-21 12:32:55 -05:00
map.cpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
map.hpp BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail. 2025-02-08 14:03:09 -05:00
map_view.cpp Did some work checking the build on OSX. Looks like clang 14 is too old, will try later version. 2025-02-13 13:15:23 -05:00
map_view.hpp Clean up the GUI some by moving the map_view out into its own file. 2025-02-11 11:37:01 -05:00
matrix.cpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
matrix.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
meson.build Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
meson.options Add the tracy wrap and meson options. 2025-01-18 13:33:45 -05:00
overlay_ui.cpp Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing. 2025-02-21 03:00:56 -05:00
overlay_ui.hpp Intermediate refactor to move everything over to using the textures module rather than everyone using one TexturePack thing. 2025-02-21 03:00:56 -05:00
panel.cpp We now have a full map that's basically the same mapping system from Roguish. There's a bug right now where it needs you to move once to calc the light and it's not being centered, but it does work. 2025-02-07 19:32:00 -05:00
panel.hpp We now have a full map that's basically the same mapping system from Roguish. There's a bug right now where it needs you to move once to calc the light and it's not being centered, but it does work. 2025-02-07 19:32:00 -05:00
pathing.cpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
pathing.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
point.hpp BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail. 2025-02-08 14:03:09 -05:00
rand.cpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
rand.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
raycaster.cpp Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
raycaster.hpp Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
README.md Combat Mode is more reliable now, just one little glitch that it doesn't exit on the last enemy dying. 2025-02-16 18:31:31 -05:00
render.cpp We now have a full map that's basically the same mapping system from Roguish. There's a bug right now where it needs you to move once to calc the light and it's not being centered, but it does work. 2025-02-07 19:32:00 -05:00
render.hpp Have a sort of left gui going but not sure if I like it as a real texture yet. Will need to play with it more. 2025-02-12 14:02:34 -05:00
save.cpp BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail. 2025-02-08 14:03:09 -05:00
save.hpp BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail. 2025-02-08 14:03:09 -05:00
shiterator.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2025-01-30 11:38:57 -05:00
spatialmap.cpp More cleanup of the raycaster, finally removed the window as a dependency but I went against making it an sf::Drawable since that had a lot of code quality problems. 2025-02-04 22:52:04 -05:00
spatialmap.hpp Raycaster now controls the sprite locations with SpatialMap rather than the old way. Quick hack job in main.cpp that shows how they can move too. 2025-02-01 14:39:08 -05:00
stats.cpp Bring in the gnu omni font for text, and rewrite my stats code to use c++ and then use that to calc FPS stats for an FPS display on the left. Debug build gets about 48, release gets about 500fps. Amit's code will probably do even better. 2025-01-18 02:42:41 -05:00
stats.hpp Bring in the gnu omni font for text, and rewrite my stats code to use c++ and then use that to calc FPS stats for an FPS display on the left. Debug build gets about 48, release gets about 500fps. Amit's code will probably do even better. 2025-01-18 02:42:41 -05:00
status_ui.cpp Major speed up in rendering by only doing it when we move, but drawing the rendered 3d view texture constantly. 2025-02-21 11:34:46 -05:00
status_ui.hpp Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
systems.cpp Grave stones are not lootable and give 10 gold. No idea what gold even does. I mean, why _are_ there traders in a dungeon? 2025-02-20 00:30:39 -05:00
systems.hpp Enemies now turn into a lootable device witha grave_stone sprite so you know they died. Need to implement noclipping on items with collision. 2025-02-19 23:18:33 -05:00
textures.cpp Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
textures.hpp Textures and sprites are now managed by a single module in textures.hpp, and even though it is a _single_ location to access all sprites it is NOT a singleton. Those are illegal. 2025-02-21 03:32:44 -05:00
tilemap.cpp Fix up the colors and rendering so that tilemap just uses components::Tile all the time. Need to load all of the config data from json one time on system start instead of constantly, although constantly does make debugging live easier. 2025-02-09 15:54:17 -05:00
tilemap.hpp Fix up the colors and rendering so that tilemap just uses components::Tile all the time. Need to load all of the config data from json one time on system start instead of constantly, although constantly does make debugging live easier. 2025-02-09 15:54:17 -05:00
worldbuilder.cpp Two main GUI elements are placed for the left side status and the bottom combat UIs. 2025-02-12 17:55:21 -05:00
worldbuilder.hpp Game now builds and is using the new dynamic component loading but enemies do not spawn in and device events are really working. Also inventory is a giant bag of fail and needs a rewrite. 2025-02-08 21:16:25 -05:00

The Artisanal Handcrafted Retro-Future "3D" Dungeon Crawler

Welcome to my latest obsession, and turn based dungeon crawler in the style of old school raycasted games like Wizardry, Might and Magic, Ultima, and similar games. The game uses SFML 3.x as it's "cross platform layer" but other than that everything is hand coded by me. It's fully artisinal, created manually, with nothing but a terminal and vim. No LSPs, AI, or anything.

This code is truly a work of art. Like an espresso at that Speakeasy Coffee bar in Brooklyn nobody talks about. You know the one? You don't? Oh sorry, I thought you were cool.

STATUS

Currently it's only officially tested on Windows, but I'm not really using anything OS specific (I think).

Where's the LICENSE?

You don't need a LICENSE that gives everything away to thieving corporations just to publish your works online. Nobody makes artists, musicians, painters, photographers, or sculptors get a license before posting online, so why do programmers need one? You worried you'll get sued? Ok, so just put a disclaimer but why do you also have to give your hard work away for anyone to steal and profit from just so they don't sue you?

You don't, and no matter what the OSI says, nobody can sue you if they steal your code and cause a plane to crash. They would get sued for stealing your code and putting it in a plane, not you. Requiring only programmers to release their code with a license to avoid lawsuits creates a Chilling Effect on programmer free speech and that violates the First Amendment.

So this code isn't licensed, it's copyright by default. I'm publishing it using my free speech rights to express myself and that means you can look at it the same as if I posted a painting or an essay on my blog. I obviously can't sue you for just looking at it and playing the game because I published it so you can, but that doesn't mean you own it. You can't resell it, fork it, nothing.

Just grab the code and play it. That's it. Tell people about it. Fair use says you can even record videos reviewing it and talking about it.

See? That's how Free Speech works. You don't need a LICENSE.

Build Instructions

On all platforms you'll need these components:

  • Meson -- which needs Python.
  • C++ Compiler -- Tested with Clang and G++. You can use my Windows C++ Setup Guide which features an automated installer for Windows.
  • GNU make -- For the convenience Makefile. On Windows you should have this if you used my setup scripts. Otherwise winget install ezwinports.make will set you up.
  • git -- Which should be on almost every platform, and is installed by default with my Windows setup scripts.

Windows Instructions

I primarily develop in Windows using the above setup, so this should work the best. Open Windows Terminal and run these commands one at a time. Don't copy-past bomb this:

git clone https://git.learnjsthehardway.com/learn-code-the-hard-way/raycaster.git

cd raycaster

# ignore the errors the first time
./scripts/reset_build.ps1

# first compile takes a while
make

# this copies the binary so you can run it
make run

After that the game should be running. It'll be in different states depending on how far I've pushed it, but you should at least have a few enemies, some loot, and rooms light in it. Go find them.

Linux and OSX

Linux and OSX have the same requirements as Windows and almost the same install steps. The only difference is that once you get your developer tools installed then you only need Meson. Linux and OSX should have everything else you need or there's a package for it.

Once you have that installed you can run these commands:

git clone https://git.learnjsthehardway.com/learn-code-the-hard-way/raycaster.git

cd raycaster

# ignore the errors the first time
./scripts/reset_build.sh

# first compile takes a while
make

./builddir/raycaster

You don't need make run because Linux and OSX are sane operating systems that don't lock every damn thing a process touches.

Other Platforms

No testing done on other platforms but let me know if you get it to build somewhere fun and I'll mention it.

Development Guide

You can look in the notes.txt file for my informal TODO list of things to fix and make. I'm not really accepting contributions from others, but if you want to follow along then that's what I'm doing.

If you're just starting out in C++ or programming then the project is designed to be readable by someone who knows very little. Every file is small and should be easy to read. I don't use any insane tricks or weird C++ idioms. I also try to avoid too many external libraries so I'll use plain old std::vector and std::unordered_map rather than external libraries that might be faster. This is done on purpose so people (myself included) can learn about the basics of C++ and the STL.

I also don't do a lot of performance tuning or obsession over THE CACHE. Clean, simple, readable code is more important than squeezing 4% performance out of the code. I do however attempt to design things so that it doesn't do useless work because the fastest thing you can do in a computer is nothing. If I can architect away a performance issue and not make the code too complex then I'll do that instead.

That means if you have a suggestion for a micro-benchmark improvement that will dramatically boost performance, but the code is convoluted and hard to understand, then it won't work. If your suggestion is interesting and provides a massive boost then let me know and I'll check it out. But, I would also like statistics that show it's better, not just your word.

Known Bugs

It's early so probably a bunch of bugs.

OSX Build Notes

  • Quite a bad experience. Need to install Python, cmake, meson, and ninja all which are in homebrew but if you don't use homebrew then this is a problem.
  • You need to run the .command script in Application/your python that updates the SSL certs.
  • You have to give iTerm access to your keystrokes...because wtf it already has them?