r/roguelikedev • u/aaron_ds Robinson • Jul 10 '18
RoguelikeDev Does The Complete Roguelike Tutorial - Week 4
This week is all about setting up a the FoV and combat!
Part 6 - Doing (and taking) some damage
http://rogueliketutorials.com/libtcod/6
The last part of this tutorial set us up for combat, so now it's time to actually implement it.
Part 7 - Creating the Interface
http://rogueliketutorials.com/libtcod/7
Despite what roguelike traditionalists may tell you, a good UI goes a long way.
Of course, we also have FAQ Friday posts that relate to this week's material
- #16: UI Design(revisited)
- #17: UI Implementation(revisited)
- #18: Input Handling(revisited)
- #19: Permadeath(revisited)
- #30: Message Logs(revisited)
- #32: Combat Algorithms(revisited)
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)
50
Upvotes
9
u/[deleted] Jul 10 '18
Just wanted to say thanks for doing this, a majority of RL tutorials I found in the past were outdated/ not maintained.
Let me know if I can be of any help with the styling of the site etc, pop it on github or something and I'll contribute.
11
u/Lokathor dwarf-term-rs Jul 10 '18
The Rust version of the 2018 tutorial is still going of course, though I did it all in a single long session so I admit that I phoned it in a bit toward the end.
This week we
10
u/[deleted] Jul 10 '18
D Language Tutorial
For those that saw my post from last week's thread, I was able to get some catch-up done over the weekend. Here's where I stand at the moment.
Last Weeks' Tutorials:
04: Colors and FOV
05: Let's Kick Some Enemies
This Week's:
06: The Pen and The Sword
Part 07 isn't done yet, I should have it up in the next day or two. That should put me on track for being fully caught up in time for next Tuesday. When 07 is ready I will edit this post with the link.
I also wanted to say thanks to those that sent kind words re: why I wasn't able to work on last week's tutorial set. I was stressed about not having anything ready and the kindness and sympathy helped alleviate some of that stress.
9
u/toptea Jul 10 '18
Python with Esper ecs library
Still working on it, but here’s my ecs dependency matrix for chapter 6. Any tips or criticisms are welcome!
Component vs Entity (orange)
The player and monster entities have almost the same components set. The only difference is that player is moved by the directional keys, whereas the enemy move towards the player via libtcod’s pathfinding algorithm. Not sure if I like mutually exclusive components like IsPlayer & IsHostile, so I might change one of them into a Movable attribute.
Component vs Processor (green)
Again, MovePlayer and MoveEnemy are kind of similar, so I might need to refactor this. The movement, collision & attack are currently in the same processor. I can’t seem to find an easy way to decouple them since they so connected. I will leave them alone for now.
Shared Variable vs Processor (blue)
Not sure what to do with my shared variables like the game_map, message, etc, so I’ve been dumping all of them outside ecs into my scene class. I think it’s working so far.
9
u/brianbruggeman Jul 10 '18 edited Jul 10 '18
Kelte
Github
Week 03:
gallery (37 new pics...)
This was a massive change/week.
TODO:
Week 04 Goals:
7
u/Z_Zeay Jul 10 '18
I was just about to post in last weeks thread. I've been following along this and jumped ahead a little bit (part 8-9). I'm enjoying myself and looking forward to continue on.
But I have some questions, like is it possible to increase the size of the game? I'm sitting on a high (not exactly 4k) resolution screen and have to squint my eyes to see anything at all (or move it too the 1080p screen I have sitting next to me)? And is there somewhere I can see libtcods documents? The ones I've found doesnt match the code I am/we are writing, I want to customize this as much as I can.
Other than that, I've enjoyed this and learning Python at the same time (coming from JS/C#).
7
u/dystheria Jul 10 '18 edited Jul 13 '18
Newbie effort in C++2017 with MS Visual Studio
Repo can be found here
So the combination of only having one month of C++ experience and libtcod having it's own shortcomings has resulted in a lot of frustration. I haven't had a chance to create lesson write-ups for parts 6 and 7, hopefully I'll find some time to do so before the end of the week.
edit:part 6 lesson write up is complete, and along the way I couldn't help myself and had to tweak and improve some of the code, which I think is going to have a knock on effect on the lesson 7 write up. Perfectionism is the enemy of productivity.I'm actually up to part 8 as I was determined to see what difficulties I was likely to encounter as an inexperienced programmer and the issues have certainly been numerous, in some cases I've had to intermingle aged code with more modern better practices as a minor admission of defeat.
edit: part 9 is now also available in the repo with functional healing potions and spell scrolls! The bugs that I accidentally developed while getting these working was a lot of fun but I'm saving them for next week.
Lessons learned so far:
const char *textin the roguebasin tutorial that doesn't translate easily to the use of strings or smart memory. edit: the part 7 write-up examines this in detail, highlighting the libtcod functions that don't play well with strings or smart memory and why.if (entity->mortal && !entity->mortal->isDead()), so this was a big lesson to learn.TCODSystem::checkForEventfunction and only specifyTCOD_EVENT_MOUSEwithNULLfor the key handler, so if you want to only check for mouse input you must still useTCOD_EVENT_KEY_PRESS|TCOD_EVENT_MOUSE, &key, &mouseunless you like your app crashing.And that's all I'm writing for now... You can be sure that I'm going to be eagerly disassembling the work of the other C++ authors working on the tutorial this year to get a fresh take on certain implementations.
7
u/Batmantheon Jul 10 '18
This is pretty awesome, thanks. Subscribed to this sub maybe 2 months ago when I started taking my first programming class (Java) and I've been itching to find a side project/detailed tutorial for making a game. I don't know Python, but know its an important (and also fairly easy, from what I hear) language so I think I'm going to read up on the basics and then jump in to the wiki tutorial. This'll give me plenty to sink my teeth in to outside of my college courses.
Now I just need to find some good Java tutorials for something interesting so I can use it to supplement what I'm already learning.
6
u/Taco_Chop Jul 10 '18
Repo
In my excitement to learn I've gone ahead and finished the Python 3/ libtcod tutorial so I'm a little ahead of schedule. I'm excited to start putting what I've learned to use though and start adding my own touches to the game and really making it my own.
I do have one issue from the tutorial though that I can't figure out and I was hoping someone with more experience in these matters could look at my code and maybe help me out. I can't get it to load a previous save. It appears as though saving works properly but whenever I try to load a save I just receive the error message I programmed for there being no save file to load. I thought that I followed the tutorial exactly and I can't seem to spot any mistakes that I made. I'm sure it is something simple that I just keep overlooking but any help would be much appreciated.
Once my loading issue is resolved my plan is to begin making changes to my player character and enemies to bring them in line with what I have planned for the game. Hopefully next week I will have the game fleshed out a little more and will be able to share more of how I plan to proceed with it.
6
u/domtorr Jul 10 '18
I'm doing the RL Tutorial in Unity using hybrid ECS. I'm still about a week behind but I got FoV working and modified my tileset to look nicer with solid walls instead of millions of T sections.
Would anyone me interested in me turning this into a full blown tutorial when I'm finished? I've been thinking about doing that when I'm done, as it doesn't seem like there are any good RL Tutorials in Unity yet. I plan on following the general structure/flow of the current Python one, but structured for Unity and how to set up a scene and everything I did to get it working in Unity.
New animated gif to show off
Here is my repo
6
u/Zireael07 Veins of the Earth Jul 11 '18 edited Jul 11 '18
Haxe
https://github.com/Zireael07/roguelikedev-does-the-complete-roguelike-tutorial-2018
Part 6 done in an afternoon (with only some minor niggles because Haxe's implementation of sqrt only works with positive numbers, giving NaN for negative numbers)
Fortunately, unlike what I thought when starting, it was possible to copy the entity-component system used by the Python tutorial 1:1. So that's what I am doing, sticking close to the tutorial.
Part 7 will have to wait a bit, but I'm hoping to get it done this week. Good thing HaxeFlixel has some built-in UI things (that's a definite advantage to using a framework instead of building everything from scratch).
Javascript
I think I'm gonna abandon ship, as I'm still stuck on the FOV/exploring.
6
u/[deleted] Jul 11 '18
GitHub repository
No special news this week from my Ruby/BearLibTerminal version. There's a combat system and a preliminary GUI with a health bar and message log. Here's a progress screenshot.
6
u/[deleted] Jul 13 '18 edited Jul 13 '18
Done for this week!
My code is here, and I've made a makefile to smooth the build process out a bit. I'm a fan of the concept, but makefiles are a weird syntax. Probably going to move to CMake for my next project.
I'm late this week because I did a lot of research into C++ in general and build automation stuff. I'd really like to be able to build for Linux (is that even possible? Or would I need a build for each distro?) and Windows without virtual machines, so I may be dusting off my other non-Apple laptop.
5
u/Rakaneth Jul 10 '18
I am a little behind due to some real-life drama, but I've already got the groundwork for the UI, so I should be able to catch up quickly when I can get back to this.
5
u/[deleted] Jul 10 '18
Here's what I've got so far.
Repo here.
I started last tuesday after going back and forth on what language I should do this in, but settled on TypeScript because I like being able to put it in a browser easily and it removes the barrier that is needing to download a .exe for people who want to try it. The iteration speed with webpack-dev-server is incredible as well. The page reloads in milliseconds every time I save a file, so there's no thinking about recompiling/refreshing.
I use ROT.js as a substitute for libtcod. I've needed to work around a few places where their feature sets are different. The code for rendering the HP bar ended up very different for example.
Overall the code is extremely hacked together but I focused on end results more than "code aesthetic" for now since I needed to catch up. It doesn't even really have an idea of a "game loop", instead everything is ran from the onkeydown event handler. I'm not sure that's the best long term solution!
I'm not sure where I first saw the idea of using kanji in roguelikes, but I kinda like the idea. So for now the player symbol is "私". I guess we'll see what other entity types that can fit nicely as single kanji come up.
5
u/SickWillie Goblin Caves Jul 11 '18
Barbarian! - GitHub Repo
Using C++/SDL2
Another productive week, mostly under the hood stuff. Over the past week:
Goals for the next week are to finish adding the update routines to each entity (so they actually do something when it's their turn!), and to get the UI in place (complete with the 'menus' from part 8).
5
u/resty-daze Jul 11 '18
I'm adding my repo here repo. Using lua (Love2D), all from scratch. now progression in week 3. Just fixed my computer to get continue
5
u/DerekB52 Jul 14 '18
https://gitlab.com/Derek52/Kotlin-Rogue-Game
Kotlin/LibGDX repo here. I've had a busy week, and did not get to put as much time into this game as I'd like. But, I do have a combat system working, very basic though. And I need to work on the enemy AI, and the game UI. Neither of those things totally follows the tutorial, because I haven't had the time to write some of the more advanced FOV code from scratch. And because I don't think I want to completely follow the tutorial. I have a couple game designs kicking around in my head, and they both diverge from the tutorial a good bit.
I am having one weird glitch, which is just a design problem. Lets say you are moving only on the X axis, you can have an enemy follow you on the x-axis, and it will kind of jitter up and down, in a very tiny range of motion, while moving on the X-axis, and it's because of the way I set up the enemy Ai to follow you. I was able to fix the jitter, but it made it so the enemy would no longer be able to follow you around a wall, so I had to add the jitter back in. It felt really annoying to have to add a bug back into my code. I'll fix it at some point when I have more time, or a more fleshed out game design.
My code is in desperate need of some refactoring and a little restructuring, but I still want to wait and get farther into the tutorial, before I do that, because I want to minimize how much code I'll need to move around.
5
u/jpelgrims Jul 14 '18
Awkventure - repo
Finished this weeks features. I'm starting to run into some obstacles with awk, definitely now that more complicated algorithms are required (such as pathfinding). A* would be rather hard/annoying to implement in awk, so for now I've just made all monsters move in the direction of the player, with some randomness thrown in for good measure. As it stands now, the game doesn't really need any good pathfinding, especially with the small rooms and limited fov.
Other than that I've also added basic melee and ranged combat. Dead enemies leave corpses, and if the player dies the game ends. There's a message log now, which probably needs some more work to make it intuitive to read. The interface has also been improved.
Here's an asciicast with some gameplay.
5
u/Kehvarl Jul 15 '18
Gitlab Another update that faithfully follows the tutorial. I am hoping to go back and re-implement map generation to have a few more options for interesting levels.
4
u/masterofallvillainy Jul 10 '18
This week I'm off on vacation camping at Oregon country Fair. I won't be doing any coding until mid next week. But in my down time I'm reading up on what I need to implement and will be making a list of what to do. Hopefully I'll be able to catch up pretty quickly. Cheers everyone
4
u/EsotericRogue Jul 10 '18
The livestream for Week 4 will be tonight at 8PM EDT (20:00 UTC-4). We're using Python3 and Libtcod 1.7 on Windows 10. Here're links for the repository and video archive. The forecast doesn't show a storm of hiccups, so hopefully we won't have to deal with that this week.
4
u/CrocodileSpacePope Jul 11 '18
At this point, I don't know if I can make it in time for this week's lesson, but I will catch up next Tuesday. Got a bit much stuff to do in private life and my whole department has to do extra hours at work, too.
I also reached the point where following the tutorial with Rust isn't possible any more due to Rust's very restrictive value access rules. So I need to find a solution for that, too.
4
u/_velocicat Jul 15 '18
So my summer class is taking up a bunch of time this week. I haven't been able to make much progress at all. I was able to implement some enemy AI from Trystan's tutorial so now if the enemies see the @ they chase it. They can do melee attacks but I haven't wired them up for ranged attacks. The hero can do ranged attacks with two different types of weapons. I came across one bug when I have more than a few enemies chasing me.
I've been struggling to implement an observer to listen for events to trigger certain effects, so I may try to spend some more time on that.
Trystan's tutorial has a minimal interface, so I'd like to check out the FAQ Fridays and Python tutorials for some ideas. My Java is fuzzy at best, so I'm mostly parroting Trystan's work and only tweaking a few things, so we shall see.
Cheers!
4
u/haveric Jul 17 '18
Python | JavaScript | JS Demo
It's been a busy couple weeks so I did not get through these as fast as I wanted. Following the Python tutorial wasn't too bad, but replicating some of the items in JavaScript was interesting to say the least.
I should have extra time this week though that I want to spend cleaning up and optimizing the code as well as trying to go beyond the basics of the tutorial.
I think my main frustration so far is that I feel like I'm trying to improve on the code as I go, but the tutorial has its own way of doing things, which is not what I'm used to. (That render_all function with all the variables passed in for example as well as the global functions outside of objects.) I definitely look forward to getting through the tutorial and having time to re-work everything into something a little more organized.
0
u/[deleted] Jul 10 '18
[deleted] — view deleted comment