r/roguelikedev • u/aaron_ds Robinson • Jul 30 '19
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.
Part 13 - Gearing up
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
- #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/thebracket Jul 31 '19
Rusty Roguelike implemented the increasing difficulty in a very similar manner to the tutorial, by using tables for spawning and changing likelihood based on dungeon depth. So as you advance, you are more likely to run into the dreaded
Borrow Wight!Equipment was more interesting. Adding in weapons and shields as items was easy - add them to the entity list as items, and the infrastructure already created for picking up potions and scrolls was already there. Implementing an "equip" and "unequip" interface was also easy, since the menu code from "use" could be adapted quickly. I simply made an additional list of items for what is "equipped", with an enum for slot; when you equip an item, it moves any existing item in that slot back into your backpack. The player's "combat" code was adjusted to add weapon/shield bonuses - and that section of the tutorial was done. :-)
RLTK - RS - the library behind Rusty - underwent a few improvements:
FastNoise- "noise lookup". The idea behind that type of noise is a good one: you get coordinates from cell noise and lookup the result from another noise object. The practice was quite unsafe: you ended up holding a reference to another object, and lifetime management became hard. I looked at a bunch of my projects, and I've never actually used that noise type - nor really wanted it. So away to the cutting room floor it went.PointandPoint3to include operators for arithmetic, so you can add them together instead of adding their parts. They can also do arithmetic with a whole number, which applies them to the whole vector. I didn't try matrix math; thecgmathcrate does it far better than I'm likely to!I've been really impressed with the Rust community's embrace of RLTK; I tweeted out the DF map example, and it got tens of thousands of impressions - and I started getting messages thanking me for it! That made me feel great - and various people have started playing with it, submitting things to fix/improve, and so on.
I'd like to figure out how to make it compile to web assembly to make the web-based users happy.
4
u/KarbonKitty Rogue Sheep dev Jul 30 '19 edited Aug 07 '19
Burglar of Babylon - TypeScript + ROT.js
Play here || Repo here || Template repo
Not much got done this week, and even the stuff that did get done isn't yet pushed. But I reserve the right to edit this post with one final update that's in the works before I put the Burglar back on the shelve for a few months. :)
4
u/[deleted] Jul 30 '19
Py Dungeon (Temporary name) - Python/tcod
(No more screenshots right now, but I'll add some later on)
Hey everyone! I've been working away at the game and am up to pace. I've just started on part 12, but before I continue on that I thought I'd check in here.
The last week I implemented items. I prefer combat spells to be wands over scrolls, so I made wands that have multiple uses, and will be adding scrolls as well at some point.
If you saw my post last week, you know Py Dungeon has a body part system. I know for sure this is something I want in the game, but I'm having a few problems deciding where to go with this. The player can (and currently, will, inevitably) lose body parts, just like monsters. I had some ideas on how to fix this:
I think I'll go for the last one, as it could make for a really interesting game. The second one isn't really mutually exclusive, and I can see implementing that as well. Any feedback appreciated!
4
u/-gim- Jul 30 '19 edited Aug 02 '19
Pandemos || love2d 11.x - lua || github || screenshots gallery ||
Hello week 7,
Had family over the weekend, still behind, I'm somewhere around part 9.
I'll probably be able to skip part 11 and I'm currently thinking about postponing part 10 (saving / loading) - this shouldn't be hard for mapdata, entities, etc, but I'm not sure about items yet, so not sure if I want to spend time on this now. (especially that there will be lot of content + polishing needed later)
3
u/Quistnix Jul 30 '19
I'm considering putting all the numbers (item stats, monster stats, ..) and all messages in one central spot for easier balancing and rewriting. I guess the easiest way to do this is to make a numbers.py and texts.py file (in components?) and just refer to those when needed. Would this be the best way to do this? All advice is welcome!
3
u/tehw1n Jul 30 '19 edited Aug 03 '19
80s RogueLike - C# + Unity
A lot of radio silence but I was eventually able to make it work with C# and Unity. Codebase is a mess but the game works like the tutorial. As you can see from the screenshots, the game currently looks like the 80s threw up so hopefully that gets better. I'm torn between adding content, juice, and making the code maintainable. FOV also needs to be redone but it is useable for the meantime. I hope to stick with it for awhile. Also looking to get it up on Itch shortly. All feedback is appreciated.
Github Image Inventory
Edit:
Game is up on Itch. Saving/loading does not appear to work with the WebGL build. It is also only setup for full screen currently with UI sizing. Itch Link
3
u/tpseven Jul 30 '19
Ritoppu | Purescript | Repo | Game
Part 12 is done in almost the same way. I changed the order of args to from_dungeon_level to exclude reverse calling. And it was a bit confusing to remember whether the first element in array is a level or actual value. So in my implementation it takes object with explicit keys.
Part 13 was pretty straightforward. The only difference is I din't add take off command because it doesn't make sense to remove an item to stay with bare hands.
Finally tutorials are done. This was a long road, but I've learned a lot. So happy to get here. Many thanks for this event, it wouldn't be possible without you
2
u/HeWhoWritesCode ABC: AfricanBearCheetah Jul 30 '19 edited Jul 30 '19
So when i first mentioned im going to use pascal i wonder why my effort was logged as a custom engine. Until I hit part 4 and realise im going to need to implement my own fov function and most probably more stuff as I go a long, so that is what I'm doing.
https://gitlab.com/profhound/tui/tree/roguelike
I also have this crazy idea I don't want to use SDL2 or some other graphical terminal but rather the default OS terminal emulator, so working on some kinks to make my render faster in a dos prompt on win 10.
Interestingly my engine performs a lot better in a WSL(Windows Subsystem Linux) shell then in a dos prompt/powershell terminal.
Finally I'm way behind with the tutorial series, but got some extra time this week to try to catch up before we finish of next week.
2
u/dbpc Jul 31 '19
Still two weeks behind, all the way back in part 8... :(
2
u/[deleted] Aug 02 '19
fell behind for a bit because of some hand pain, so i didn't really do as much playing around in sections, but I managed to catch up in time and that's a win for me!
2
u/jauntological Aug 03 '19
Hostis - Python/Tcod
I've fallen a week behind due to a particularly crippling moving house debuff and a few bugs I'm struggling to understand, but it seemed a shame not to post at all after lurking during the entire tutorial (and mostly asking my questions on the discord). Either way, I'm looking forward to having the time to get this finished and into the tinkering stage that will inevitably follow. I'm almost completely new to coding, so thanks to everyone that's put in the effort to make the tutorial such a great resource.
For future years, it'd also be great to have a 'homework' section with some skeleton steps (or collected resources from here/elsewhere) for each section to take it a little further, i.e. implementing a BSP generator on the map section, or adding different shaped rooms etc. Most of this can be solved with some google-fu, but it'd be good to have some of it translated or laid out in ways that make sense to the tutorial structure (again, as someone new to coding). The great thing about the tutorial is that it clearly has enough functions included that a lot would just be adapting existing code, so something like a section to say 'If you want to do this, try substituting this codeblock into the BSP generator found here' would be a great way to push coding newbies to develop a more practical understanding of the code they're writing.
2
u/dafu RetroBlit Aug 05 '19 edited Aug 05 '19
Retro Dungeoneer
[C#, Unity + RetroBlit]
Follow my progress at: https://gitlab.com/mcietwie/rbrl or Twitter @martin_things
Current screenshot: https://i.imgur.com/NGtvnEt.png
Play WebGL: https://pixeltrollgames.itch.io/rl-tut
The last week was probably the most difficult one for me. The goals in the tutorial themselves were not very hard, but I had to refactor my Entity system. Instead of referring to Entities by their instance references I now have a single central EntityStore, which is responsible for tracking all Entity instance references. The EntityStore creates Entities on demand and returns EntityIDs which are just simple structs with 2 integers (an index, and a generation). Everything outside of EntityStore referes to entities by their EntityIDs, which are much easier to persist in a saved game file, especially when there are multiple references to the same Entity (as was the case with Inventory and Equipment this week)
I wrote BinaryWriter and BinaryReader wrappers called GameWriter/GameReader. These wrappers are only used when debugging, they have the extra automatic functionality of writing incrementing tracking markers (integers) after every Write() call, which are then verified while reading with BinaryReader(). If the tracking markers don't match when loading the game file I can quickly see where the loading failed, which makes my serialization code easier to debug.
I significantly improved performance by refactoring all tutorial code which used "get all entities at position" type of queries. The tutorial suggests just looping through ALL entities and checking each against the desired position. This is very inefficient. I now use RetroBlit API RB.MapDataSet<List<EntityID>>(entityList, tilePos) and RB.MapDataGet(tilePos) to store a list of all entities at each tile. When doing the "get all entities at position" queries I only have to return the existing Entity list for that tile, without looping. I keep these tile lists in-sync by providing a property method for Entity.pos that updates the list whenever the position is changed.
Last week I had a problem with WebGL saved games being lost when the webpage is reloaded. This took me some time to figure out. Apparently saving to Application.persistentPath in Unity is an asynchronous operation on WebGL (regardless of FileStream.Flush() calls) that is not guaranteed to happen immediately and data can be lost if the page is reloaded. To ensure the data is flushed out to the file system (which is stored in IndexDB browser local storage) I have to call out to JavaScript, and there call FS.syncfs(). This fixes the issue.
This concludes the tutorial series. I've implemented everything in the tutorial, with small deviations where necessary for C#. The work is not done though, the goal for Retro Dungeoneer was to finish it and add it to the next release of RetroBlit. For that I still want to clean up the code more, and add a bit more variety to the game (more monsters, items). In particular I think I want to revisit the way I handle action "Results" because I tried to mimic the Python implementation and ended up with something thats not very C#! I also want to spruce up the look of the game, and add some simple linear interpolation for movement animation. I'll be busy next few weeks, but when I do get around to this I will post in the following Sharing Saturday!
Thank you for following my tutorial efforts!
2
u/RoguelikeLootHunter Aug 05 '19 edited Aug 05 '19
Hi. I'm almost at the end of the tutorial now and want to put the game (with a few personal tweaks, of course) at my itch.io page. Though I haven't found how do I make it into executable (I'm under Windows). How do I compile it?
Sorry for this noob question. I looked up at Python docs - it says I need to make "embedded package", but doesn't explain how to do it.
2
u/[deleted] Aug 05 '19
RoveR: week 7 'Sojourner' screenshots
RoveR is a roguelike about a planetary rover created using R and the package Shiny.
I was flat out with work projects and vacation this week. However, I found some time to add a menu, scanlines and some glow to each character. I've also added 90 modules (i.e. equipment) with various abilites for the Rover.
If I can find the time, I'll try to overhaul enemies and level generation and have a shareable version for next week.
I have no idea how people do a 7DRL. Even with a tutorial (albeit in python not R), I'm having trouble pulling off a 7WRL ;)
2
u/theoldestnoob Aug 06 '19
My repo. Python3 + tcod.
This week I finished the tutorial. Parts 12 and 13 were pretty straightforward to implement. The code worked more or less directly, without many alterations needed due to changes I made in previous parts.
I have also started the process of converting my existing slapdash possession mechanic into what I think I want it to actually do. I have not had enough time to really get into making serious changes yet, but I have made some changes to get rid of a few kludges and lay the groundwork for how I think it will work. I have a plan for the first few things I need to do to get the game into a place where I can really start messing with the things that I think will be key to making the mechanic interesting and which, happily, I'm very interested to start experimenting with (NPC AI and level generation). I have also had the flavor and setting I want for the game start to coalesce in my mind: Theosophy / Western esotericism, set in the late 19th - early 20th century. Use your etheric body to sneak past Atlanteans, Lemurians, etc to try to find fragments of the Akashic records that they have hidden away, or something along those lines. The concept isn't quite there yet, but I can feel it coming together.
1
u/mattpwest Aug 05 '19
Guess I'm a bit late to the party! ':)
I find myself halted roughly at part 11. I decided to skip the standard XP and levels system, for now. Instead, I implemented my unique game mechanic:
You're a ghost whose essence is slowly running out. Possess creatures in the dungeon, then murder other creatures so you can steal their essence and stay alive!
I'm happy to report that I've achieved a decent proof-of-concept of that! Now that this tutorial is almost over I'm feeling hesitant to rush through the remainder of the tutorials trying to add more stuff and just causing problems for myself down the line.
Time to slow down and take a more careful, considered approach. For example: reading up about time systems instead of just making up a half-assed attempt that inevitably breaks as soon as things get remotely complicated.
I'll try to put a release of what I have now up on Github during the week and then start working on a longer-term road-map for stuff to implement over the next few months.