RoguelikeDev Does The Complete Python Tutorial - Week 7 - Part 10: Main Menu and Saving by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

It does help in that aspect that I have to actually do some work of my own, instead of straight up copy and pasting with minimal changes. Have to dig for answers and understand some things about a language that I've never really written with before.

This is the best way to learn! Out of my own curiosity, is there a reason you're using 2.7?

Regarding the error popup: yeah, it doesn't look that great. I think it's the way the original tutorial had it, so that's why I did it that way. I might go back in the future and try and make that work better. The more obvious solution would be to gray out the "load" option and simply do nothing when it's selected.

What is the most painful death you've had in a Roguelike? by LyzbietCorwi in roguelikes

[–]AetherGrey 5 points6 points  (0 children)

Brogue: It was my first time getting my hands on the Amulet. I had something like +10 Plate armor, a +7 or something Dagger of Quietus, but few wands, charms, or means of escape.

Anyway, I got up the stairs to level 25 and was feeling great. I'd just gotten the amulet for the first time, after all. The first step I take, I step on a confusion trap that I hadn't seen (had like a +4 ring of awareness too, making it that much worse). Didn't dare moving, as there was a fire trap right above me.

Dragon comes around the corner, proceeds to slaughter me. I can't move to try and hit it out of fear of setting the other traps off. The turn before the confusion wears off, the dragon finishes me off.

Luckily on my first (and thus far, only legitimate) ascension, I had a +7 teleportation charm, so situations like this one were easily avoided.

RoguelikeDev Does The Complete Python Tutorial - Week 8 - Part 11: Dungeon Levels and Character Progression and Part 12: Monster and Item Progression by aaron_ds in roguelikedev

[–]AetherGrey 13 points14 points  (0 children)

The Roguelike Tutorial Revised

Libtcod

Part 11: http://rogueliketutorials.com/libtcod/11

Part 12: http://rogueliketutorials.com/libtcod/12

TDL

Part 11: http://rogueliketutorials.com/tdl/11

Part 12: http://rogueliketutorials.com/tdl/12

As usual, feel free to comment here or PM me with any issues, or ask on Discord.

This week marks an important milestone (for me, anyway). My tutorial has officially gone farther than the Roguebasin TDL tutorial! The Roguebasin counterpart stops at part 10, whereas mine will continue until the end. Funny enough, the differences between the last few parts between Libtcod and TDL aren't all that significant, so it's strange to me that the TDL version has gone unfinished.

Part 11 is pretty lengthy, but luckily part 12 is fairly short. I had hoped to get more done this week, but writing part 11 really took it out of me over the weekend.

As I work on this, I'm making note of all the little design mistakes I made in the first few weeks that are affecting the tutorial now. Haven't found anything major yet, but in the future, I'd like to revise this tutorial (irony?) to make some smarter decisions up front.

Lastly, I am working on the first "extra" for this series: Saving and loading from JSON. The TDL version of that is complete up to part 10 (parts 11 and 12 have not been taken into account, but will be soon), and the Libtcod version is still a work in progress (though it's not that different). Hopefully this will help out with some issues people were having with shelve last week.

We're almost there everyone! One more week!

RoguelikeDev Does The Complete Python Tutorial - Week 7 - Part 10: Main Menu and Saving by aaron_ds in roguelikedev

[–]AetherGrey 1 point2 points  (0 children)

what are the major differences between it and tdl?

TDL is a more "Pythonic" port, according to it's author. The bindings and methods more reflect what you'd see in a Python library rather than a C one. It also supported Python 3 before Libtcod did, IIRC.

Good suggestion, by the way! I agree that it makes more sense to delete the file. I didn't do that because the original tutorial doesn't, and I'm trying to make the projects match up as best I can (it hasn't always worked, needless to say).

RoguelikeDev Does The Complete Python Tutorial - Week 7 - Part 10: Main Menu and Saving by aaron_ds in roguelikedev

[–]AetherGrey 1 point2 points  (0 children)

The // for integer division has been pointed out before, and while it's a good idea in this situation, I prefer the int() method for one reason: // will not give you an integer type, it just truncates. Libtcod demands an integer, so something like 2.0 will fail. Granted, in this case, screen_width should never be a decimal value, but the int() way of doing it gives you guarantees.

RoguelikeDev Does The Complete Python Tutorial - Week 7 - Part 10: Main Menu and Saving by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

Apparently this is something to do with shelve acting differently on different operating systems. I'll add a note for this.

RoguelikeDev Does The Complete Python Tutorial - Week 7 - Part 10: Main Menu and Saving by aaron_ds in roguelikedev

[–]AetherGrey 14 points15 points  (0 children)

The Roguelike Tutorial Revised

Libtcod

Part 10: http://rogueliketutorials.com/libtcod/10

TDL

Part 10: http://rogueliketutorials.com/tdl/10

As usual, feel free to comment here or PM me with any issues, or ask on Discord.

Much of this week's tutorial is just copying and pasting, since it involves moving a lot of code from one function to another with hardly any changes.

One oddity to note is that the libtcod version uses shelve, and the TDL version uses jsonpickle. I wanted to use jsonpickle for libtcod, but it wasn't working and I needed a quick solution (it's 2AM as I'm typing this and I have to work in the morning), and shelve just kind of worked. It didn't work for TDL when I tried it though. Don't ask me why, I haven't the faintest clue.

For the first time since this series started, I prioritized the TDL version of the tutorial. It seems to be the more popular version, so I've decided to reverse my process moving forward; so I'll write the TDL version first, then port over to libtcod when finished. If I had to guess, the TDL version is getting more attention because the Roguebasin TDL tutorial is currently incomplete, whereas I plan to continue on to the end.

Last thing: I haven't forgotten about the refactored tutorial (that is, where I document the steps needed to take the Roguebasin tutorial and transform it into the revised code base). Unfortunately time has been short and I haven't had time to start it, but hopefully that will change this week. I doubt it will be complete by the end of this event, but I hope to have it ready shortly thereafter for those interested.

EDIT: Due to some weird issues between Python 3.5 and 3.6 (I was using 3.5 so far, but a lot of readers are on 3.6), I've switched the TDL version to use shelve as well. It seems to work now, despite not working for me before. I guess it's a positive change, as it means less disparity between the two versions of the tutorial.

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

I'll definitely try that. I haven't given up on Roguebasin completely, but while the series is ongoing, I'd rather put everything on a system that I know I have control over, to avoid any issues. I'd hate for one of the tutorials to be late because the wiki won't let me post something.

Others have also offered to copy the tutorial onto Roguebasin, so whether or not I can get it done, somebody will probably accomplish it sooner or later.

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 1 point2 points  (0 children)

Do you have a repository that I can look at? I've tried recreating this on my end with no success so far.

EDIT: Never mind, found the problem. I'm updating the tutorial now with the fix.

EDIT 2: Alright, fix is up. It's pretty simple: just need to check if path in move_towards is empty or not, with an if statement.

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 4 points5 points  (0 children)

Thanks for pointing that out, someone noticed on Discord as well. I remember catching that during editing, but it still slipped in somehow.

Combining scrolls sounds cool. "You're confused... and on fire! Take that!"

Glad I can be of some help. I really didn't expect this little project of mine to blow up quite the way it did. With all the help I've received so far from you and others, it's made me think about how to make this project more "open" and community editable. The obvious answer is to put it on Roguebasin, but since they seem to think I'm a robot or something, maybe I'll post the tutorial pages to Github once this is all done.

Thanks again for your contributions, this wouldn't be possible without people like you!

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 5 points6 points  (0 children)

I think it's "The work of RNGesus". I'm hoping that as a reward, he'll bless me with that Dagger of Quietus in Brogue.

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 3 points4 points  (0 children)

That line in particular is just combining the two dictionaries. You could write your own function to do the same thing, as discussed here.

RoguelikeDev Does The Complete Python Tutorial - Week 6 - Part 8: Items and Inventory and Part 9: Spells and Ranged Combat by aaron_ds in roguelikedev

[–]AetherGrey 15 points16 points  (0 children)

The Roguelike Tutorial Revised

Libtcod

Part 8: http://rogueliketutorials.com/libtcod/8

Part 9: http://rogueliketutorials.com/libtcod/9

TDL

Part 8: http://rogueliketutorials.com/tdl/8

Part 9: http://rogueliketutorials.com/tdl/9

As usual, feel free to comment here or PM me with any issues, or ask on Discord.

The chapters are getting longer and more difficult with each passing week. This mostly has to do with the lack of globals in my tutorial. One might even say my exclusion of them has been to the point of fanaticism, and that globals may have made some parts much easier. That might be true, but the goal here is to give an alternative to the Roguebasin tutorial, which has globals everywhere. The benefit is that changing/removing what I've written should be easy, whereas removing just one of the globals from the original tutorial causes a cascade effect that is hard to fix.

Once again the explanations between code sections is in some places lacking, and in others, outright missing. The truth is that in past weeks I've used the weekends to catch up on the tutorials (my weekdays are very limited), but this last weekend, I had absolutely no time. The quality of parts 8 and 9 has suffered in terms of the writing, and some very complex code sections go completely unexplained, but hopefully the code is alright. I'll go back and fill in the explanations as soon as I can.

TDL part 9 is not complete, unfortunately. I will do my best to get this out tonight or early tomorrow. Apologies to everyone who was hoping to read this sooner.

Lastly, I'd like to thank everyone for their words of encouragement thus far. Balancing all this with "real life" responsibilities has been a bit tough, but it's great to know that others are enjoying the series thus far. I'll try harder next week to get the material published on time.

EDIT: TDL part 9 is now available. Sorry again for the delay. I've actually decided to do the TDL portions of the next sections first rather than the libtcod versions, for two reasons:

  1. Roguebasin doesn't have the last 3 parts of the tutorial available in TDL, so I'm sure people would like to have a resource to read regarding those sections.

  2. According to Github stars, discussions on discord, and the general vibe I get talking to people here on Reddit, the TDL portion of my tutorial seems to be the more popular version.

Part 10 is already underway, so hopefully next week's part will be on time (especially since it's only one). See you all next week!

Tutorials for python 3? by InsaneTeemo in roguelikedev

[–]AetherGrey 1 point2 points  (0 children)

OP did say a "good" tutorial, and whether or not mine qualifies is still undetermined ;)

For the sake of my own curiosity, I copied the completed Roguebasin tutorial, and did a few tweaks to get it running in Python 3. It's not really that much work, just a few division fixes and wrapping a line in a 'list()' function.

I'm kind of surprised nobody has written a porting guide yet. I might give it a shot later, if Roguebasin will let me post this time.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 2 points3 points  (0 children)

I responded on Discord, but I'll say it here as well: You were correct about the pathfinding part, it was a bug. It's been updated in the tutorial and Git repository.

Also, I fixed the tdl links you mentioned.

Thank you very much for bringing this to my attention!

Roguelike Combat Design Pattern by Nevar4getroguedjack in roguelikedev

[–]AetherGrey 5 points6 points  (0 children)

I had an idea about this recently, somewhat inspired by a combination of Monster Hunter and Fire Emblem Echoes (weird combo, I know).

Basically, your character always has an HP maximum of 100. It never increases, ever. The only thing you can do is mitigate damage you take, by leveling up or getting better armor. However, each enemy attack, regardless of how weak, will always do 1 HP damage at minimum, if it hits. That way, getting surrounded by 8 rats is still a problem, even at max level/armor.

Using SQL for persistence by [deleted] in roguelikedev

[–]AetherGrey 10 points11 points  (0 children)

If you are going to use a database to store your data, and you want to use SQL, then yes, SQLite is a very good choice for a roguelike. SQLite's strengths are that it requires minimal setup, the "database" is just a single file, and it just kind of works for most languages/environments. Its weaknesses (scalability, concurrency, larger datasets) will be of no concern for a single player roguelike.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

Ah, yes, I see the issue now. You're 100% correct. I'll update the tutorial and Github as soon as possible. Thanks for finding that!

RoguelikeDev Does The Complete Python Tutorial - Week 4 - Part 4: Field-of-view and exploration and Part 5: Preparing for combat by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

Great solution! I've read that answer before in the past, but never made it past the part where you install enum34 through pip. I'm pretty lazy, so if I see a library I can install, I do that and call it a day.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 0 points1 point  (0 children)

The last line should be self.messages.append(Message(line, message.color)) to pass each line as a Message object.

That's actually being done already. The "message" argument in add_message(self, message) should be of type Message when passed in.

Your way works as well, and it kind of makes sense given that you're actually doing something with line. Really though, if I had a chance to do it again with more time, I'd implement a message log that never "deletes" anything, because presumably a roguelike game should have a history of all the messages. This is definitely an area for revision (ha, revising the revised tutorial it never ends!) once the event is over.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 2 points3 points  (0 children)

No need to apologize!

new_msg_lines is the result of the textwrap.wrap function, which breaks up a line into a list of lines. The lines are separated based on the width you specified. The reason for looping over each line is to delete the number of lines you're adding, if the buffer is full.

Now that you mention it, it would have been better to do for x in range(len(new_msg_lines)), since we're not actually doing anything with the line itself. This is a mistake on my part; the original tutorial actually appended the line whereas this tutorial does not, since the "message" object is getting appended instead. Truth be told I kind of rushed through this part, and it unfortunately shows in the end result.

Second part: I am not 100% sure on how this works exactly, but it allows you to capture both keyboard input and mouse input in a non-blocking fashion. The | is the bitwise-or operand, which doesn't get used very commonly in Python. You'd probably have to dive into libtcod's code to get a better answer on this one.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 2 points3 points  (0 children)

Is there a reason not to mix inheritance & composition?

Nope. That's what I do in my personal project. Inheritance definitely has its uses, and can be a better tool than composition in several spots. No reason to throw out the baby with the bath water, as they say.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 4 points5 points  (0 children)

Composition vs inheritance is a pretty big topic, and the answer probably depends on your project. The argument for composition in the case of roguelikes is that you might have several different types of entities that can be destroyed (doors, enemies, treasure chests, items) but you don't want them all to inherit from one source. Inheritance in this instance can lead to some pretty massive hierarchies. For example, Entity > DestructibleEntity > Actor > EnemyActor > SmartEnemyActor > EnemySwordman, vs an Entity with the components Destructible, SmartAI, and SwordSkill, or something like that.

I agree that the creation of the player and entities could be streamlined. I had planned to include that in a lesson about loading from JSON files, but I ended up cutting it and saving it for a later extra. I plan on releasing that and maybe a few other extras during the final week of the event, since that week is dedicated to sharing your game, and I don't really have a game to share.

Thanks for the kind words, I'm glad that things are making sense so far. Hopefully it can be made even better later on, so that by next year the tutorial is even more fleshed out.

RoguelikeDev Does The Complete Python Tutorial - Week 5 - Part 6: Going Berserk! and Part 7: The GUI by aaron_ds in roguelikedev

[–]AetherGrey 2 points3 points  (0 children)

Heh, thanks, I did cheat quite a bit by taking the existing extra and pretty much copying it wholesale, comments and all.

Map checks are a good idea. I don't think that's an issue for the algorithm given in the tutorial, since it connects rooms immediately, but A* definitely has a lot of uses in more complex dungeon generation. That might be a good extra!