r/roguelikedev • u/KelseyFrog • Jul 26 '22
RoguelikeDev Does The Complete Roguelike Tutorial - Week 5
Congrats to those who have made it this far! We're more than half way through. This week is all about setting up items and ranged attacks.
It's time for another staple of the roguelike genre: items!
Part 9 - Ranged Scrolls and Targeting
Add a few scrolls which will give the player a one-time ranged attack.
Of course, we also have FAQ Friday posts that relate to this week's material
- #7: Loot(revisited)
- #32: Combat Algorithms(revisited)
- #40: Inventory Management(revisited)
- #60: Shops and Item Acquisition
- #76: Consumables
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)
44
Upvotes
5
u/Henrique_FB Jul 27 '22
*looks at people doing the tutorial, remembers that I've tried it 7 times and failed 7 times already*
*sigh* here we go again
2
u/Calango-Branco Jul 26 '22
Where and how can I see the other parts?
9
u/Gogodinosaur Jul 26 '22
I went on vacation, so now I'm a week behind. I still need to implement pathfinding. Mainly making this post to keep myself accountable.
7
u/littlesnorrboy Jul 26 '22
GitHub | Playable demo
I have actually began the tutorial last year, but abandoned it around week 4. I'm using mostly Rust and a sprinkle of Svelte for this project, not for any practical reason, I just wanted to use these technologies.
I'm using game-icons.net icons for rendering.
This project serves mostly as a test bed for my ecs implementation. Since I use an ECS, the code will look very different to the tutorial, but I'm trying to follow it to some extent.
I'm still not quite done with Part 9. AoE consumables are still missing.
The game also has a sword item with a passive bonus to melee attack. Currently all the swords in your inventory stack, so you can get pretty OP if you're lucky. I'm planning to add an equipment system instead, so you can equip 1-2 weapons at most at a time.
My plan is to finish part 9, implement item dropping, then add an initial equipment implementation.
7
u/cordinc Jul 27 '22
Parts 8/9 in vanilla Javascript with Rot.js: Github and a playable version
After last week, I started this week's tutorial sections early over the weekend, but they weren't as time-consuming.
Realised the program uses non-standard keys - for anyone trying it:
6
u/Southy__ Jul 26 '22 edited Jul 26 '22
Github | No release build this week.
I went totally off script this week and basically finished the entire Tutorial, woops!
I also did some major refactoring.
I realised that AsciiPanel was going to be too restrictive for my post tutorial rendering needs, and that SDL2 would be perfect, but I don't want to re-write the entire game in C/C++ (I hate working in C++!). The Java -> SDL projects are all dead, so I wrote my own custom JNI layer that uses SDL2 for rendering and event handling, so I was able to keep all of my game logic in Java and only need around 150 lines of C++. I will need to add to the rendering layer over time but hopefully will be able to keep it as simple as possible.
One downside of this change is that I have lost my cross-platform capabilities, I was unable to get SDL2 on OSX to function through the JNI bridge, so the game is Windows only for now.
In terms of the game itself I mostly completed the tutorial, I didn't implement the EXP system as I will be going for a system similar to Cogmind where you assign stats as you use stairs, I also removed the inventory, as I am planning on having no consumables and you don't get to carry equipment around with you, the player will need to choose very carefully which equipment to use going through the game as you can only take what is in your equipment slots. I also implemented the basic version of my equipment and levelling systems.
I implemented a health regen system, where after N turns of not being in combat your HP starts to regen, also a little UI widget that shows the In Combat status and turns till you are out of it, this regen system will be used for Mana and Stamina as well.
I started work on a system for having items/item sets/enemies described in text file formats loaded on game launch, in the fullness of time I will create a little GUI tool so I can edit these more quickly.
I will try and add some screenshots and gifs to this post at some point to show all the stuff I have implemented.
I have plans for:
6
u/mrdoktorprofessor Jul 26 '22 edited Jul 26 '22
Still going with mine, albeit a bit more slowly. I diverged a bit from the tutorial and focused on adding a simulated controller and fixing up the dev aspect so anybody can clone and try without needing my hardware setup.
Also I made the repo public to join in the fun. It's not release ready, but cleaned up a bit. Type hinting is sporadic and there are some leftover code smells I'm sure, but fixable.
Also reduced my map size to 64x64 to make the minimap easier to show. This made me realize I borked up my BSP (most likely in the transition from lists to numpy arrays) so I'll be fixing that. Screenshot of exit off map - there are also disconnected rooms in other runs as well. Shouldn't be a hard fix.
Next up, map fixing, items, and text.
6
u/EmuInteresting8880 Jul 27 '22
Hey everyone, I had a late start to this so I'm only on part 3 or 4 (or 5 I'm kinda jumping around sporadically), but you can find my work on my personal website projects page. I had posted about an open source roguelike framework here last week and I am still continuing development.
So far I have basic world / level generation, a console / command line interface, a world / grid display, an information display, player controls, basic title sequence /main menu, and more.
If you are interested in my progress so far, check out the dev log on my website and if you're interested in contributing to the project checkout the GitHub link you can find there as well.
6
u/bodiddlie Jul 27 '22
Made good time on part 8 yesterday and today. This one was pretty fun to piece together. I'm seeing a lot of places I'd like to de-OOP and make more functional, but I'm wanting to stay as close to the original tutorial as possible and maybe do a follow-up series where I refactor things that I don't like as much. GitHub for the complete code of part 8, and then my blog post for the tutorial.
5
u/JasonSantilli Jul 26 '22
Repo | Playable
JS + rot.js
Finished part 10, saving and loading. I'm not too happy with how I got it to work. Serializing and de-serializing an instance of a js class is fine, re-adding each mixin and the state of each mixin after de-serialization was ugly. I'm sure there's a better way to do it that can make the code for defining a mixin and adding a mixin to an entity cleaner.
Check out my mixins here, and the part of the load function that sets the proper mixins for a loading entity here. Open to ideas if folks have them. I don't think I've seen another game using mixins like this with saving/loading implemented.
5
u/codyebberson Jul 27 '22
WGLT + TypeScript
Github
Part 8 PR
Part 9 PR
Playable demo
The main challenge this week was paying down technical debt, because I had resisted the
EventHandlerabstraction. So I went back and caught up. Quite elegant in the end.I went off script with how callbacks are passed to
SingleRangedAttackHandlerandAreaRangedAttackHandler. The JS function references would not be serializable. Instead, I allow theActionto be incomplete. The input handlers accept the partialAction, assign thetarget, and thenperformthe action. I think this should work ok when we introduce serialization.This week also revealed a couple bugs in WGLT, notably broken
VK_NUMPAD_ENTER, and the box drawing utility clobbered the characters inside the box.4
u/WorksOnMyMachiine Jul 28 '22
Huge week for my rust repos. 1 in bevy and 1 in specs. I want to preface this by stating I usually have mutiple projects running at once to stop myself from burning out on 1 project. Each project has its own unique tools and with that, the challenges that come with trying to adapt my game to them.
To start off, my bevy branch was almost completely stalled. I want to use the Bracket-Bevy plugin that u/thebracket wrote, but it still needs a couple of nudges to have to production ready. Right now I am using the bevy-ecs alongside bracket-lib for the rendering. It works great, but I cannot wait for the stageless RFC to finally merge so that turn games in bevy get much much simpler.
Specs was the heavy hitter this week. Ported over my effects system and particles system and its working great. Now i just pop an effect on the queue and let it do its thing. Makes dealing damage, applying particles, you name it so much cleaner and easier. I even broke out a good bit of source code into their own workspaces. Rust workspaces rock!
Pyrrouge was not touched this week since I am already ahead of the tutoral
Bevy Github | Specs Github | Python Github | WGLT Github
3
u/stevenportzer Jul 29 '22
Playable
Parts 8 and 9 didn't really require any new features from the engine I'm working on, so this week went relatively quickly. I'm not super happy with the item use code since it's kind of messy, so maybe I'll want to rework some stuff later to clean that up, but for now it at least works.
I did end up porting my custom message templating language from my other project and rewriting the parser since I wasn't happy with the previous implementation. That wasn't strictly required, but it did get all the case handling for stuff like "You attack the orc" / "The orc attacks you" / "The orc attacks the troll" out of the game logic and into a more concise separate file, so that's nice.
There's no shortage of nice to have and clean up work I could continue doing, but I don't know how much of that I'll get to this week.
3
u/makraiz Jul 29 '22 edited Jul 29 '22
I haven't posted an update in awhile, so here it is:
My orignal approach really wasn't working for the Rust version, at least not on my slower machine, so I decided to rewrite it from the beginning, but this time following along with Herbert Wolverson's Specs/rltk tutorial. I am still using bevy, for everything I can, and using bracket-lib (identical to rltk) for algorithms & rng. As a result of the rewrite and some personal drama, I am pretty far behind having just completed part 5 and working on 6. Repo
I have given up on the Python tutorial for the time being, but I may pick it up again once I get caught up with the Rust version.
3
u/redblobgames tutorials Jul 30 '22
I'm attempting a "fortress mode" style game. For Part 6 instead of combat I worked on the friendly ai. Right now they're just chickens. I added hunger levels to the chickens. When they're well-fed they'll roam around randomly. When they're hungry they'll walk to the closest food and eat it. They'll eat any food they find along the way too.
I had been displaying plant growth using colors but that made it hard to tell when the plant is edible. I added some red berries to the plants to make the inedible and ripe plants look very different.
Playable version with notes ; source repository
I didn't get far last week, and I felt bad about that for a while, but then I reminded myself: no big deal. Part of the problem is that I think I don't have a clear idea of what I need to do, and that's slowing me down quite a bit. I need to write down my near term goals and break them down into really really small things to work on. Once I figure out what to do with rooms/stockpiles, I think it'll be more clear what I want to do with NPCs (other than chickens). Part 8 and 9 for me will be rooms and pathfinding.
2
u/[deleted] Jul 31 '22
Still here working through slowly with Zig! I am a bit behind just got done with part 6 path finding and basic AI. Ran into my first big roadblock with Zig to C interop and it was with a simple libtcod printf function. Ended up writing my own basic console printer in Zig that internally calls the libtcod put char function (single char at a time). Figuring this out will require a bit more research (has to do with C function argument types of string literals). Check out the part 6 readme in my repo if you're interested in the details.
Obligatory repo link and an updated screenshot of a dead orc :)
2
u/HexDecimal libtcod maintainer | mastodon.gamedev.place/@HexDecimal Aug 02 '22
GitHub | Playable
Many UI selectors in the C++ tutorial are functions which don't return until the user picks an element. These are not valid in Emscripten and I had to do more refactoring than I expected to get them working. The solution to this involves using callbacks to pass delayed information around like the newer Python tutorial does, but the garbage collection in C++ is less forgiving than in Python so I have to micromanage how variables are bound to lambdas.
In the end it feels like I just barely got through the week. A lot of my inventory management is sub-par and I didn't do any of the extra features I've wanted yet. The only thing I've really added was stackable inventory items.
2
u/ChizaruuGCO Aug 03 '22 edited Aug 16 '22
I got burnt out producing videos, so I took an extended break!
Part 8 is complete. The video on it should hopefully be out later tonight/tomorrow.
Edit: Part 9 is complete!
Series: YouTube Repo: Github
1
u/reuben-john Aug 10 '22
This week was very different in Hands on Rust than the tutorial. I'm still behind but am hoping to have a chunk of time to get caught up again.
Github and playable game.