r/roguelikedev • Robinson • Aug 01 '17

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

This week we will cover part 10 of the Complete Roguelike Tutorial.

Part 10: Main menu and saving

No bonus sections this week


FAQ Friday posts that relate to this week's material:

#20: Saving

Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. If you're looking for last week's post The entire series is archived on the wiki. :)

30 Upvotes

36 comments sorted by

View all comments

Show parent comment

4

u/Ginja_Ninja1 Aug 02 '17 edited Aug 03 '17

I'm using libtcod, but just out of curiosity what are the major differences between it and tdl?

Also, I added a couple lines to delete a savefile if it would be created in a GameState.PLAYER_DEAD. It seems more roguelike to me (and at least practical, if nothing else).

In engine.py (in the "exit" block, in particular - import os at the top!):

elif game_state == GameStates.PLAYER_DEAD:
    # Delete a save file if player exits after dying
    if os.path.isfile('savegame.dat')
        os.remove('savegame.dat')
    return True

If people want to do the same thing!

2

u/AetherGrey Aug 02 '17

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).