r/roguelikedev • u/aaron_ds Robinson • Jul 03 '18
RoguelikeDev Does The Complete Roguelike Tutorial - Week 3
This week is all about setting up a the FoV and combat!
Part 4 - Field of View
http://rogueliketutorials.com/libtcod/4
Display the player's field-of-view (FoV) and explore the dungeon gradually (also known as fog-of-war)
Part 5 - Placing Enemies and kicking them
http://rogueliketutorials.com/libtcod/5
This chapter will focus on placing the enemies throughout the dungeon, and setting them up to be attacked
Of course, we also have FAQ Friday posts that relate to this week's material
- #12: Field of Vision(revisited)
- #41: Time Systems
- #56: Mob Distribution
- #70: Map Memory
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)
3
u/GoldenPrinny Jul 03 '18
If I want to look into it, can I use python 3.7, or 3.0 ?
•
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati Jul 03 '18
I've compiled the directory of all reported repos. So far this year we have 60 (declared) participants, 32 with public repos, and 18 different languages!
I check all posts each week for new participants/links, and you can also PM me if you'd like to make any additions or modifications. I'll be adding screenshots later on at the end of the event when we do the final sharing thread.
Thanks to everyone for participating and being so helpful, and special thanks to those who are contributing new tutorial writeups in other languages :D
13
u/Lokathor dwarf-term-rs Jul 03 '18
It's ya pal Lokathor again. We're back at it with Rust this week. We've got a few links of course:
The FOV stuff isn't too complicated in terms of the programming, but it's kinda intricate to explain from scratch, so it takes about 900 lines of markdown to explain why we're doing what we're doing. After that, making it so that there's a lot of creatures that can take turns and bump around requires that we re-think how our data is arranged a little bit, so we give each creature a unique id and do some indirection work.
This week we...
picture
11
u/HexDecimal libtcod maintainer | mastodon.gamedev.place/@HexDecimal Jul 03 '18 edited Jul 04 '18
GitLab
Using python-tcod and numpy in Python 3 with the sdlevent.py shim. I'm following the tutorial rather closely, since adding any kind of original features would jinx my project, every time.
Feel free to ask me any questions about libtcod, libtcodpy, python-tcod, or python-tdl since I'm currently the active maintainer for all of them.
11
u/toptea Jul 03 '18
Screenshot - Python Repo
Don't copy me folks. The isometric walls does kind of mess up the fov a bit. To make libtcod light up two tiles instead one, what I end up doing is make all the inner section of the walls transparent. It does give our favourite protagonist @ man the ability to peek ahead of time, but I guess (with a straight face) call this a feature instead of a bug.
Next week I'm going try jerry-rigging a state machine inside the ECS. Instead of running the components through all processors, I want to be able to pick which ones to go through depending on the current game state (eg player turn, enemy turn, targeting, inventory). I think this is the right course of action. This sound sane. Nope, don't see anything wrong with it at all.
10
u/brianbruggeman Jul 03 '18 edited Jul 03 '18
Kelte
Github | Mac | Windows | Zip | tgz
Week 02:
gallery | gif | ss1 | ss2 | ss3 | ss4 | ss5 | ss6
Week 03 Goals:
Edit: and we have a windows binary.
8
u/haveric Jul 03 '18
Python | JavaScript | JS Demo
Had some extra time last week and knew the FOV would take a bit of work so I decided to jump ahead.
I've made the decision to stick with building it in plain JavaScript, mostly for learning the algorithms behind things such as FOV, which is continuing to be a fun learning experience. Looking at my recent commits, you can see I found a much more concise version than what I originally wrote and decided to implement it instead.
Surprisingly, I didn't see much performance difference between the two (although I'm not entirely sure how accurate I can test performance in JavaScript recently thanks to the reduced precision implemented) and it performed sufficiently fast looped 10,000 times either way.
My FOV algorithm right now is:
I have some more ideas for cleaning up the tiles after these passes to potentially fix some of the inconsistencies Bresenham's creates, but would love to see what others have come up with.
Other improvements made this week:
In preparation for AI/interface coming up, I plan to implement a more robust rendering setup. I've done texture mapping to sprites before, but it's always felt clunky, so I might look to improve on those.
8
u/Sh4rPEYE Lisper Jul 03 '18
I'm back with Racket!
I finalized the architecture of the game, finding a nice mix of OOP-based models and functional datastructures. With Racket it's like that, you have a whole spectrum of choices.
When implementing the FOV, which is the same as in this article on Roguebasin, I found out that king this the OOP-style is easier at first, but you generally want to transition to a more functional implementation once the code is working. The repo ins't updated yet, because I wish to clean up the code a little bit before I publish it.
Here is a small showcase of the FOV: Imgur link. I don't like the underground setting of roguelikes too much, so I decided to implement villages, forests etc. instead of caves. In the gif I walk around my village (cough, 3 houses, cough) at night.
7
u/SickWillie Goblin Caves Jul 03 '18
Barbarian! - GitHub Repo
Using C++/SDL2
A lot got done over the last week!
I'm really looking forward to getting combat up and running in part 6, and getting the GUI up and displayed later. I've been ahead until now, and think I'll work over the next week on some path finding algorithms - what good are monsters if they can't even find and attack the player? So my goal for next week is to finish an A* and Dijkstra's implementation to begin part 6 next Tuesday.
Here's a video of what the game looks like so far!
7
u/cliffsdover Jul 03 '18
Using GDScript with Godot engine here. Following this series with very limited time is fun. Hope I can complete this. GitHub Repo
7
u/EsotericRogue Jul 03 '18
The livestream for Week 3 will be tonight at 8PM EDT (20:00 UTC-4). We're using Python3 and Libtcod 1.7 on Windows 10. Python 3.7 was released this week, I'll see if we can update to 3.7 live. Here're links for the repository and video archive. Thanks to everyone who tuned in last week!
7
u/dystheria Jul 03 '18 edited Jul 05 '18
Complete Newbie attempt in C++ 2017, using MSVisual Studio 2017 and Libtcod 1.7.0
Part-04 and Part-05 completed and uploaded to the repo.
I've started piecing together a gallery of my progress as things become more interesting now also, you can find it here.
Part-04 includes some refactoring prior to implementing the FOV, it also has a shout out to u/DontEatSoapDudley and u/thebracket thanking them both for all their wisdom thus far.
Part-05 contains updates across the board and a deviation from the original roguebasin tutorial in favour of some of the existing C++2017 headers for creating random numbers and dice rolls, as well as the use of strings instead of the old C
const char *name,convention as I'm now making a conscious effort to avoid the use of dated C practices and poor manual memory management approaches.As always, please be ruthless in your scrutiny, I consider it very valuable to see not only what I've done wrong but how I could have done something differently even if I've done it in a correct fashion.
edit: Just a warning to anyone who may have been following my attempts at re-writing the tutorial, the libtcod library is not written with the usage of strings or smart_pointers in mind, this means that when you reach "Part-07 : the Gui" a lot of things we've already implemented need to be thrown away and replaced with the older conventions, which includes reintroducing raw pointers and replacing existing strings with const char raw pointers... all in all it's a bit of a mess and although I'm going to be taking a stab at improving the old code where-ever I can I'm not experienced enough to create completely fresh work-arounds for some of the less-desirable practices used with libtcod, and re-writing libtcod is definitely beyond my current skill level.
6
u/Notnasiul Jul 03 '18
Tutorial week has catched me up and I'm still banging my head against Phaser3 and its lack of documentation - or my lack of skills to find it. I managed to adapt the platformer boilerplate and strip it down to its basics, and the player moves around already. When rendering the map, an ASCII console is out of the equation. I tried tilemaps, but most samples are not working yet in the Phaser3 site so. I'll probably render everything as a simple tinted image for now (hey, an all-tinted squares may even look good if I keep things simple!)
I hope I'll do it during this week, otherwise next week I'll continue the basic tutorial in Python.
6
u/Rakaneth Jul 03 '18
Werewolf
With flood-filling, I've managed to implement regions for my FOV; the player can only see map tiles in his region, but may be able to detect objects outside of it if they have a smell (since the protagonist is a werewolf with heightened senses). The first part is implemented; the second part is not, since the player is still the only object known to the game.
6
u/[deleted] Jul 03 '18 edited Jul 05 '18
Hey all you D Language Tutorial people, I have some bad news. If you've been following the repo, you'll notice it hasn't been updated in a week. Last Wednesday there was an unexpected death in my family and I had to quickly hop on a plane and fly across the US, forgetting my laptop at home in the process. I'm back as of last night and have been trying to get something done for this week but it's just not going to happen.
I'll be posting to the repo and website as I play catch-up this week. So if you're following, keep an eye there or look at next weeks post for a link. Sorry about the delay but I am working on getting some content out there for y'all.
EDIT: Part 04: Colors and FOV is out now, by comparison part 05 should be much quicker. I ran into a bug that took about 2 hours to track down :/
6
u/Zireael07 Veins of the Earth Jul 03 '18
Haxe
Repo
Week 3 done in an afternoon. I'm finding productivity in Haxe almost as high as in Python/Lua - the types and braces are much less of a slowdown than I thought.
The only hitch was when I messed up the logic for finding entities at x,y and the compiler wouldn't let me proceed claiming "missing return: Entity".
Javascript
I said I like it more than Javascript, and it holds - I tried doing part 4 and while the FOV works well enough out of the box with rot.js, I messed up when trying to add remembering explored tiles. x in visible_tiles keeps returning false even though I am printing the array and I can see the value IS in fact in the array... So, weirdness that JS is supposedly famous for (wtf_javascript seems to be a memo) and even more reason for me to dislike it.
6
u/CrocodileSpacePope Jul 03 '18 edited Jul 05 '18
GitHub Repository
Language: Rust
Library: tcod-rs
This week, I didn't run into as many issues as last week, there were few obstacles, still. My understanding of Rust itself gets better with every LOC i write, so I handled those pretty fast.
I keep as close to the tutorial itself, so the added features are pretty much what the tutorial added - FOV and blocking enemies.
Things which I learned today:
As always, I appreciate any kind of feedback.
6
u/[deleted] Jul 03 '18
Got this week's stuff! I spent a whole lot of time setting up VS Code to be a build/debug environment, and I really like it. There are some weird errors I'm getting from it not playing nice with libtcod. But overall it's a great environment!
I'm probably going to go off the rails and learn C++ properly sometime in the next few weeks, because I'm really enjoying this series so far. Other than that, I'm kind of unhappy that my map is the size of the window, and was wondering if anyone had tips on making the map larger and doing some "camera" management stuff with libtcod.
6
u/DerekB52 Jul 03 '18 edited Jul 05 '18
I tried to get a head start on the FOV over the weekend, and didn't have the time. Luckily, it didn't take me too long to do. I diverged from the tutorial a bit, since I'm not using python or Libtcod, I was kind of on my own here. The tutorial doesn't really go over how to craft a FOV algorithm. I came up with something on my own, which kind of mimics the game the tutorial builds(i cloned the repo and downloaded the finished product yesterday). It took me like 15 minutes to implement. I'm sure it isn't super efficient, and it has a different feel than the game the tutorial builds, but it works well enough for what I want to do, so I'm happy with it. I kind of feel like a genius for having it actually work. I thought I'd hit "Run", and my computer would catch fire from 1000 errors.
I also rewrote my GameMap class into Kotlin from Java, so I'm back to 100% Kotlin which feels cool.
repo for those interested. The FOV stuff is in entities/Player.kt and Tile.kt https://gitlab.com/Derek52/Kotlin-Rogue-Game
I'll get working on the next section probably tomorrow. Hopefully, I'll be on the same page as the tutorial, or I'll just totally diverge and start making components from scratch that are similar to the ones in the tutorial.
Edit: I've finished adding enemies into the game. They are stationary, but you can collide with them, and the game will print to the terminal telling you, that you have collided with the enemy. Also added the player and enemy turn, gamestates. I'd like to work on my FOV some more, but I still don't know what type of FOV I want in my game, so I don't know what I want yet. I'm looking forward to reading and playing with different FOV algorithms pretty soon though.
6
u/Taco_Chop Jul 03 '18
Hey everyone!
I've always wanted to make a game but I have almost no coding experience so when I saw that they were doing a tutorial series I decided it was the perfect time to start. I'm following the Python 3 / libtcod tutorial and I'm having a blast and I really feel like I'm learning a lot. I've been working on my game whenever I have free time and I just reached part 10. I've made a lot of mistakes along the way but figuring out what I did wrong has taught me a lot. I haven't deviated to much from the tutorial yet, mostly just some color changes and small things like that. I plan on waiting until I finish the tutorial before getting too crazy experimenting. I have everything I want to do for my game all planned out I just need to learn enough to implement everything. I plan on figuring out how to get it on GitHub tomorrow so when I do I will update my post with a link to it.
5
u/[deleted] Jul 03 '18
GitHub repo
Following along with Ruby and BearLibTerminal.
I debugged some oddities in the map generation algorithm, so we've gone from this to this.
The FOV algorithm I used is a shadowcasting FOV implementation found on Roguebasin, so it didn't take a lot of work to put it in.
The map now keeps track of which tiles are explored. I tried out a few different ways to render this.
I actually like this look quite a bit. It seemed too ambiguous, though, because explored floor tiles look the same as unexplored tiles.
This version might be good if I were making some sort of cyberpunk underwater roguelike (which actually sounds pretty cool).
I took a GIF of the design I ended up with (something more conventional), which also shows most of this week's progress, here.
5
u/okiedad Jul 03 '18
My Github Repo
Language Python 3.6.2 32-bit with Libtcod on Windows 10 using Visual Studio Code and GitKraken.
I am following along and just finished Week 2/Part 3. I'm not setting up different branches for each part and just issuing my commits directly to my master. I may do that with the next tutorial I go through so as to learn branching etc.
Anyway, I've tweaked the color scheme a little because I didn't like the blues and I've tried to comment a bit more than you are adding and I'm trying to be very descriptive in my commit messages.
If anyone checks it out , I'm open to criticism.
5
u/_velocicat Jul 04 '18 edited Jul 04 '18
Got very busy with my summer class so I haven't had much time to work on this. I had a few minutes to spare so I'm currently working ranged attacks and want to begin to implement some AI for the enemies.Unfortunately my character can't equip a ranged weapon, I must have implemented something incorrectly from Trystan's code. If I can get this sorted out and get ranged attacks working I'll be happy with the progress for this week. Cheers!
edit: Got ranged weapons working. I also added some wandering AI from Trystan's tutorial but my enemies kept attacking themselves.I have that worked out also. I've been starting to use Git and following along with the Git book mentioned by u/SickWillie
5
u/jack_is_online Jul 04 '18
Code is here. Because RLNET has no built-in FOV algorithms the same way libtcod does I rolled my own based on the algorithm in this article. It works pretty well although I may switch to a different one in the future. Enemies haven't been implemented yet but will be son.
5
u/cld Jul 04 '18
Parts 4 and 5 complete: https://gitlab.com/hellocld/RogueLikeDevTut2018
Biggest issue I've had so far is Python's lack of curly brackets and emphasis on strict whitespace useage. I do most of my day job/other projects in C# and C++, so getting used to Python's "hey man, just write stuff" syntax without blocking elements in brackets really throws me for a loop sometimes.
4
u/Fulk0 Jul 09 '18
Hi guys! I'm a little late to the party but I started following this recently. I'm following pretty close, but added some things of my own. I'm trying to get a mix of console/gameboy feel to it. Added a cellular automata map generation, but it still needs tweaks.
Repo! | Screenshot!
3
u/domtorr Jul 06 '18
I'm a bit behind, but I redid everything using hybrid ECS in Unity. Got map generation done finally. So only done with part 3 so far.
I'm not planning on using colliders for FoV, not sure if I can still use raycasting some how. May have to mathematically figure out how to do it and make an FoV System with some components for data. Also not quite sure how I'm going to do turns yet.
Fancy animation
Repo is here
3
u/masterofallvillainy Jul 06 '18
I'm new to programming and have spent a lot of time just learning coding recently. I have also been drawing graphics for a game for a while now and decided to try and make a graphical roguelike using my graphics. I've loosely been following the tutorial, but I'm using pygame instead of libitcon(spelling?). So I've been devling into multiple tutorials and examples to piece this thing together. I'm a little behind getting the same functionality as the tutorial, but I did make the framework for updating a fog of war(I'm covering the map with two bitmaps, one solid black that I punch holes into as the player moves and a tranparent black with a hole around the player that shows the already explored areas.)
I have graphics for isometric walls, but am not sure how to implement them. (the walls are taller than the tiles and cover floor spaces behind them.)
but anyways, here is a screenshot of 'Oubliette': https://imgur.com/Is8W625
3
u/jpelgrims Jul 07 '18
Haven't been able to do much this week due to work. Still, I managed to add monster spawning and some improved menu's.
Repo - Screenshot
3
u/Kehvarl Jul 08 '18
Gitlab
Parts 4 and 5 of the Python tutorial are completed in my repo. I did some more work on my broken map generation; choosing to keep the incorrect code as it generates more interesting maps, and just making sure each drawn room connects to another drawn room as well as however many rejected rooms.
0
u/[deleted] Jul 03 '18
[deleted] — view deleted comment
0
u/[deleted] Jul 03 '18
[deleted] — view deleted comment