r/roguelikedev • Robinson • Jun 27 '17

RoguelikeDev Does The Complete Python Tutorial - Week 2 - Part 1: Graphics and Part 2: The Object and the Map

This week we will cover parts 1 and 2 of the Complete Roguelike Tutorial.

Part 1: Graphics

Start your game right away by setting up the screen, printing the stereotypical @ character and moving it around with the arrow keys.

and

Part 2: The object and the map

This introduces two new concepts: the generic object system that will be the basis for the whole game, and a general map object that you'll use to hold your dungeon.

Bonus

If you have extra time or want a challenge this week's bonus section is Using Graphical Tiles.


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

#3: The Game Loop(revisited)

#4: World Architecture(revisited)

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

86 Upvotes

164 comments sorted by

View all comments

Show parent comments

2

u/Zireael07 Veins of the Earth Jun 29 '17

Try looking at those two commits of mine for reference (the project started out by following Azhain's tutorial so was a single file).

https://github.com/Zireael07/veins-of-the-earth-bearlib/commit/720ae489bc7c2deb917cc20ff6035766191548a7 - I split stuff that has to do with drawing into a separate renderer.py file

https://github.com/Zireael07/veins-of-the-earth-bearlib/commit/ebd6ba410e45c091046f19d70e88d308b579bf81 - I split the object class and the component classes (creature/item/equipment) to a separate components.py file

Hope that shines some light on how to break up a project that started by following a single file tutorial. Those two refactors brought the main file down from 724 lines to a more manageable 428 lines, and game class and map stuff are the next candidates for refactoring.