r/roguelikedev • u/aaron_ds Robinson • Aug 10 '21
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(revisited)
- #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! :)
4
u/usami33 Aug 12 '21
It took a lot of time to implement saving and loading.
Godot is designed to handle a unique concept called "Resources" to store data efficiently, but since I didn't study this concept at all and designed it appropriately, I had a hard time understanding how to handle it.
There are still some strange bugs, but I'm relieved to have a working system!
I've also added a fade-out effect when you save and load the game or go down the stairs.
This is how it looks now.
I'm about to start part 12.
3
u/pnjeffries @PNJeffries Aug 10 '21
Roli
Play Now Online!
Repo
I now have a test build version up on itch.io. There's no real progression yet and it's in dire need of some de-jankification but it's playable and there's a selection of different enemies to be hit with a selection of different weapons. Please give it a go and let me know if it runs at all on your machine!
Besides getting that running, most effort this week went into adding the ability to drop items. This turned out to be fairly complicated since it needs multi-step input (i.e. press 'D', then press they key corresponding to the item you want to drop) and my input system wasn't really set up to deal with inputs not triggering the end of the player's turn. Cue a fair bit of boring refactoring.
I've also now implemented status effects - snakes are now venomous and will poison you if they bite you - and finished the system to allow you to equip weapons and have them modify your basic bump attack. So, the basic combat system I envisioned is now in place. It... kinda works? I think it needs a bit more work on enemy AI and a bit of interface work to make it more obvious to the player what different weapons do and improve the 'feel' of using them. I'm not sure my cunning idea to streamline using and equipping into a single action really pays off, but I'll give it some consideration before I change it. I'm hoping to avoid 'button bloat'.
Saving is implemented, but doesn't work in the WebGL build. I don't really see a way around this, but I think this is probably OK; I think I'll end up with a WebGL version that people can have a play around with, but a downloadable version with saving and a few other things WebGL won't let me do for those who decide they want a proper go.
2
u/Kehvarl Aug 11 '21
Roguelike-2021 (Common-Lisp + BearLibTerminal) | Repo
Part -
I'm way off from the tutorial at this point and have neglected all saving abilities and ranged attacks. I've instead contented myself with working on the features that have interested me of late.
Spawners:
Scattered throughout the dungeon are entities that will try to spawn things around them. Some of them spawn potions, some spawn monsters. Eventually more will spawn whatever else I add.
To determine if a room had the limit of entities within it, I've taken to tagging every tile with a "region ID". When a spawner wants to trigger it gets a count of all entities except itself currently within the same region as it. If the number is below the threshold it will pick a random square in the region and in a known radius. If that square is empty it will spawn an item there and restart its timer.
An Old AI update:
Monsters actually have an Activation Range. When they're within that radius of the player, they will act, even if they can't see the player.
New AI (Ranged):
I've added an AI that tries to approach the player to a set distance. At the moment it then freezes, but the next update will have it strive to maintain that distance.
New AI (Tracker):
Another AI has the ability to track the player. This required a few different modifications. First, the player is now its own class which descends from Entity. This class includes a "current track count".
Then the tiles were modified to hold a "track" tag.
Then the game-tick routine was modified to update the player's square with its current track count every move.
The new AI now moves randomly unless one of 2 conditions are true:
If the player is in sight, it will act like a normal monster and move to attack.
If the player is not in sight but the monster has found a track, it will begin to follow the track towards the highest valued tile.
2
u/Larront Aug 13 '21
Crown Of Vorona
Repo
I had some awesome suggestions last week from HexDecimal and Kyzrati on improving the performance of my Cellular Automata generator, which made an awesome difference in the load-time. I implemented a few other builders, a maze map, a drunken walker map and I got partway through a DLA implementation (needs optimization). Had a lot of fun implementing the different generators, and finishing the tutorial was pretty awesome; I'll look to work more on this game post tutorial as well :)
2
u/haveric Aug 14 '21
Untitled Diablo roguelike
Repo | Play | Gallery
Language: JavaScript --- Library: Three.js
I have what I'd call a functional game at this point, even though there are plenty of unfinished features and the balance really depends on your rng for item generation. I ended up spending way too much time on creating a town portal scroll before moving on to difficulty and items, so it took me a bit longer this week to complete everything.
Part 12: There isn't a whole lot different in my game vs the tutorial, but I was able to get everything converted to json, which has made adding and tweaking things extremely easy. (Dungeon, Item Groups)
Part 13: I've been planning on equipment to be between diablo and castle of the winds, but I haven't gotten around to implementing subinventories yet (belts/packs holding items), so for now it's just basic equipment within 4 tiers that each randomly generate their stats. The limited 10 slot inventory seems to be plenty for now anyway or at least it will be until shops are implemented, giving a reason to hold onto extra loot.
One major thing I tweaked from the tutorial is how agility/defense works, but I am certain I will be tweaking it further. Instead of straight blocked damage, your armor and agility give you more defense. The defense then blocks a random amount of damage from 1/100th to 1/10 of your defense. This helps make you less invincible, but still more protected on average as you get more defense.
Extra: Because of implementing the town portal, I ended up adding a few new features, including tiles being able to contain multiple objects (ex: bench armrests now become bench with armrest) and jsonized animation (town portal json). This should be able to open up more creative possibilities going forward, but I'm really happy with being able to get that working.
Another feature that I slipped in this week was variable fov and movement speed for enemies. Rats are the prime example where they can only see 3 tiles instead of the default 5, allowing you to avoid them if you're careful, but if you get close enough, their 2x movement will have them catching up to you quickly. Other creatures, such as skeletons, trolls, and ogres move more slowly. The movement is separated from the attack, so if they get close to you, you're still going to get hit every turn though.
1
u/Zoltarr777 Aug 11 '21
Hey how could I make it so the weapons and armor all have variable amounts of values when they're each generated? So instead of having each sword by 5 attack, it could be between 4-8 or something?
1
u/Many_Slices_Of_Bread Aug 13 '21
This is exciting! We are almost there! I still have a lot of features I want to implement - like a whole magic system - but since I was completely new to Python, each week was already pretty complicated in itself.
Had an error come up with procgen in Part 12 - and would love some help! Any idea why the reference is unresolved?https://imgur.com/a/iRkQRNr
Thanks in advance for anyone who can lend a hand!
1
u/RivalRoman Aug 14 '21
Untitled Urban Fantasy/Anime inspired project
Repo
Finished the tutorial! I have a few little bugs to track down following the completion of the last two parts. Most noticeably the message for consumable items in inventory doesn't appear though the items are in the inventory and can be used as normal. I'll go through the code again when I have time, as I also want to hunt down the exception that pops up when closing the game after dying. I may just end up copying over all the files one last time to "fix" those problems.
Thanks to the tutorial maker, it was really fun to follow along every week! I think I'm going to keep fiddling with my project in the weeks/months/years to come and try to add some of the features I want to (different character archetypes to start as, different zones to go to etc). I still don't really know what I'm doing, but I hope that I have enough understanding to start looking at the things I want to do and figure out the best questions to ask as I progress.
1
u/EmergencySpy Aug 15 '21
Repo | Web version
Finished! And the web version is not slow anymore! (I thought I was compiling it with optimizations buuuuut I wasn't, so that was fun to figure out)
Unfortunately, adding weapons and armor kind of unbalanced the whole game. :P I might go back and change the numbers, but I probably won't be adding anything new to the game.
Thanks to everybody who organized this event, it was really fun, and I'm really happy with what I have made!
1
u/Many_Slices_Of_Bread Aug 17 '21 edited Aug 17 '21
Hey guys, I've been trying to implement some code to make the walls look nice and join together, using a different tileset that I downloaded. I've been struggling for many days on this. Would love a hand:
At the moment I'm trying to figure out how to change tiles before they are rendered - so i decided to do a test. I tried to implement some code that looped through all the walls and changed them from '#' to a '/' character.
Here is my code, in game_map.py:
The result is an error: "ValueError: setting an array element with a sequence."
Looks like I'm not setting the element properly - not sure how to do it. I'm sure the code is pretty bad, but I've found it really hard to learn about how to iterate properly through a numpy array and use the index, and how to set elements.
EDIT: Turns out I was I was so close, just fell right at the end.
I needed only change
[ord("/"), (255, 255, 255,), (0, 0, 0)]to
(ord("/"), (255, 255, 255,), (0, 0, 0))1
u/dagger-v Aug 17 '21
Part 12. Very bottom of the page where we clean up the place_entities function in the procgen.py folder, I'm getting an " Unresolved reference 'entity' "
Is that normal? Game seems to run just fine, just find it kind of weird.
1
u/davesmith00000 Aug 17 '21
Thing I got my weeks mixed up! Anyway, here is the completed Scala version I've been working on, complete with playable versions:
https://github.com/davesmith00000/roguelike-tutorial
...and a post-mortem:
https://indigoengine.io/blog/2021/08/17/roguelike-post-mortem
Thanks!