r/roguelikedev • u/KelseyFrog • Jul 04 '23
RoguelikeDev Does The Complete Roguelike Tutorial - Week 1
Welcome to the first week of RoguelikeDev Does the Complete Roguelike Tutorial. This week is all about setting up a development environment and getting a character moving on the screen.
Get your development environment and editor setup and working.
Part 1 - Drawing the ‘@’ symbol and moving it around
The next step is drawing an @ and using the keyboard to move it.
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
Feel free to work out any problems, brainstorm ideas, share progress, and as usual enjoy tangential chatting. :)
11
u/perigrin Jul 04 '23
I started a Perl version of the tutorial to demonstrate the new object system that just shipped with Perl 5.38.0. I posted when 5.38.0 dropped on the 2nd part 0 and part 1 just now.
I had noticed that a Perl tutorial was missing from the sidebar and the new object system is really clean and neat to show off, so I figured why not kill two birds with one stone.
10
u/usrTaken McGuffin Quest Jul 04 '23
I started going through Rust + RLTK tutorial from the sidebar. I don't know if it was excitement for the event or the amount of material I'm going to have to get through or a combination of them but I went further than I expected.
Here is a GIF of my progress this week and an album of the frames.
I don't know if I'll keep the pace I'm currently going at but I do know that I'll finish.
I can't wait to see what everyone else ends up doing.
9
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati Jul 04 '23
Welcome, everyone, and good luck! The initial announcement has the introductory info if you missed it.
Other notes:
I will start updating the directory at the end of this week*, but if you join in later I can add you then, just post your info in the threads to be included :D
*Normally I would start doing this after the first 24 hours, and expand from there, but this is actually a bad week for me since I happen to be in a place where I don't access to internet most of the week, or much time even if I did :/. As such I haven't been, and can't, put any time into fielding questions etc in the beginning like I've done in the past, but will be more available in later weeks.
8
u/TechniMan Jul 04 '23 edited Jul 04 '23
OK, here we go!
I've been working in Godot. I'm curious to see how others have gotten on. I've gone a bit further already and sort-of covered Parts 0-4 already, as I'm still exploring the best ways to do these things in Godot and figured I'll be spending more time hand-writing some things where the Python tutorial will say "now just call this function that tcod has lovingly prepared for us and that's it, easy peasy", like field of view. I also had some free time this week I may not in the upcoming weeks, so felt it was better to get a bit ahead while I could. Currently implemented:
I tried to get the TileMap to do the field of view calculation for me, as it has some capabilities built in for navigation and occlusion, but I couldn't figure it out. I'm definitely missing something there that might be nice to use; I had a lot of difficulty finding any guides for getting line-of-sight out of it, perhaps because it's not really used like this typically. I could also have been using the wrong search terms; all I found were people having problems with their TileMaps already set up for navigation in the Godot 4 beta client, rather than anyone instructing how to set up navigation for a TileMap. Anyway, in the end, I found an article on RogueBasin explaining how great and quick recursive shadowcasting is, and had a few implementations at the bottom; one of the two Python links still worked, and was relatively simple to convert to GDScript, so I have that for now. I'm pretty sure I understand how it works; just the recursive part was giving me some difficulties, but it was late at night. I'll try to understand it again later, perhaps.
TileMaps! They're pretty neat, huh? My original approach was to spawn a grid of Label nodes displaying the character I wanted, but in last week's comments u/Zireael07 persuaded me to give TileMap another shot and turns out it's not as complicated as I first thought. I have a TileSet, which is just the imported "dejavu10x10_gs_tc.png" split into 10x10 tiles, and the TileMap currently has 4 layers (I've tried using it a few different ways so far). The base layer is the "unseen" dungeon: the whole layer has a 50% grey colour filter, so it appears dimmer. On top of that is the "visible" dungeon: every frame, I clear this layer and add in the tiles in the player's FOV. The next layer is the "entities" layer, so creatures and items will appear on top of the ground; again, this is cleared every frame, and will be filled again with all entities in the player's FOV (currently only the player is drawn here :( so lonely). Finally, the Fog layer; this is all plain black tiles (utilising the "space" character in the tileset) and the tiles in the player's FOV are removed from the tilemap every time the player moves.
Oh, another benefit of the TileMap is that I have easily made the map larger than the window (that is, the window is 8050 characters, and the map is 100100) and it keeps the player in the centre of the map view at all times by moving the map around. An added benefit I like when this happens is the player doesn't know if they're in a corner of the map or an edge, which makes it a bit more interesting and mysterious. Although the ways the corridors connect rooms currently probably indicates fairly well whereabouts you are; I'd like to improve the corridor generation to connect nearby rooms rather than just the previous one in the list. It would just need to complete a network of all the rooms to ensure one wasn't left unconnected! A job for future me ;)
Ah! That's a lot of text! I just got excited about everything I've done and wanted to share all the interesting bits. Again, would love to hear from others who've tried Godot for their thoughts. I'm on the wrong PC now, but I'll edit a screenshot into this post later.
EDIT: Here are screenshots. So many corridors! Very cool, multi-room rooms (these seem fairly common somehow; not intentional, but I like them)!
I remember also that the code architecture so far needs some splitting to multiple files (similar to the tutorial) to make it easier to go through.
8
u/bluesoul Jul 04 '23
Here is a code-along blog following a popular Youtube series for this challenge, covering Parts 0 and 1.
This is my first time really showing this to the public, please let me know if you spot anything wrong or buggy.
6
u/ccc123ccc Jul 04 '23
I'll be doing the Python3 vanilla version per the tutorial.
My git repository: RogueLike2023
I'm really looking forward to this!
5
u/SpottedWobbegong Jul 04 '23
Is the point of virtual environments that the library you install is only working in that environment (tcod in this case)? In that case I wasted an hour because I ended up installing tcod to the main environment too haha. At least I figured out how this works because it's pretty tough with ~0 programming knowledge.
5
u/SelinaDev Jul 04 '23
Hi everyone! I'll be participating in the tutorial. I'll be following it in Godot, and will be doing my best to write up my own tutorials in time so anyone interested can follow along.
If you want to take a look, my code is here: https://github.com/SelinaDev/Godot-Roguelike-Tutorial, and the tutorial for this week here: https://selinadev.github.io/05-rogueliketutorial-01/
5
u/redblobgames tutorials Jul 05 '23
Hooray! I will be joining this year as well. I'm into "fortress mode" / colony simulator more than "adventure mode" games so last year I tried to write Dwarf Fortress in 40 hours, but that turned out to be way too ambitious, and I instead ended up with a chicken simulator.
This year I have another "fortress mode" idea that will require deviating significantly from the tutorial. The player will manage a colony, but won't be able to build new rooms. Instead, the general progression is that you collect resources to claim existing rooms from a procedurally generated dungeon, and use those new rooms to generate more resources. I'd also like some of the rooms to change the way the game plays (e.g. "your dwarfs turn into vampires and no longer eat plants"), but that's a stretch goal.
I've started writing some notes but I haven't started coding yet. Repo
4
u/dopu Jul 04 '23 edited Jul 06 '23
Happy this is finally starting! I went through much of the python3 libtcod tutorial a week ago so I'm feeling confident enough to do a second pass from scratch, using an ECS approach. I'm going to try and keep as much functionality as I can within the ECS. For example, even input handling is done by attaching an InputComponent to entities. This should make it easy to later implement things like mind control spells: want to see what's on the other side of a chasm? The spell will simply remove the InputComponent from the player entity and place it on a nearby bat!
I'll be doing the tutorial in python3 again so I don't get bogged down by language details, but I also considered trying out Go+gruid.
Edit: making my repository public too: https://github.com/jyanar/roguelike-2023
4
u/ccc123ccc Jul 04 '23
Note... In Part 1, my version of tcod issues a deprecation warning:
In line 18 of main.py, I changed tcod.Console() to tcod.console.Console() to get rid of the warning.
Did anyone else get this warning?
4
u/Cool_Fill7231 Jul 05 '23
Just following along with the basic instructions. I recently finished a coding bootcamp and wanted to move onto learning Python next. Here is my Repo: RogueLike
4
u/goose-rails Jul 05 '23
Started a new project Damascene Dream. My challenge this year is to use a hex map. So far, I’ve managed to move my @ around and store the map in a 2d array, albeit with some weird workarounds. I’m following the Red Blob guide (found here). I’m going to make it some kind of open world mech roguelike, but trying not to get too far ahead of myself just yet.
4
u/Llyw Jul 08 '23
i've experimented with a few of the tutorials in the past (libtcod with python, and rot.js in JS and TS), but never managed to be free at the same time as everyone else. i'm glad to be luckier with my free time this year around
this year, i'm following along with thebracket's roguelike tutorial in Rust, using rltk/bracket-lib. for most of these 8 weeks i'll probably just be whittling away at the content and trying not to diverge too much, since it's a really lengthy one and finishing it in time might be a task, but the ultimate aim post-sprint is to strip out the data and existing entities and replace them with my own, using the systems and components as a jumping-off point for a rl of my own
repo is here, creatively named rust-rl, and playable here on my github page, which i'll try to remember to update at the end of each week.
4
u/WheelOfCheeseTurns Jul 10 '23
Hey all! I've always lurked on these tutorials but never participated in one. Later today I'll initiate a godot project and try to see if this can be my first finished project.
With being freshly married and newly re-located, I'm looking forward to see if I'll be able to tackle this!
It is great to see a good amount of people is mentoning GODOT, hopefully this will help to find assistance and insight when I encounter a roadblock.
3
u/avinashv Jul 04 '23
Going to attempt to follow this year in Typescript! I have never used Typescript before, so we'll see how this goes. Completed this week's tasks, but I'll probably try get ahead over the next few days if I have the time.
I am using Malwoden which I stumbled across a while back. It seems to not have any activity, but the essentials seem to be there for getting a project implemented.
GitHub repository with a playable build, design document, implementation notes, etc.
3
u/rebbsitor Jul 04 '23
Just checking in. I'm following the Python tutorial.
The @ is moving around the screen :-)
A couple thoughts:
Overall a good start!
3
u/GrifoCaolho Jul 05 '23
Hello to all of you! I am trying my hand at a Gamemaker Studio 2 roguelike and am here to share the contents of the first week (or, at least, the draft, since I did not have much time to work on it these last two days).
Gamemaker Studio 2 is very welcoming for creating objects, placing'em and moving'em. For the content of the first week, with the sole purpose of getting your feet wet, you need one object, one sprite and one room:
All this said and done, create your player sprite and assign it to your object. You can import an image or edit it inside Gamemaker - do whatever is better for you. I will go for an old school but not ASCII look.
Inside 'obj_Player', add a STEP event and the following code inside:
This checks if the numpad keys 1 to 9 have been pressed and move accordingly. Now, all you need to do is open 'Room1' and drag a copy of 'obj_Player' inside it. Press F5 to playtest and move to your heart's desire. That's it. It is done.
Anyone with any ammount of experience on any programming background knows that there is much, much more to it than what is above, but the code above serves the purpose of getting your feet wet. It is part joke, part serious. I will be updating this on friday with a real set up, more guidelines, code, comments, screenshots and the like. But for now, if you want simply to draw a character on the screen and move it, that will work.
2
u/Kalaith Jul 05 '23
Havn't done any code for awhile so jumping back in, surprised how rusty I was with week 1 doing it in unity 2d, for no other reason then I dont like python and have no other languages I want to learn right now. no unity/c# tutorial, ill likley follow the python to hit the milestones.
week 1 progress character is moving around, camera is following along need to find a nicer spritesheet
week 2 topic, but I think im going to go with rooms are generated and locked in when visited, with no limit on the number of rooms, so the coding challange will be not accidently locking myself into a corner so there is no room for another room, if I know the room im in will lead to a dead end, it needs a door or two to the open space.
2
u/mrdoktorprofessor Jul 05 '23
I'm going to follow along this year at my own pace - unfortunately somehow I always fizzle out towards the end due to work but will try to get there. I've done the Python tutorial several times so wanted to branch out a bit.
Something I've always wanted to make was a multiplayer RL. This year I'm going to try to get a prototype working using Flask for the backend (and so that I can make use of
tcod) and basic JavaScript/HTML5 on the frontend.I'm deviating significantly from the gameplay loops/architectural decisions made in the main
tcodtutorial just to get things in place. Plus I wanted to see how my ancient knowledge of client/server architecture flies in a game environment.Right now I have a basic demo up and running that just uses local memory - stretch goals would be to get something like redis or SQLite running for state management. JavaScript handles the drawing and user events - all logic is handled server-side (e.g., pressing
jjust sends amoveDowncommand). Game state is updated every second and updates are sent back to the client. Right now I'm only sending enemy/player info - figured that sending the map every tick would be too much.Dev is only local for now until it feels that it is in a good enough state to share the code, but the idea would be that anybody could run a server if they wanted to.
But, here's a gif of it working so far - my plan for this week is to either get the enemies attacking or an inventory system in place - depends how my week goes :D . Hot pink is you, green are other players, E are enemies that will either randomly move or follow the closest player. When a player goes dark they are meditating and still exist but aren't a part of the game until they resume motion.
Since this is now a real-time system I thought a nice end around would be that players can "meditate" to pause their efforts to sit back and think. Something like this probably needs a cooldown to avoid abuse, but it was either that or have gamestate be updated whenever anybody makes an action and I could see that being abused as well.
Near-term goals:
Long-term goals:
2
u/[deleted] Jul 05 '23 edited Jul 05 '23
I posted a little bit ago about learning to make roguelikes and it was pointed out to me that this was starting up! Good timing.
I'm following the tutorial linked to in here and it's working, but I have a few questions from those who understand what's happening better.
1.) The whole Optional thing is kind of weird and confusing to me. I looked around a bit and what I think I'm getting out of it is that it essentially is a NULL. So we're saying - here's an action variable, it may contain these types of actions that we'll look for, or it could just be "empty" or "null" in which case there was an event we don't care about. Is this on the right track?
2.) I think I understand the event thing; but I'm curious if there's a place to view the source code for all these libraries that I'm importing. I did a google search and mostly just found a GitHub page, but GitHub does nothing but absolutely confuse me. I'd like to look into tcod.event to see what it looks like and what exactly I'm Overriding with my code.
3.) Importing - is there a reason we don't just import the entire library/file when we import? Like for tcod, we import the whole thing in the main file, but only the event in the input_handler class. Also when we import our own files (actions and input_handler) we specify what methods we want from it. Is the overhead that these file add, not worth just importing them entirely for ease of use?
4.) **added this one after posting** I wanted to make sure I understand the whole drawing to screen thing. It appears that root_console.print is placing whatever we want into the x, y value of some sort of buffer in the background and then when we context.present it, we're saying "now draw all of the crap we've put here on the screen" and then the root_console.clear() is clearing out that background buffer and the screen is just presenting whatever was last pushed into it. This way when we update it for the next draw, everything is cleared out and we just need to re-put everything based on the game state?
I think that's about it. I worked out how most of it is working based on what the code seems to do!
At this point, what do people do with this follow along? Work on another language to see what they can do? Play around with it to modify it as a sort of 'side-project'? It doesn't take very long to get the code in and running, but each step is taking about a week here, so I'm curious what I should do with it in the meantime!
I've noticed many people here uploading to GitHub so people can look at what they're doing and what not. Is it worth trying to figure it out? I've got an account that I used when I was looking into website development, but I never really understood it and so I never really used it. Seems I'd just make a second save of my file and put it in another folder if I wanted to make sure my working code was backed up.
2
u/Rakaneth Jul 05 '23
After a long hiatus from playing with roguelikes in general, I'm back!
Here is my entry, with Week 1 finished!
2
u/Cool_Fill7231 Jul 06 '23
Upon completion will there be any instructions, or direction towards instructions, as to how we can compile this into a program that people can just download?
2
u/SpottedWobbegong Jul 06 '23
Okay, I finished part one and it works. I mostly understand conceptually what I'm doing, but parts of the syntax confuse me, plus all the functions prewritten that I don't understand makes me feel a bit weird.
Syntax questions:
action: Optional[Action] = None
key = event.sym
I don't get why is key = event.sym. Can't we do tcod.event.KeyDown.sym, and key = event? In fact I can do that because I tried it and it works but I don't understand why.
I guess I'll spend the rest of the week poking through the event and context modules, see if I can understand it better.
2
u/Rehpotsirc0615 Jul 06 '23
Hi all, I'm going into this as someone new-ish to coding/Python (I've made a tiny RPG in it), and I'm having issues installing tcod. Whenever I use the "pip install tcod" command, I get an error at the "getting requirements to build wheel" step, telling me that I need Microsoft C++ Build Tools first. I'm trying to do this on a computer with an ARM processor (not at home so I can't use my "main" computer) and trying to install the build tools tells me it could make VS Code slow or unusable. Is there a workaround or would my best bet be waiting until I get home to start following the tutorials?
2
u/Kanomus_37 Jul 07 '23 edited Jul 07 '23
Hey there, I was stuck in a certain position a few days before, then I tried debugging, but couldn't fix it, then I had to stop for a few days for m exams, and now I am coming back to see this, so maybe this is the correct place to ask this again?
context
So I'm still having this problem. I did print the events, and it seems like the program is detecting all the keypresses correctly, but it is not executing any of them. I tried usng breakpoint(), but this post was the first time I ever heard about breakpoint, so I still do not understand how to use it inside the game loop (If I have to do so)
So I tried modifying the escape part of input_handlers to say
So now when I run the program and press esc, I get theis in the console
(the 8s are there to hide info) Then I press c and enter, and it goes to a new line and that's it, it doesn't do anything beyond that, it looks like it is taking forever to process what comes next and simply isn't able to do so
What can I do now? Does this look like a known problem or do I need to look deeper. If so, how may I do it?
2
u/Alnilam_1993 Jul 07 '23
Is there a way to scale the console programatically? I can drag the lower-right corner and get the console to scale up, but is there a way to do that by code?
2
u/tsun_screen Dark Relic Jul 08 '23
I'll be joining along in Unity/C#! - (github)
I've got a bit of a foundation already as I've been remaking a roguelike I worked on a few years ago. Originally was doing it in C++ with SDL2, but I found I was doing more enginedev than gamedev, so it never really made it beyond some basic features (short vid of where it was at)
I've now got something else going in Unity. Only have basic movement, doors, and FOV dealt with, but I'm intending on following along with the TCOD tutorial as a nice way to pace some other features out, and will post progress along the way
For the time being though I've given my tileset a needed refresh (before+after pic).
2
u/teesel Jul 09 '23
Working on Clojure version with based on RLTK (Rust) tutorial. It's built on the top of Clojure2d library. I took fonts from The Ultimate Oldschool PC Font Pack.
Player can be moved, game loop is based on Clojure2d state workflow. First steps made :)
2
u/SilverDirewolf Jul 09 '23
I am trying to follow along with Godot, and have been mostly following random youtube tutorials, such as "Godot 4 Crash Course for Beginners - GameDev 2D Top Down Tutorial" by Chris' Tutorials.
I have a roguelike in my head that I'd love to make, but is more complicated and time consuming so I'm starting with a simpler version for this.
I'm planning on doing 16x16 pixel characters for this, mostly using the Oryx Design and Deep Dive Game Studio assets. I have my character moving about and colliding with walls at the moment, and that's about it!
https://imgur.com/a/g2mhoXA
2
u/OwenLeaf Jul 09 '23
Just finished weeks 0 and 1 and working ahead on week 2! Unfortunately, after following all of the steps up to modding main.py with the new engine class (exactly as written) I am now getting some errors.
The screen tries to open and immediately closes, and I get the following:
I'm just not sure what is missing here as I am quite new to all of this -- seeing an error in the console file has me vexed.
2
u/matzieq Jul 10 '23
So my initial plan was to follow the Python tutorial to get a high level overview on how to do things, and the RLTK tutorial to see what Rust is all about. I have weeks 0 and 1 done in Python, no issues there. But the RLTK tutorial seems to be teaching me mostly how to use black boxes. This might be okay, but it's not how my brain works, I need to know HOW an ECS works, not how to use a library to create one. Thus I'm a bit stuck on how to proceed. I have a weird fetish for vanilla C, so maybe I'll go with that. I also really like lua, so maybe I'll go with Love2D. Or maybe I'll try to learn a bit about Rust and then try to implement things my own way, using something like Raylib or just SDL2. Or maybe, just MAYBE I can convince my ASD/ADHD brain to stick with RLTK&Specs just to learn enough to be able to fly on my own afterwards. We'll see.
Anyway, here's my repo with tutorial code so far:
https://github.com/matzieq/CavernsOfRemembrance
2
u/AndreaPollini Jul 11 '23
I'm diving into Rust and creating a roguelike game using macroquad.rs. With macroquad.rs, a simple and powerful library, I can focus on learning Rust and implementing the game's features. I'm streaming the development process live on Twitch, which makes the development funnier and more engaging.
I've a github repo for the project: https://github.com/ProfAndreaPollini/roguelike-rust-macroquad-noname
2
u/TitiMoby Jul 11 '23
During my weekly Twitch session, I made a news on this tutorial.
And this week, people asked I try it so I did.
I'm happy to see where it goes and I will share everything in a repository and as much as possible during my Twitch sessions in french.
repository: https://gitlab.com/TitiMoby/roguelike-tuto
replays : Week 1: https://youtu.be/ljYfT4XtvA8
2
u/TripleSeven__ Jul 11 '23
Giving this a shot with a new project Spelunker - done in C# w/ SadConsole and RogueSharp. Repo here: https://github.com/connor-lennox/Spelunker
1
u/Original-Nothing582 Jul 07 '23
I'm having difficulties installing TCOD
1
u/Ornery_Goat_5444 Jul 20 '23
Where can i find these tutorials? Very new dev here.