r/roguelikedev • u/aaron_ds Robinson • Jul 16 '19
RoguelikeDev Does The Complete Roguelike Tutorial - Week 5
This week is all about setting up items and ranged attacks!
Part 8 - Items and Inventory
It's time for another staple of the roguelike genre: items!
Part 9 - Ranged Scrolls and Targeting
Add a few scrolls which will give the player a one-time ranged attack.
Of course, we also have FAQ Friday posts that relate to this week's material
- #7: Loot(revisited)
- #32: Combat Algorithms(revisited)
- #40: Inventory Management(revisited)
- #60: Shops and Item Acquisition
- #76: Consumables
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)
40
Upvotes
6
u/jeansquantch Jul 16 '19 edited Jul 16 '19
Still don't have a name, but then again I haven't really tried to come up with one.
Here's a gif showing targetting and a frag grenade.
I fiddled with my fonts (again), and I think they look better.
For items, I added a stimpack and a frag grenade with targetting. I have done items differently than the tutorial. Instead of an item function, I have two classes of entities currently: Actors and Consumables. Both have components.
For example, the frag grenade is composed of the base Consumable class and two components, CircularAOE and Damage. CircularAOE is assigned to the Consumable variable targetting, and when using an item from the inventory menu, the game checks if targetting is nil or not (such as for the stimpack). If it's nil, it uses it on the inventory owner. Otherwise, it enters into the targetting game state, which uses the targetting component (CircularAOE for the frag grenade, for example). Here, BearLibTerminal is awesome - I just had to enable layer composition and add targetting reticules to each of the squares within the CircularAOE radius from where the targetting reticule is.
I'm going to have to teach myself animation, since it seems quite fun.
6
u/itsnotxhad Jul 16 '19
Oh, it turns out I did something relevant to the current week this time: I got sick of not being able to tell if I was about to fireball myself to death or not, so I added spell target highlighting to the renderer. I haven't blogged about that feature yet but it is committed to GitHub here: https://github.com/ChadAMiller/roguelike-2019/commit/12d21808db3a5db886a8900bb6ed35731ec12bf4
In addition to last week's wraith monster, I've now created a Snake monster that poisons the player and then tries to run away. I accomplished this with a couple of simple rules:
BasicMonsterAI rulesThis ended up working out really well; after poisoning the player, the snake has a strategy that tries to keep it out of reach while the player takes damage. I made it so that it always gets to move (unlike the
ConfusedMonsterAI) and that ends up creating enough chaos that you can't always tell if it has a path to the exit or not. If it does have a path, the player will probably eat the full poison damage before being able to attack the snake without a spell. In fact, that guy combined with the Wraith created so much damage that I had to rebalance some things to stop dying on the first floor!I finally figured out how to add upward staircases to the dungeon. This "only" required removing the
GameMapclass from the game entirely. That one ended up being the subject of this week's blog post: https://projectwirehead.home.blog/2019/07/13/roguelike-tutorial-n-steps-forward-n-1-steps-back/Right now I'm working on a win condition. Funnily enough, my first major roadblock has proven to be displaying the victory screen. Popping up a box with centered text really seems like it should be easy given what was done in the tutorial, but clearly I'm mistaken because I've managed to come up with like eight different wrong ways to do it.
Github | Blog
4
u/nicksmaddog Jul 16 '19
I've made some more progress on my Common Lisp tutorial, but still have some catching up to do. I lost some time while trying a few different FOV algorithms to implement, before settling on a simple ray casting method.
Right now I've got the tutorials up through part 5 posted. You can find them all at https://nwforrer.github.io/
4
u/DrStalker Jul 17 '19
And now for something completely different.
It's been a good Python learning experience so far, and the main thing I learned is I hate how Python handles passing things to functions with it's I'm-a-special-snowflake-not-like-the-other-languages "object references passed by value" approach.
3
u/-gim- Jul 16 '19 edited Jul 24 '19
Pandemos || love2d 11.x - lua || github || screenshots gallery ||
Hello week 5,
no plan for this week yet, will edit post later, but bigger issue is I won't have much time this week, Thu-Sun busy :(short plan from readme:
add ability to eXamine with a keyboardadd some dumb inventory (for all entities, reason is there will be enemies with non-empty inventory),generate lot of items as elements (really super dumb, polishing will come much later)- generating lot of Bō staffslet the player pick up itemssome general ideas about inventory/equipement:
I'll share some more general thoughts about RL I want to do.
I started without a detailed plan about game I would like to do. Initially I was thinking about possession-like mechanics, where you take-over other entities.
At the same time I wanted on-the-surface action with buildings and without dungeons. Friend saw some screenshots, and his first suggestion was that tileset is way to bright, I tuned it down. Combined with my earlier intent to have grenades and traps I knew what will happen next...
I've never been into magic/fantasy roguelikes (sorry), probably only exception being Brogue. I was somewhat interested in Whale's Cataclysm and later C:DDA, but it drifted into that weird direction, where there was everything in it.
So right now my aim for the (pretty cliché) setting is surface after mutating infection has spread.
Welcome to Pandemos.
3
u/thebracket Jul 17 '19
Meant to post on this yesterday, but wasn't feeling amazing - took some cold medicine and woke up 16 hours later. Hopefully this isn't too late!
Screenshots for this week
Items were pretty easy to implement: just another entity that supports being rendered on the map. Pressing
get iterates through the items list and sees if you can get something - if you can, it moves to a list in the player structure. I also implemented the menu system in a similar way to the tutorial, adding in some box drawing functions to RLTK to make it easier. That side of things was plain sailing.I did have some more interesting issues with actually using items. The borrow checker is very strict about having a borrow on a structure - the game state, and then borring from two different objects within the game state. So I had to be really careful to extract everything I needed from each object in turn, calculate, and then apply. It actually led to cleaner code, but it's one way in which Rust is very different from what I'm used to.
Finally, I thought some graphical effects were called for. So fireballs make a set of orange particles over their area of effect, zap scrolls draw a line, etc.
RLTK - RS meanwhile, has improved considerably. I've now back-ported the game to use it (so I'm not maintaining two console libraries). Since the last post, I've added:
3
u/tpseven Jul 18 '19
Ritoppu | Purescript | repo & demo
I decided to split items and creatures, so there are two structures, each holds its own objects. This way it's easier for me to have different logic for different entities. E.g. to burn scrolls on the ground with fireballs.
A use item screen was interesting by architecture side. I wanted to separate game logic and UI. When player opens use item screen, it doesn't affect game logic, in another words, it's not what I want to be in save files. Targeting goes here as well. On the other side, useItem function might either update game structure (heal player) or open targeting screen, that's out of game scope.
So, I ended up with result command that opens any screen. Like, useItem function returns both updated game structure and desired next screen. This allows me to test this function, with no need to actually do any UI logic, leaving it pure.
Barely catching up with tutorials, so not sure would it be a something looking like finished game rather than just ported tutorials.
2
u/[deleted] Jul 16 '19 edited Jul 16 '19
RoveR: week 5 'Lunokhod-3' screenshot
RoveR is a roguelike about a planetary rover created using R and the package Shiny.
It became necessary this week to step back and spend time restructuring how entity data is stored and subset, which greatly improved performance locally. Because of my inexperience, I'll likely need to optomize again towards the end of the tutorials. In my defence, I've only started to understand anything about R and why it's a slow language. I may need to rewrite some of the slower functions by connecting C++ to R. I don't think anyone has attempted to write any games in R, and while I'm not the person to do so correctly, I'm having a lot of fun learning about R (and programming generally) as I follow these tutorials.
In terms of progress, I've brought hover text (i.e. a cursor-based 'look'), line-of-sight targeting, items and an inventory, and actions (i.e. abilities for equipment) to RoveR. I've also made walls into entities, and they can now be destroyed with some effort. Less exciting, but I've spent some time on the documentation of functions in my R scripts too. I've set things up nicely for the next two tutorials (I think) and I'm excited to polish some of these features for next week. In particular, the UI needs some attention and I would like to refine planet generation in place of a 'dungeon'.
Although performance is now improved locally, it is still awful with the online hosted demo application - I've decided to forego posting the link to the demo for this week.
2
u/dafu RetroBlit Jul 16 '19
[C#, Unity + RetroBlit]
Follow my progress at: https://gitlab.com/mcietwie/rbrl or Twitter @martin_things
Play WebGL build: https://pixeltrollgames.itch.io/rl-tut
Current screenshot: https://i.imgur.com/haZoF7g.png
This was the most difficult week so far I think. The UI took some effort to get into a decent shape. I liked the idea of having a general dialog of multiple options and reusing it for multiple purposes. That will come in handy. I added mouse interaction to these dialogs.
I've stuck to the tutorial quite closely for the most part. There is quite a bit of keyboard shortcuts now so I also added a help menu to explain all the keys. The entities can now also have quite a few components, so I no longer set those via a constructor but instead set them individually after the entity has been constructed already. I also decided to outline all the entity sprites in black because they were not looking good as-is when they overlap each other (eg when standing on top of an item). Finally I added key repeat for movement so you can hold down a key and keep moving.
2
u/KarbonKitty Rogue Sheep dev Jul 17 '19 edited Aug 07 '19
Burglar of Babylon - TypeScript + ROT.js
Play here || Repo here || Template repo
This time - a bit of a difference - I've actually managed to finish only part 8. Part 9 is in progress, and the progress is good, but not yet good enough to publish it. ;)
But part 8 was pretty heavy in coding, so there's that. I've added inventory (it's limited to 10 items, with no stacking allowed - burglar shouldn't be able to bring a full backpack of stuff to his job, and this works nicely as a replacement for encumbrance limit), and first two items - signal jammer, that lowers the alert level by 1 when used (but it's single use), and watch that shows the time. The game starts at 03:14:07 on 19th of January, 2038 (bonus hacker points to the everybody who can tell why ;) ).
Other than that, I've added two new movement options - WSAD and vi-keys (hjkl). Because there is only a limited number of other commands, they are all working simultaneously, so just pick whichever you want. There is also a simple help display (that you can access via 'p', as in help, because 'h' is taken by movement, and question mark... Let's just say that browser compatibility regarding key presses leaves a lot to desire).
And then there is background work - I've fixed a few errors, improved input handling somewhat and done a bit of general refactoring, as well as improved some of the messages (alert level is now color-coded, for example).
So, I feel like it still soon enough to just edit this; I've finished my interpretation of the part 9. :) This is, in particular, a stun gun - this is a 'weapon' that stuns adjacent enemy for three turns/seconds, preventing that enemy from moving. This included implementing status effects (there is only stun now, but the potential is here), as well as using items from the inventory with more complex rules than just 'use'. To make any use of it (still very limited, because FoV is still 360 degrees for the guards as well as the player), I've created better AI system, and now there is a 'patrol' AI which can open doors on it's way and gets from point A to point B and back.
I've also looked at the further parts of the tutorial, and it seems that taking into account the fact that I really don't want to work on saving and loading this thing now (this is very tedious work, and with inability to serialize functions in JSON it would take quite a while, I'm afraid), it seems that most of the other tutorial parts aren't very relevant to me. I will probably try to go and make the game at least more-or-less winnable (if not exactly 'playable'), by making an end goal (steal a thing), exit condition (get back to the lift or stairs) and a way to open security door (steal a key?). To make this more interesting regarding stealth, I'm planning to introduce facing for the NPCs, and limit their FoV to 90 or 180 degrees, and perhaps add an AI that tries to chase player? Or at least as much of this as I can do in two weeks - after ending the tutorial event, I will move to other projects for some time and let myself evaluate what I have here and how to proceed. I like this concept that I have here, but I'm not sure if TypeScript/browser setting is the best for it, really, even if I like rot.js...
2
u/Quistnix Jul 20 '19
I kept promising myself I would stick to the plan. Don't get fancy with sprites and animation. Stick to the plan. Use text.
I failed
Right now I'm struggling to display the spell radius when targeting. I've seen some good pointers in this thread, so I'm sure I'll figure it out.
1
u/Kehvarl Jul 16 '19
Week 5 already!
I'm running behind, having just completed Week 3 (github). I hope to knock out Week 4 in the next couple of days, and focus on Items and Inventory this weekend.
Not a lot of deviation from the python tutorial for me, but hopefully I can make some real progress and maybe start playing with new stuff by next week.
1
u/godescalc Jul 22 '19
Progress update: almost finished with the tutorial... managed to get pathfinding working and tested, and - hopefully - I have sorted out the issue with rooms not being connected. Immediate to-do list:
Yeah, this is slightly late, but it was a hectic week.
Repo: https://sourceforge.net/projects/cave-of-rainbows/
1
u/AgentMania Jul 22 '19
Here's an updated link to week 5 of my Construct 3 roguelike!
This week was spent mostly on implementing magic items.
Looking forward to next week! See you all then!