r/roguelikedev • u/KelseyFrog • Jul 11 '23
RoguelikeDev Does The Complete Roguelike Tutorial - Week 2
Congratulations for making it to the second week of the RoguelikeDev Does the Complete Roguelike Tutorial! This week is all about setting up the map and generating a dungeon.
Part 2 - The generic Entity, the render functions, and the map
Create the player entity, tiles, and game map.
Creating a procedurally generated dungeon!
Of course, we also have FAQ Friday posts that relate to this week's material
- #3: The Game Loop (revisited)
- #4: World Architecture (revisited)
- #22: Map Generation (revisited)
- #23: Map Design (revisited)
- #53: Seeds
- #54: Map Prefabs
- #71: Movement
- #75: Procedural Generation
Feel free to work out any problems, brainstorm ideas, share progress, and as usual enjoy tangential chatting. :)
25
Upvotes
•
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati Jul 11 '23
After returning from my trip, over the weekend I finally had a chance to compile the initial directory of participants with links to your repos and other info, and will continue to maintain that throughout the even as people post and update their projects. Simply posting a repo in the weekly threads gets your project added.
So far this year we have 34 declared participants in my data, 18 of which have public repos now listed in the directory. It looks like this year we also have a few new tutorials in progress, which is great! Any tutorials completed at (or even after) the end of the event will be added to the sidebar. Good luck!
12
u/SelinaDev Jul 11 '23
I have already uploaded Part 2 of my Godot 4 tutorial version: https://selinadev.github.io/06-rogueliketutorial-02/
Still working on Part 3, but the code is already up on my GitHub repository for anyone interested: https://github.com/SelinaDev/Godot-Roguelike-Tutorial
10
u/joke_LA Jul 12 '23
To those following the tcod tutorial in Python3:
If you have the latest version of numpy library you'll get an error during part 2 because
np.boolno longer exists.As the error message suggests, you can simply replace
np.boolwithbool- here are the relevant lines from tile_types.py (and any instances of this in future chapters will also need to be updated):9
u/SpottedWobbegong Jul 11 '23
I try to do stuff myself, like I read what we are going to do and try to do it on my own. It works pretty well and I already grasp classes a lot better than the cursory knowledge I had before. Finished the Engine class, tomorrow I will modify main.py to use it.
8
u/TravisVZ Infinite Ambition Jul 11 '23
Every year this comes up, and I say "This looks fun, but maybe next time I won't have too many current projects." Yesterday I said "Screw you!" to my current projects, and started working on this!
Game: Swords and Runes
Language: Rust
Engine/library: Bevy
Sprites: Kenney
Repository: https://github.com/Kromey/swordsandrunes
I completed parts 0 and 1 yesterday, and today have begun working on the map. The tilemap plugin I was planning to use hasn't been updated for Bevy 0.11 yet, but there's a branch that seemingly works that I can use; nevertheless, the plugin appears to be way more complex than what I actually need, so (for now) I've decided to just mimic its approach but otherwise handle the tiles myself. Not the first time I've done this, though previously it was for technical reasons (needed a sparse tilemap that didn't allocate memory for "empty" tiles at all in order to handle a very large potential area, but no available plugins do this).
6
u/howtogun Jul 11 '23
Okay, week 2 we are actually doing stuff now. Started on basic BSP dungeon and about to code up the Entity class in Unity.
6
u/[deleted] Jul 11 '23
Current
Didn't post last week, following along (somewhat close at least) with the tutorial in C++. Attempted this last year but fell off due to moving about halfway through. Unfortunately I also deleted the local repo from last year, so cannot pick up from where I left off.
I have the walking @ symbol and dungeon generation. I made the dungeon generator described here, which I really like the look of. Im sticking with just arrow keys / 4 way movement, and I've found the long twisty hallways in this can be somewhat unpleasant to walk through. I added in the Dijkstra auto-explore as described here to get around that and am happy with the results. I used this FOV code from RogueBasin.
Repo
5
u/mrdoktorprofessor Jul 11 '23 edited Jul 12 '23
Managed to keep up progress with mine! This week I turned all my prototyping code into actual objects, added a basic item and inventory system, and started getting all of my objects ready to handle multiple dungeon levels.
Here we have a player snagging apples (something that can be seen by anybody connected and on that level).
I also started publishing my progress to my website, which is something I've never done before and am hoping it will be the impetus to keep working on it: https://efredericks.github.io/rldev-2.html
Stretch ninja edit - added a basic UI.
Double edit - repo
5
u/Gogodinosaur Jul 11 '23
Cthulhu Crawl | C# + Unity | GitHub
Last year I made a hexagonal grid based game using Unity and C# (gogodinosaur.itch.io/hex-caverns). There my goal was to learn about how to implement hexagonal pathfinding, field of view, etc.
This year I want to try to bend the game more towards a theme. I choose a Lovecraftian theme to base the game and mechanics around.
Currently, I've worked ahead a bit and finished part 6. So far the only theming I've done is add cultists and demons rather than orcs and trolls as in the tutorial. I want to also change the mechanics to reflect the theme, not just the names. To do so, I'm debating on having the player be Cthulhu or other horror that goes around and makes other creatures and cultists go mad ... more design is needed.
For the art, I'm using a tileset from kenney.nl. I'm using a monochrome version of the assets and then recoloring the sprites during gameplay using the Witching Hour Palette from lospec.com/palette-list/witching-hour.
5
u/perigrin Jul 11 '23
I just posted Part 2 of my Perl port of the Roguelike Tutorial. I have Part 3 ready, but I'm going to post it on Thursday just to spread things out a little.
5
u/Llyw Jul 11 '23 edited Jul 11 '23
rust-rl repo is here, and it's playable here on my github page.
i wasn't sure if i should write at the beginning of weeks about everything i did in the previous week, or at the end of the week. i thought posting right at the end of the week would be bad for discussion since chances are, nobody would read it. so here we are.
week 1
i'm following thebracket's tutorial with bracket-lib and specs, and managed to crank out all of section 1 this week. i thought about stopping and going along with the weeks in the libtcod tutorial, but i had a lot of free time that i wont have in future weeks, so i went ahead with whatever i felt like. and i think it'll be more interesting to see where i end up diverging each week into making my own thing, rather than just how much of the tutorial i can write verbatim, so it works out there too. the sooner i can follow the tutorial's engine groundwork the sooner i can get on with trying out my own ideas
so speaking of diverging, last week was mainly 4 things:
subsequent weeks will be a lot shorter than this, because my schedule is packed, but that's why i went so hard in this first one! i'll come up with a name eventually
5
u/usrTaken McGuffin Quest Jul 12 '23
Week 2 was a good week while not a lot done code wise I started thinking of what I wanted to do after the event was done.
I did finish both the 2.8 Items and Inventory and 2.9 Ranged Scrolls/Targeting chapters from the tutorial.
The planning I did over the week was mostly the story/motivation of why the player would be delving into dungeon. I ended up coming up with the player being a medieval delivery guy that has to go into dungeons and find the "McGuffin" that somebody wants. I'll probably implement a quest log/system eventually to keep track of what item and who wants it.
Week 2 progress album
GitHub Repo
4
u/goose-rails Jul 11 '23
So, last week for Damascene Dream I started with a hex map but after getting movement and map storage working, I quickly abandoned the idea in favor of the traditional square grid. Personally, it’s much easier for me to code with x/y than q/r/s, and I don’t think a hex map brings anything to the table that a square grid with diagonal movement can’t.
That said, I’m a little behind after reworking the map, but I’ve got a large-ish open world and I’m currently working on generating multi-room buildings to explore.
4
u/Rakaneth Jul 12 '23
repo
I've finished most of what I need to complete Week 2, with just a bit of refactoring left. I've decided to work in branches and merge when the week's tasks are fully complete, so my current progress is still under the
week2branch.I need to figure out how best to store maps in the
tcod-ecsWorldand prevent the player from phasing out of bounds. I'll consider Week 2 finished when I complete those tasks.4
u/SilverDirewolf Jul 12 '23
I've not had much time to do actual development and I think in general I'm not sure how closely I'll be able to follow the weekly topic, but I'm hoping to atleast finish at the prescribed time.
I'm working in Godot, and I've also wanted to take a slight step back and learn the engine itself a little better. Luckily, Clear Code recently uploaded an almost 12 hour Ultimate Godot 4 tutorial, so I have been putting that on my second monitor when doing other work and it's been fantastic so far. I've already got decent hobbiest Python knowledge, so GDScript seems really familiar. Really excited to find some time to really get into MAKING the game!
For Dungeon Generation, I've been really wanting to do Wave Function Collapse for my bigger RogueLike and it seems like a well documented plug-in was added two weeks ago. So perfect timing. I'd been fairly daunted with trying to code it myself. I haven't had time to play around yet. It seems to allow for prefab sections too, which is great.
Also been making some "concept art" in MidJourney to get a better sense of the game feel I'm going for and maybe a placeholder main screen.
So not too much game stuff to report yet, but thought it was better to post early in the threads life!
4
u/TechniMan Jul 12 '23
Godot / Unnamed / repo
I was technically a bit ahead last week in terms of features, so this week I've been focusing on cleaning up the architecture a bit and have moved things more in line with how the code of the tutorial has laid out, e.g. Map only being responsible for the map, moving general bits to the Engine, and moving my input logic to Actions and EventHandlers! I originally was following along from memory, but reading through the tutorials a bit more closely I can see how it will expand from these foundations.
I had a go at improving the way tunnels are generated: first by having each room connect to its nearest unless it was already connected to that room, but it often ended up with some rooms in their own little graphs separate from the others; then I tried it so that a room creates a tunnel to its nearest, then we start from that room to create a tunnel to its nearest, each time removing that room from the pool available to connect to, which guaranteed all were connected but turned the dungeon from "maze" to "circuit" - there was only one route all the way around! Bit boring. I'll have another go with it in the coming weeks.
3
u/Gondram Jul 13 '23
Longtime lurker, first time actually doing this event. In the first week I blew through the entire tutorial. I intend on redoing/changing things each week to match the current topic. This week I created a custom Inconsolata tileset to use and am currently working on an updated dungeon generation algorithm.
I just put the [repository](https://github.com/Gondram/roguelike) up. It isn't anything remarkable yet, and likely won't get there, but I have some big ideas. We'll see if I can make them happen.
2
u/SpottedWobbegong Jul 13 '23 edited Jul 13 '23
A question, before we added the Engine class to Actions and implemented the out of bounds check, I could walk off the map in any direction except towards the bottom and right where it crashed out with an error. What's the reason for this? My guess is some value can't be negative, but why is it only towards the bottom and right it crashes?
2
u/TitiMoby Jul 14 '23
I’ve got time to do part 2 and I plan to do part 3 this week end or on Monday. Everything is streamed and replays are available : https://www.youtube.com/playlist?list=PLZoekfjBpp3VmZ09XozNovyerAykQwMGK
A Git repository contains my progress is published : https://gitlab.com/TitiMoby/roguelike-tuto
2
u/redblobgames tutorials Jul 16 '23
I'm making slow but steady progress on my project. I'm making a colony simulator instead of a traditional roguelike, so I'm adapting the topics to fit. This week:
Part 2 - generic entity, render functions, map - instead of rendering a map around the player, there is no single player character, so instead I implemented scrolling and zooming with the mouse. I thought it would be easy but I ended up with a bug that took me longer than I'd like to admit to fix. Because I'm making this work on the web, I wanted to adapt the rendered size of the map to fit the screen size. I had made it work on my regular screen size, but it worked for the wrong reasons. Two wrongs made it look like it was right. But it was still wrong. Now it's right. I also added zoom with the scroll wheel, something I hadn't looked into before. The
wheelevent is the thing to capture, not the similarly named but now deprecatedmousewheelevent.I don't yet have a generic entity but that's next.
Part 3 - generating a dungeon - unlike games like Dwarf Fortress and RimWorld, I'm going to generate a dungeon and then let the player unlock a room at a time. But that means I need a dungeon generator. I'm using the offgrid algorithm from Chris Cox. It works by taking a square grid and moving the walls around a little bit. It's around 20 lines of code. For debug visualization, I assigned a random color to each room.
The next step was doors. I had previously written a door placement algorithm that finds tiles between two adjacent rooms, but I went with something simpler. The offgrid algorithm starts with a square grid. I used the neighboring rooms in that square grid to decide which rooms should be connected. These adjacent rooms share a wall so I picked a random position along that wall. The rooms are too connected for a dungeon adventure but I think it's the right level of connectivity for a colony simulator.
Whenever there are two choices to make, I'll try to pick the simpler one. Last year I realized a colony simulator is a lot of work, and I didn't get very far. This year I'm trying to simplify simplify simplify. I need to keep the scope down if I'm going to have a chance of finishing.
2
u/joke_LA Jul 17 '23
Hello!
This is my first time doing the tutorial. I'm following the python tcod one: here is my repo with part 3 done currently. It's basically identical to the tutorial code so far except I'm using 8-way movement with the numpad keys.
I am mainly following along for coding practice, but if I get inspired and if time allows, I may try to add my own stuff later.
Thank you to the mods for hosting this event and HexDecimal for maintaining libtcod!
1
u/matzieq Jul 18 '23
I'm not very fond of the RLTK tutorial so far. It delves into the explanation of some things in deep, and then glosses over other, more difficult things. It mostly shows you how to use stuff from an external library, not how it actually works. In the chapter on generating a dungeon it suddenly says "we've refactored into multiple files, see the sources for this chapter" - and the files include the changes made in the chapter, making it unnecessarily harder to follow along.
My repo, just in case anyone wants to take a peek, is https://github.com/matzieq/CavernsOfRemembrance. It's not very interesting, as it's pretty much word for word the code from the tutorial.
In the unlikely case you're wondering about the title, my idea for the game is inspired by the very niche indie tabletop RPG "Maze of Memory" - you wake up with no memories whatsoever in a dungeon full of weird stuff and lovecraftian science fiction, and as you go you recover "memories" of who you were previously - a blacksmith, an archer, a space marine, an engineer - whatever. This is similar to what modern roguelites do, giving you "runes" or whatever they call them at the end of a section, replacing a leveling system. I like starting out completely blank, as you don't have to spend a lot of time over character creation, pondering over systems you have no idea about, and I like the idea of recovering memories, as it could add an interesting narrative to the game. I'm also thinking about an elder scroll-ish system of "learning as you do" for normal skills.
However, I'm not sure about Rust. I'll go through with the tutorial, and it looks like the later chapters contain a treasure trove of information about procedural generation and the like, but I'll probably remake it in some other language and only use the info from the tutorial as guidelines.
1
u/avinashv Jul 19 '23
Super late! Going to have to catch up with Week 3 as well.
Pretty simple sailing here, though I was disappointed to find that Malwoden's built-in BSP generator seems to be a bit buggy (or not documented well enough for me to find a solution)--the
createSimpleHallwaysfunction doesn't do anything?I have continued to update my weekly implementation notes.
Repository | Play | Notes and Screenshot