r/roguelikedev • u/KelseyFrog • Sep 16 '26
RoguelikeDev Does The Complete Roguelike Tutorial - Week 7
This week is all about adding game progression and equipment.
Part 12 - Increasing Difficulty
Deeper dungeon levels become increasingly more difficult! Here we create tools for dealing with chances and making them vary with level.
For the final part of our tutorial series, we'll take a look at implementing some equipment.
Of course, we also have FAQ Friday posts that relate to this week's material
- #11: Random Number Generation(revisited)
- #36: Character Progression(revisited)
- #44: Ability and Effect Systems(revisited)
- #56: Mob Distribution
- #60: Shops and Item Acquisition
- #76: Consumables
- #77: The Early Game
- #78: The Late Game
- #79: Stealth and Escaping
- #80: Determinism and Randomness
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. Next week we'll have a final discussion and share our completed games. If you have made it this far congratulations! You deserve it! :)
5
u/redblobgames tutorials Sep 17 '26
Playable on web, GitHub repo, no writeup yet.
Most times I've participated in this event I deviated too much from the tutorial, and wasn't able to finish. This year I decided to limit my scope. I am following the game design and interface (mostly) but I am going my own way with three goals:
Goal 1: Use a table data structure with a spreadsheet interface.
This worked quite well this week. Part 12 didn't interact with the table data but Part 13 did. As I described last week, I am storing locations in one place in the table, and then building indexes on the side to look things up quickly. Equipment is just another location.
{type: 'held', by: entity_id}the location{type: 'equipped', by: entity_id, slot: 'armor'|'weapon'}.equippedlocation. If anything is already in that location, it is moved out before moving another item there. This is similar to map locations that can have only one actor object.{type: 'equipped', by:entity_id, slot: ANY}finds everything equipped by entity_id.Goal 2: Learn the Jujutsu version control system.
I'm enjoying it, but I'm also creating and then cleaning up messes that I would never even try to do in git. For example I went back to Part 0 and changed ROT.js from separate files to a bundled file. And then I propagated that forward to Parts 1–12. I'm finding it hard to track these types of changes, and one thing I want to do after this project is over is to try to wrap my head around this way of working.
Goal 3: Embrace Javascript features.
There were two ways I took advantage of Javascript not distinguishing objects and classes.
One is that I used prototype inheritance to have the
fightercomponent be both at the prototype level and the entity level. I don't copy the component data into each entity like the Python tutorial does. I store it once in the prototype ("class"), and then all the trolls share the troll fighter component, all the orcs share one, etc. But the player entity has its own because you can increase the values when leveling up.The other place is that I've been building singleton objects that have methods instead of creating a class that I instantiate once. I only need a "class" (prototype) if I want to have multiple objects sharing data or methods. But there are a lot of places I only needed one of something, so I didn't need to create a class.
4
u/mariobadr Sep 18 '26
C and SDL3 | repo | play in browser
Incomplete: parts 11, 12, 13
So um... can I have an extension?
Still 1.5 weeks behind. But that means that now save/load is working! It even works in the web browser (thank you, SDL3). But man, that was a doozy. So much code for just basic serialization/deserialization. No thank you to C. And then managing/versioning save files. Yuck. Definitely not my favourite part of gamedev.
One thing that I have done is extract/develop my "personal gamedev libraries". They existed before this project, but now they're actually somewhat battle-tested. If you want to take a look, I've separated them into a
libs/directory (all the roguelike-specific stuff is insrc/). The most recent one is the graphics library, where I refactored out the tileset and console drawing from the game.At some point along the way, I added a camera, which now follows you around so that the dungeon can exceed the size of the map viewport. And, for some reason, I decided to implement the object pool pattern for actors and items. This (along with using handles) basically made save/load even harder.
Perhaps if I had just set out on what the tutorial did, I wouldn't be so behind. I don't suppose there's another post for this in a week's time? In any case, I had lots of fun! Thanks for reading (and playing?)
2
u/Admirable-Evening128 Sep 18 '26 edited Sep 21 '26
Update with a link to the demo added -
Playable (3d) demo: https://xok.dk/other/chimera/dist/index.html
(controls are still the same, so G to get, U to use, I for inventory, D to drop and so on.)
("2026RT")
I'm a bit lost for direction, wondering what to do next.
I already have difficultiness/scaling up; the other 'new' thing would be equipment/gear,
but the game is already designed with its (magic) items in mind;
adding gear that was not intended in the design is just (gilding the rose, or lipstick on a pig, however you choose to view it..)
For giggles, I have stuck three.js with animations on top of the existing game (as a totally optional thing; it just becomes a different renderer).
It is surprisingly playable/'feasible'.
The main thing it rests on, is simply to exploit unicode emojis to make simple billboard sprites on top of the letter monsters.
I will see if I get to updating this post with links to a playable demo;the basic gameplay remains the same for three.js, so there is not really anything new in it.Depends on what I get around to doing for this week's effort.
It has still been fun though!
2
u/norpproblem Sep 19 '26
damp dungeon (raylib + c#) | repo | screenshot | inventory | video
Scope creep is a real dastard. Primary missing features: saving/loading, descending deeper, and any real sense of gearing. Underlying framework for descending and gearing are theoretically there. Saving and loading is likely not happening; I have done it in the past, but frankly, it seems exhausting to try to complete for this project here. I will try looking into it and messing with it, but the game is tiny in gameplay and concept so it doesn't feel necessary.
In more positive news, I've implemented (nested) inventories, item pickup/dropping, and item use. We have a health potion that heals! Additionally, we have projectiles - you can throw a corpse and it'll collide with any other entity and hurt it, or throw a health pot to heal whatever it strikes.
While my systems are developed, content is absolutely languishing. I hope to add in some more meaningful, fun content before the end of the event, but even if I don't, this has been a lovely experience to work on. Thank you all for being here!
2
u/leomartius Sep 20 '26
Roguelike #4 | Rust | repo | Unlicense
I guess I’m a bit late for this one!
Anyway, I’ve got some code from earlier this year that I’ll try to clean up and publish for posterity (which means me, next year).
2
u/Fearless-Meal-1951 Sep 21 '26
C, SDL3/libtcod and libuv | Demo
I'm afraid this is the week that breaks my little frankenstein experiment.
Loading a new level seems trivial, but if your database is the source of truth and the client is a mirror this completely breaks.
The Good:
The Bad:
reddis pubsub pattern, in essense it is trivial. you have messages going back and forth and you create a channel as identifier. What is supposed to listen to those channels and what publishes on those channels becomes incredibly hairy. I had to mutate the database on basically every operation because it now needs to inform subscribers of that change, this seems fine but this means every mutation of the database results in O(N) overhead instead of simply setting a value. Works but not scalable and it made the database code 'ugly' in multiple places. The reason this pattern being so invasive is because we need to know the before state and after state. I think if i redo it, i keep the pubsub contained to the query layer and do additional parsing, get some overhead on the parsing, extend mutations to also keep it's before state. So setting a value would then be ESET <table> <entityID> <property> <oldValue> <newValue> which works for the database, but as a CLI query this is akward.
The ugly:
Part 11: Up until now I got away with a hack for representing map data, We have a fixed set of entityID's reserved and the tile table stores these tiles. they basically walk up their prototype chain to get the archetype/prefab and that is what is rendered. When we join the game we get a giant "sync" for all entities and it works, kind of... Client side data would stay client side and not persist, such as visibility, which means when you save -> load all this client data disappears.
The main reason I went bust on this part is the 'single source of truth'. The database stores everything atm, adding a new level is not as simple as just loading more data because the gameplay logic assumes it can iterate over everything ECS style. Now I can keep hacking onto this, by for instance:
- Completely wiping the database every level which would mean a persistent "mmo" style game is impossible, what you did last turn our last floor is completely gone, unless i filter the wipe on things I want to keep, which feels like just another hack on top of a broken system
- I could make all tiles re-generate client side since I made the RNG deterministic but this would mean everything needs to be procedural, no custom rooms, nothing you do matters you play a level and endlessly keep doing that with some meta progression that is saved like exp and level.
- generate an entityID for the floor, insert links for every tile where floorID "contains" tileID, this works for getting the shallow client mirror, but still lacks off-loading no longer updated data.
All this is fine for the tutorial and roguelike, but for the goals I had in mind it isn't...
The proper solutions would be in part 10 our database should offloads things to disc in chunks. the database then only holds the "hot" path aka what is currently needed by the game and with a proper pub sub system the player would then subscribe to specific chunks. This would keep the ECS style performance on the server (process what needs to be processed in large continuous arrays) and have a shallow mirror for the clients. This does not completely solve it, representing terrain/map data in a database is really not a good fit, but writing a parallel system next to it just felt like a complete hack, the entire protocol breaks, so need to do custom wiring in that layer etc..
Nothing that can't be fixed, but it is simply too much work for the weekly sprints and I keep falling further and further behind. Ultimately, my perfectionism and overambitious side-goals once again have gotten the better of me. I will most likely keep playing around with the architecture to find my 'golden goose' and who knows if people like the wall of text ill even write a post about it :)