r/roguelikedev • u/aaron_ds Robinson • Jun 22 '20
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(V2)
Create the player entity, tiles, and game map.
Part 3 - Generating a dungeon(V2)
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. :)
EDIT: Updated the post to include V2 tutorial links. The version 2 links are being written in parallel with the RogelikeDev Does The Complete Roguelike Tutorial this year. If you would like to follow the v2 path you'll benefit from the latest libtcod has to offer. Your patience is appreciated when parts of the tutorial are edited and updated possibly retroactively as the v2 tutorial is being vetted.
2
u/IrishWilly Jun 25 '20
I'm a little confused with the timeframe. I thought each 'week' was actually a day for this jam, it's listed as a 10 day jam.
10
u/Captain_Kittenface Forcecrusher Jun 23 '20 edited Jun 24 '20
Just finished part 2 of my attempt at a rewrite of the tutorial in Javascript with a focus on using an ECS architecture. Part 2 is a bit of a beast as everything gets a refactor to use the ECS lib geotic. Trying hard to keep pace. Still feeling good about it :) EDIT: Part 3 is now up
tutorial: https://github.com/luetkemj/jsrlt
project: https://github.com/luetkemj/gobs-o-goblins
9
u/TStand90 Jun 23 '20
Parts 2 and 3 of "Version 2" are now up. Big thanks to /u/HexDecimal for all the help.
Unfortunately, we did change quite a lot of Part 1 after it was published, so anyone who followed along with that last week will basically need to redo it all. This was because I didn't check the latest tcod methods and used outdated parts of the library. Part 1 has been updated to use the newest methods, so it should be a more solid base to build the rest of the tutorial upon. Apologies for any inconvenience.
We're going to try and avoid any major rewrites like this after publishing in the future, but I can't guarantee that it won't happen. There also might be some small mistakes in the text of the tutorial itself, as it's being published for the first time. I appreciate everyone's patience as we create this new version, which will hopefully be a better tutorial in the long run.
5
u/underww Jun 23 '20
C++/SDL/WASM
For generating a dungeon, I used an uncompressed version of this algorithm. You can play demos in your browser.
5
u/Silvernocte Jun 24 '20
Week 2 of the revised python tutorial is Complete. I'm actually super grateful that part 1 had drastic changes, because now it looks a lot more like nice python than disguised C++. Also, had some issues with the Bresenham lines, but it turns out that that was because my tcod library was a bit old.
Unfortunately, I'm currently useless at doing anything beyond the scope of the tutorial so far, but at least I understand it all. Oh, and I changed the npc character. Marvel at my creativity.
4
u/jp-amis Jun 23 '20
Following some tutorials to understand better some stuff from C# and got dungeon and player movement.
Will work this week on doing some refactoring (things I would do differently from the tuts) and start adding some sprites to make it prettier and get the motivation going.
work so far
https://imgur.com/aJ8AfRf
https://imgur.com/7YwBJ2B
4
u/usami33 Jun 23 '20
I borrowed an algorithm from here and here to implement three types of dungeons
1 2 3
In addition, I changed the movement method of the actor from momentary movement
gif
It's been a week so quickly, so I'm a little impatient
4
u/kairumagames In the House of Silence Jun 23 '20
Temple of Time
A traditional roguelike where time advances with every step you take.
repo
playable build
Got the basics up and running since last week. It's not much more than a maze game at this point but the groundwork is there. I'm looking forward to adding time-based mechanics such as NPC aging and growable plants.
On the subject of map generation, it would be good to set a minimum number of rooms since it seems like the algorithm used in the libtcod tutorial doesn't seem to allow for that (not that I read it that intently :P). You can add minimum number of rooms if you bound the rooms' random x and y coords to never overlap. For example, in my game a map will always have at least 4 rooms since I made sure the first 4 rooms could only be placed in each corner of the map with no overlap. If you don't then you could theoretically get a really unlucky seed that would generate a map with only one room.
4
u/offlebagg1ns Jun 23 '20
Haven't used python before so decided to follow along with the Python+Libtcod tutorial. Got a little carried away last week and burned thru the first 11 parts...
Not sure what setting/direction I want to take my roguelike in but I have a few ideas floating around:
Anyway, here's my repo (still like 80% copy/pasted code for now):
https://github.com/offlebaggins/Roguelated
4
u/blumento_pferde Jun 23 '20 edited Jun 23 '20
Ok, I have to admit I am currently a little bit confused about the different versions of libtcod's Python bindings and the different tutorials:
Unfortunately the second one is being updated *as of now* by u/TStand90 but seems to really change stuff (using the newly introduced optional typing stuff and introducing additional classes), but at the moment does just include step 0 and step 1. On the other hand the original tutorial throws now lots of deprecation warnings, which might be rather confusing.
So should we follow the old or the new tutorial?
Don't get me wrong, I appreciate the effort by u/TStand90 and u/HexDecimal for providing the tutorial and updating the libraries which they obviously do voluntarly and for free, but we may have a little bit of a bad timing right now, if the tutorial is just being rewritten *right now* and libtcod's Python API being rewritten ...
Anyway is it recommended to do the old or the new tutorial?
4
u/Obj3ctDisoriented Jun 23 '20
So Ive been a busy bee this week.
Repos:
Swift/TCOD:
code: http://github.com/maxgoren/codealong2020
tutorial: http://maxcodes.info/tutorial/
C++/BearLibTerminal:
code: http://github.com/maxgoren/codealong2020/CppVersion
tutorial: http://maxcodes.info/tutorial/bearlibtut.html
Perl (console && CGI versions):
code: http://maxcodes.info/PerlRogue.pl
Status:
The swiftTCOD tutorial is completed through part 3, and part 4 will be completed this afternoon and posted accordingly. The Swift TCOD tutorial is available Here
I also started writing a tutorial for those who want to use C++/BearLibTerminal.
The C++ & BearLibTerminal tutorial is completed through level 3, and is available Here
And last but not least, after jokingly making a reference to it, here is the code for
up to level four in... Perl! http://maxcodes.info/perlrogue.pl
after writing the Perl version, i got to thinking, and i'm working on a Web App version using Perl/CGI. Nothing much done there yet except displaying the map and a non function interface. Thats also up in its very rough state on my site: Rogue 404
as always, much love.
-Obj3ct
1
u/introsp3ctive Jun 23 '20
Okay I'm really confused. Part 2 in this post is linking to the part 2 from last year. I just updated a whole bunch of my code and realized after the fact that it's all code from the 2019 tutorial. Am I missing something here?
1
u/Commonguy356 Jun 25 '20
Hey, I just noticed that the code from the first part is... different? Last week the font used was arial, but now it is dejavu. I think I will re do the first part so that my code is allright with the upcoming parts. I dont feel as competent developer so if I get errors I will probably not figure out what is the case. Will post updates when I get through all of this weeks parts.
3
u/Ombarus @Ombarus1 | Solar Rogue Jun 22 '20
Sweet, I managed to finish the video for this week on time ! https://youtu.be/QBmv1F7t5j0
I'm still trying to improve the editing. It's quite a bit different from my usual video somehow but it's fun to follow along!
3
u/enc_cat Rogue in the Dark Jun 23 '20
Week 1 went out smoothly (but then again, I had that part of the code ready).
I managed some small improvement over the main loop, which is probably the trickiest part of using Cursive (my TUI library of choice). Movement still doesn't feel butter-smooth, and it might get worse as I add more content and features, but it's good enough for the moment.
Here is an Asciicast of the result: https://asciinema.org/a/342001
Week 2 will be more challenging. I have already a decent BSP algorithm inherite from other projects, but I am still unsure if I should use that or one more similar to the one adopted by the TCOD tutorial. For learning's sake, I will try implementing the TCOD algorithm anyway and decide later.
3
u/zaimoni Iskandria Jun 23 '20
Part 2 was completed June 19th.
Part 3 has not fully landed yet. The intended procedural generation for "Outlaw Castle Rya'cho" is limited (think final stage for the interior will be binary space partitioning); the current generation technique works by calculating the correct position of all of the outer towers and corridors from the northwest/top left tower, then drawing everything at once. I'm missing a few terrains and map objects (most notably, the artesian spring and the waterwheel).
3
u/stevenportzer Jun 23 '20
I did parts 2 and 3 on Sunday (image, play online). It's using a different rooms and corridors algorithm from the tutorial that isn't based on anything in particular but generates a branching structure that sometimes connects back on itself to form cycles.
I haven't decided yet if I want to start working on FOV, go back and clean up or optimize existing code, work on more abstract engine stuff for a bit, or take a break and wait for week 3.
3
u/revokon Jun 23 '20
My Repo
I just finished part 2 this morning. Things went pretty well, although it took me a while to figure out how to organize the render functions. Eventually I decided to just let any render-able object just draw itself, using the Zircon
GameAreaobject.I've also decided to add unit tests to the project. From what I've heard they aren't always used in game dev, but I come from the academia and business world where the importance of testing is really hammered into you so it felt wrong to keep them out.
Next week, I feel like part 4 is going to be a major hurdle, because since Zircon doesn't include FOV algorithms or the like, so I'll have to roll my own.
3
u/nocountryforseanpenn Jun 23 '20
Got started earlier this week, I love Kotlin so I'm following along using this really great tutorial https://hexworks.org/posts/tutorials/2018/12/04/how-to-make-a-roguelike.html by Hexworks
3
u/demiskeleton Jun 24 '20
Finished Week 2 in Godot: my dungeon is a bit wonkier though probably just need a tweak of a variable.
lucky for me python and gdscript are pretty much the same. the tricky part is treating tiles and characters as sprites that exist as nodes and referencing them to the engine scene calling to my movement node and gamemap node vs the master engine.py in tutorial.
3
u/jonathanbrodsky Jun 24 '20
I think I'm finally settling on rust - I was pretty frustrated with build times, but I managed to get them down to about 8 seconds, which I can live with. Hopefully they don't go up too much, or I can figure out ways to keep them that low.
So far I'm just copying the rust roguelike tutorial pretty closely, except I did build an implicit defined terrain heightmap, and did some simple lighting based on estimated normals from that. I think I want to try shadow casting next, but optimally I will do a deferred, multilight approach. Hopefully the low resolution combine with the fact that rust is fast will let me get a bunch of shadow casters in the scene.
here is a screenshot of my lit terrain: https://imgur.com/a/Bv5t2El
3
u/squizm Jun 25 '20
GameMaker2 Roguelike
Finished this week by using cellular automata (poorly) to create a forest and added animated movement between tiles. You're also now able to bump into trees to chop them down to help in moving around the map.
repo: https://github.com/squizm/RLDev_2020 GIF: https://imgur.com/a/8ToRgJg
3
u/candyleader Jun 29 '20 edited Jun 29 '20
Having real trouble with my pico-8 entry this week. I think it's mostly down to 1-indexed lists and 0-planning planning. Slowly getting there though! Hopefully I'll have something to show before tomorrow!
Right here we go!
https://lefishy.github.io/picorl2020/
https://github.com/lefishy/picorl2020
I tried to record my work this time to post a little sped up "bad programming" video but in the end my incompetence got the better of me and it ended up being several hours long before editing and split across 3 or 4 sessions.
I've gone for a method of generation that I call "stacked tiles" where you have a stack of rooms that you collapse until there are none left piled up. It's kinda ok but not great. For basic gen it'll do fine. Once we get to adding some detail to the rooms (i might do this ahead of time) it'll get more interesting I'm sure.
2
u/lagdotcom Jun 23 '20
(demo, repo)
Following the tutorial fairly closely, but I decided to make it a bit more... Beatle-y. Note that you can change the font back to the default arial10x10 one because this one is a bit harder to read.
2
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati Jun 23 '20
Welcome to week two! So far we have 44 participants with repos, and nearly that many declared participants following along without one. Keep updating on your progress (or post for the first time if you haven't yet!) and I'll be picking up any new info and sometimes sharing screenshots on Twitter :)
2
u/stevebox gridbugs Jun 23 '20
I just published part 2 and part 3 of my rust+chargrid tutorial (starts here). Code for the tutorial is here, organized into branches that correspond to small milestones, several per tutorial part. I'm following in lockstep with the python tcod tutorial, so I just finished off dungeon generation. Here's a screenshot!
2
u/endperform Jun 23 '20
I'm basically just following the tutorial for now to get a feel for it. Week 0 and 1 are in the Github repo.
Project repo: https://github.com/endperform/pyroguelike
2
u/Nargasse Jun 23 '20
Just finished the third part in Python, and i'm really curious about the third one. Procedural generation is so cool. :3 I have no repo, social networks make me anxious, but i made an account just to say that i'm following too, thanks a lot for the tuto, this is an amazing way to learn some code. :)
2
u/candyleader Jun 23 '20
Done week 2 of the rust project so far: https://github.com/lefishy/rustlike The repo isn't very exciting because it's basically a carbon copy of the tutorial as i continue to wrap my head around the language.
It's fun to think about how I'll be writing this stuff in pico-8 later (tomorrow) though! I'm going to diverge a few ways with that, making a camera system (to deal with the smaller screen size) and different mapgen using the... stacked tiles method?
2
u/ConstableBrew Jun 24 '20
(repo, game)
Javascript based, using rot.js for display. Not really following the tutorial really, just going at it.
Partial progress building the map generation. Built my own DRNG even tho ROT.RNG is right there, I thought it was fan to do and I learned a bit.
I'd like to refactor and be less class/internal state dependent and implement a more functional design. That's a lower priority currently tho and I will focus on completing the rest of the map generation and then add the character + input controls.
2
u/EmergencySpy Jun 24 '20
I can generate a very basic (and ugly) map!
After you get through a pile of outdated tutorials and documentation unity ECS seems very nice and easy to work with!
...except if you are making a 2d, turn based, tile based game ¯_(ツ)_/¯. Oh, well. Still a good learning opportunity.
Before the next part of tutorial is posted I will try to add some rooms to map generation algorithm (unfortunately it's already a hacky mess :P).
repo
2
u/[deleted] Jun 24 '20
Finished week 0 and week 1 following the RLTK (Rust) Tutorial. I am a little behind but let's see if I can manage to keep it up and add some maps and tiles. Also I want to start with my own customization, as I been following the tutorial to the letter until now.
Code is in here: my repository
2
u/grammatiker Jun 25 '20 edited Jun 25 '20
Oh nuts, I missed the first thread - is it okay if I jump in now? My working prototype is just about at this week's stage of development anyway!
You can see an older version of the game I'm working on here. Note that you can run into the walls to dig them! I've completely re-written the codebase since that version though. I'm working in TypeScript (repo here).
2
u/Obj3ctDisoriented Jun 25 '20 edited Jun 25 '20
I've been fiddling with a dungeon generating algorithm and i'm starting to like the results, obviously could be better, but it's a work in progress. It's a modified version of whats used in the python tutorial. i was able to implement the python tutorials algorithm with excellent results in Swift, but alas it was not translating well to C++, oddly, it performed very well in Perl lol. Attached Below are the results of the original algo in Swift, and Perl, and below that the results of the modified algorithim in C++.
The original algorithm as explained is posted in the Swift tutorial now, as is part 4.
Swift Tutorial
I'm still working on the best approach to present it for the C++/BearLibTerminal Tutorial but parts 3 and 4 should be done and posted tomorrow..
C++/BearLib tutorial
As for the perl version... i guess it kind of started as a joke and i just couldnt help myself. I'm working on turning it into full blown Perl/CGI based RogueLike WebApp, cause ya know, Perl.., but that project is at the very bottom of the list as i'd like to put maximum effort into presenting the Swift and C++ tutorials.
and now for the goodies..
SwiftTCOD:
https://maxcodes.info/tutorial/part3pics/procgenmap.png
Perl:
https://maxcodes.info/perlgen.png
C++/BearLib:
https://maxcodes.info/cppbear.png
2
u/eniteris Jun 25 '20
I settled on doing the dictionary, since it seems like a cleaner way of parsing keypresses. Apparently C++ has changed since I last used it, now it has tuples, which is nice.
I'm planning to revisit the map generation later, since I'm not satisfied with the room-dungeon layout.
Peeking ahead, it turns of FOV is next week, except I'm using ncurses C++, so I programmed my own FOV because bad programming practices. It's non-recursive shadowcasting, which seems to work out well.
2
u/[deleted] Jun 25 '20
Terry's Tickle Tactics (working title)
Week 2 has been a solid learning experience on implementing the GoRogue library alongside Godot. There's a lot of room for improvement when it comes to optimization, however I feel I have laid the groundwork for upcoming weeks.
repo
itch
screenshot
2
u/[deleted] Jun 25 '20 edited Jun 26 '20
Playable prototype of my project is up. This is going to be from my notes and the coding cookie tutorial.
I need to fix issues with react and then make a new iteration of the older version of this that has mouse / touch support.
I have only used Helix P4V. I will get all the versions of this on github.
I have lesson 6b - 12 with notes on the experience. Those will go up as well.
https://www.fatthunder.com/ and click on "Orange (WIP)" under the build section.
Controls listed on start screen. You need a keyboard till I reimplement the touch and click controls.
More is coming, but depression and unemployment will get in the way of my schedule.
I have a large amount of plans once the tutorial runs out.
The code will be available for everyone soon, feel free to pull whats there from the dev console in your browser.
2
u/livebyfoma Jun 25 '20
Just finished parts 2 & 3 of the revised tutorial. Still very vanilla. Added a 10% chance of diagonal paths spawning for funsies (still need to figure out how to widen these diagonal tunnels so you don't *have* to move diagonally at any point through them).
https://i.imgur.com/B4zvMZv.png
2
u/acss Jun 26 '20
I just checked in week 2 of my implementation using Godot. I have been linking resources that I am using on GitHub but thought I would call out three I used extensively this week here:
The first is where I incorporated some of the tile rendering code from. The last two are the algorithm for the dungeon generation and a JavaScript implementation of the algorithm that I ported to GDScript.
If there is interest, it's playable on Itch.io and the source is all available on Github: https://github.com/berubejd/RoguelikeDev-TCRT-v2020
Thanks!
2
u/alphaconverter Jun 26 '20
Had a productive day and followed through to part 7 where we add the interface (I am using the old tutorial at the moment). Didn't change much, except for colors and the terminal size.
I have to say, the tutorial is really cool and I'm having fun so far. :D Here's a gif ...
2
u/[deleted] Jun 27 '20
1
u/BroceNotBruce Jun 24 '20
My venv isn’t recognizing tcod.los but it says that tcod is up to date. Would anyone know what’s wrong?
1
u/Zach_Attakk Jun 27 '20
So I've spent the last few days dealing with error messages...
So I was forced to move to a different machine, so I cloned my repo and started coding. It was working fine until I noticed I was running on Python 3.7.5 instead of 3.8... Not a major issue, but should probably fix it...
Did a quick installation of 3.8 followed by error after error getting tcod and pygame installed... I have very limited free time, so after spending an hour googling and trying things I'd leave it for the next day and try again.
Today I got as far as getting tcod and pygame to install properly, but when I ran the project I got this.
Original error was: No module named 'numpy.core._multiarray_umath'When I try to uninstall numpy as instructed it tells me that there's nothing to uninstall, but when I try to install it, I'm told that
Requirement already satisfied: numpy in /usr/lib/python3/dist-packagesI think the problem arises with the fact that it's looking for numpy in the base python3 package folder instead of python3.8 but I can't find where to change this. I can tell VSCode to use a specific python but I think then it expects numpy to be in the site packages for that specific version of python. Switching back to Python 3.7.5 works fine so if all else fails I can simply code in that until the tutorial is over and then worry about sorting out python 3.8 later... Unless we're using specific features... But my stubbornness has kicked in. I don't like knowing there's something wrong with the setup of my distro and I'm unable to resolve it.
Meanwhile I realise that I'll have to do a lot of reading and retrofitting to keep my code from Part 1, seeing that I've already had to bastardise the tutorial to get pygame incorporated...
It's not all bad though. I have this! I seem to have picked up an issue with pygame's per-pixel transparency, which is the next thing I'd like to look at. Then I'm moving on to redoing Part 2 from scratch with all the new data types and structures. It's much more pythonic than the old tutorial...
1
u/Uruluke Jun 27 '20
I'm not sure it should be asked here, but since I'm new to Python, I'm also trying to understand what is done in terms of languages I know (namely, Java). And I somewhat confused by Part 2, tile_types.py. I don't fully understand how these Numpy dtype structures would be looked like and used in Java (is there some sort of analog to it). It is some sort of complex structure?