Exploring raycasters and possibly make a little "doom like" game based on it.
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 7186c2ecb0 I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
amt The tracy directory now has an experiment in getting Tracy to work. It's _not_ as easy as it is touted to be. 3 months ago
assets I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
magick Some quick hacks that do the seamless texture splits. 3 months ago
scratchpad Bring over the dbg.h to see if it's usefule. 3 weeks ago
scripts After some prototyping I have what I think I want for the map. Just a simple piece of paper you take out that has the ASCII map on it. 4 weeks ago
tests The reload mechanism for shaders is a bit better, but still to make them unique. 15 hours ago
tools Added a screen size parameters to the fragviewer. 4 days ago
tracy The tracy directory now has an experiment in getting Tracy to work. It's _not_ as easy as it is touted to be. 3 months ago
wraps Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system. 4 weeks ago
.gdbinit My gdb debug thing. 3 months ago
.gitignore A bit more cleanup to avoid duplicate testing and to separate the GOAP algorithm code from the little AI Manager thing. 1 month ago
.vimrc_proj First build that actually works. SDL_main errors before but didn't figure out the cause. 3 months ago
Makefile I can now apply shaders to any GUI element, but I need a shader manager that will allow for hot reloading and tracking input/output variables. 2 days ago
README.md AI now follows the A* algorithm more closely by using a separate priority queue from the open_set. 2 weeks ago
ai.cpp Initial battle engine is now integrated in the systems so now I can finally get the turn based combat to work the way I envision. 1 week ago
ai.hpp Initial battle engine is now integrated in the systems so now I can finally get the turn based combat to work the way I envision. 1 week ago
ai_debug.cpp Gave up on trying to get the GOAP algorithm to correctly apply the cost structure to competing choices, and instead I take the resulting action list and simply find the next best one based on cost. 2 weeks ago
ai_debug.hpp Gave up on trying to get the GOAP algorithm to correctly apply the cost structure to competing choices, and instead I take the resulting action list and simply find the next best one based on cost. 2 weeks ago
animation.cpp Fixed some of the easing functions but still not sure with RAT_GIANT doesn't move. 4 weeks ago
animation.hpp Basic Ritual crafting UI is prototyped, so next step is to create some items and refine the UI with a possible FSM to keep it organized. 4 weeks ago
autowalker.cpp Converted almost everything to use wstring so that it works better with SFML and the unicode/utf8 usage in the system. 3 weeks ago
autowalker.hpp Converted almost everything to use wstring so that it works better with SFML and the unicode/utf8 usage in the system. 3 weeks ago
battle.cpp Added in a new art for a 'gold savior' and refined the battle engine more but it's not quite what I want. 1 week ago
battle.hpp Added in a new art for a 'gold savior' and refined the battle engine more but it's not quite what I want. 1 week ago
boss_fight_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
boss_fight_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
camera.cpp Lots of dumb little edits to sort out what I'm aiming at. I'll next clean out most of this in a refactor. 1 week ago
camera.hpp Lots of dumb little edits to sort out what I'm aiming at. I'll next clean out most of this in a refactor. 1 week ago
color.hpp I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance. 2 months ago
combat.cpp Started working on this 'arena tester' tool that would let me load an enemy and test them, but then realized I could just make it so I can spawn enemies in the game. I'm keeping the arena around as it will be useful later as a scriptable testing tool, but for now just spawn and test. 2 weeks ago
combat_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
combat_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
components.cpp Created a nice utility library for doing animations, and used it in the ritual crafting UI. 4 weeks ago
components.hpp Map is way better and components::Tile is _vastly_ improved by switching to a wchar_t on display and letting nlohmann::json auto convert it for me. 3 weeks ago
config.cpp Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system. 4 weeks ago
config.hpp Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system. 4 weeks ago
constants.hpp Shaders now are managed by a manger that can do hot reloading and it also will detect a bad shader and use an ERROR shader so you know it's busted visually. 1 day ago
dbc.cpp AI engine is working and I have a little BattleEngine going but the AI is working better than it should in systems.cpp. Need to find out why then make the BattleEngine avoid running entities that have END in action lists. 3 weeks ago
dbc.hpp Brought line numbers back for the dbc.cpp logging stuff. May not work in clang because of the bug they have (had?). 4 weeks ago
dbg.h Fixed that crash and cleaned up more variables for some study next. I might also try out my debug macros. 3 months ago
debug_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
debug_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
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. 2 months ago
dinkyecs.hpp Enemy AI is now prototyped and can find the player and attack them. 1 month ago
easings.hpp Fixed some of the easing functions but still not sure with RAT_GIANT doesn't move. 4 weeks ago
events.hpp Converted the buttons to reflect the actions you can take. 7 days ago
fsm.hpp Trying out an FSM for controlling the main loop. 2 months ago
goap.cpp This does a 'fit_sort' whenever the state is changed. fit_sort effectively sorts the actions by distance+cost so that the cost is actually present unlike the original algorithm. 2 weeks ago
goap.hpp Mostly fixed up but I have to figure out why cost on actions isn't changing the priority. 2 weeks ago
guecs.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
guecs.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
gui_fsm.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
gui_fsm.hpp New debug_ui that shows perf data, other debug info, and allows spawning enemies. 1 week ago
inventory.cpp AI engine is working and I have a little BattleEngine going but the AI is working better than it should in systems.cpp. Need to find out why then make the BattleEngine avoid running entities that have END in action lists. 3 weeks ago
inventory.hpp Inventory and lighting improved, now to get ready for going down a level and that's most of the game loop working. 2 months ago
json_mods.hpp Can now mark json/components with std::optional and then they can be null/false to disable them. 1 month ago
lel.cpp A simple A* pathing function that works on maps, but I'll be changing it to do the GOAP pathing. 1 month ago
lel.hpp I now have a semi-functional GUI system that uses the ECS style to build gui elements rather than inheritance. 2 months ago
lel_parser.cpp Fixed up dbc.cpp so now just use it everywhere. I next need to find a way to pass that to format automatically. 4 weeks ago
lel_parser.rl Fixed up dbc.cpp so now just use it everywhere. I next need to find a way to pass that to format automatically. 4 weeks ago
levelmanager.cpp Started working on this 'arena tester' tool that would let me load an enemy and test them, but then realized I could just make it so I can spawn enemies in the game. I'm keeping the arena around as it will be useful later as a scriptable testing tool, but for now just spawn and test. 2 weeks ago
levelmanager.hpp Started working on this 'arena tester' tool that would let me load an enemy and test them, but then realized I could just make it so I can spawn enemies in the game. I'm keeping the arena around as it will be useful later as a scriptable testing tool, but for now just spawn and test. 2 weeks ago
lights.cpp Wasn't even using MAX so changed to just a simple BOOST variable that can become a config. 2 months ago
lights.hpp Wasn't even using MAX so changed to just a simple BOOST variable that can become a config. 2 months ago
main.cpp Shaders now are managed by a manger that can do hot reloading and it also will detect a bad shader and use an ERROR shader so you know it's busted visually. 1 day ago
main_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
main_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
map.cpp Refactor the Map::neighbors so that it's part of pathing where it should be. 2 months ago
map.hpp Better structure on the autowalker, but still gets stuck in some combat situations. Next is after we kill everything we head to the exit. 2 months ago
map_view.cpp Fixed the map so that it shows directional arrows instead of a compass. 1 week ago
map_view.hpp Fixed the map so that it shows directional arrows instead of a compass. 1 week ago
matrix.cpp Autowalker is now using the GOAP AI system and works way better. Still quite a lot of jank in the code but that'll get removed over time. Next thing is being able to detect when its near an item/enemy and properly react. 1 month ago
matrix.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2 months ago
meson.build Shaders now are managed by a manger that can do hot reloading and it also will detect a bad shader and use an ERROR shader so you know it's busted visually. 1 day ago
meson.options Add the tracy wrap and meson options. 3 months ago
mini_map.cpp Fixed the map so that it shows directional arrows instead of a compass. 1 week ago
mini_map.hpp Fixed the map so that it shows directional arrows instead of a compass. 1 week ago
overlay_ui.cpp New debug_ui that shows perf data, other debug info, and allows spawning enemies. 1 week ago
overlay_ui.hpp New debug_ui that shows perf data, other debug info, and allows spawning enemies. 1 week ago
pathing.cpp Figuring out something weird about the Pathing::random_walk code. 1 month ago
pathing.hpp Figuring out something weird about the Pathing::random_walk code. 1 month ago
point.hpp BROKEN: Big refactoring happening, so it compiles but game does not run and the tests fail. 2 months ago
rand.cpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2 months ago
rand.hpp Now have a simple stats test. 4 weeks ago
raycaster.cpp The reload mechanism for shaders is a bit better, but still to make them unique. 15 hours ago
raycaster.hpp Rayview now uses the shader manager. 1 day ago
ritual_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
ritual_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
rituals.cpp Rework the source so that battle is in its own thing to work on. 1 week ago
rituals.hpp Rework the source so that battle is in its own thing to work on. 1 week ago
save.cpp Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system. 4 weeks ago
save.hpp Did a full code coverage review and improved many of the tests and a bunch of code. I'll do one more final walk through all the code before getting back to work on the new combat system. 4 weeks ago
shaders.cpp Reworked the way shaders are configured to reduce the amount of times clicks on buttons cause the shared shaders to reset. 6 hours ago
shaders.hpp The reload mechanism for shaders is a bit better, but still to make them unique. 15 hours ago
shiterator.hpp Brought over a bunch of code from the roguelike and now will use it to generate a random map. 2 months ago
sound.cpp Boss fight looking better, but I need to get this bounce animation in the main game fights. 2 months ago
sound.hpp Boss fight looking better, but I need to get this bounce animation in the main game fights. 2 months ago
spatialmap.cpp Performance check showed that I was checking every sprite even if they're way far away so now just do ones near-ish. 2 months ago
spatialmap.hpp Performance check showed that I was checking every sprite even if they're way far away so now just do ones near-ish. 2 months ago
stats.cpp Fixed up dbc.cpp so now just use it everywhere. I next need to find a way to pass that to format automatically. 4 weeks ago
stats.hpp Now have a simple stats test. 4 weeks ago
status_ui.cpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
status_ui.hpp I think this is the best I can do for a hover vs. click shader effect. Just do it in a shader based on a uniform setting. 4 hours ago
systems.cpp Added in a new art for a 'gold savior' and refined the battle engine more but it's not quite what I want. 1 week ago
systems.hpp Fixed the map so that it shows directional arrows instead of a compass. 1 week ago
textures.cpp Fixed how sprites/textures are loaded so tehy default to frame 0 of any multi-frame textures. 1 week ago
textures.hpp Level traversal works better now, compass is accurate, and direction is maintained when you traverse. 2 months ago
tilemap.cpp Map is way better and components::Tile is _vastly_ improved by switching to a wchar_t on display and letting nlohmann::json auto convert it for me. 3 weeks ago
tilemap.hpp After some prototyping I have what I think I want for the map. Just a simple piece of paper you take out that has the ASCII map on it. 4 weeks ago
worldbuilder.cpp Started working on this 'arena tester' tool that would let me load an enemy and test them, but then realized I could just make it so I can spawn enemies in the game. I'm keeping the arena around as it will be useful later as a scriptable testing tool, but for now just spawn and test. 2 weeks ago
worldbuilder.hpp Inventory system basically works now but is in a alpha hack stage. Time to refactor. 2 months ago

README.md

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 GCC 14.2.0. 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.
  • Ninja -- Meson uses this to do builds on most systems.
  • 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/zedcaster

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.

Linux Build Notes

Libraries Needed:

  • libxi-dev
  • libfreetype-dev

It uses c++ so you may need to install a libg++ or libc++ for your system. Usually this is all you need:

apt install build-essential

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?