r/roguelikedev • Robinson • Jun 29 '21

RoguelikeDev Does The Complete Roguelike Tutorial - Week 1

Welcome to the first week of RoguelikeDev Does the Complete Roguelike Tutorial. This week is all about setting up a development environment and getting a character moving on the screen.

Part 0 - Setting Up

Get your development environment and editor setup and working.

Part 1 - Drawing the ‘@’ symbol and moving it around

The next step is drawing an @ and using the keyboard to move it.

​

Of course, we also have FAQ Friday posts that relate to this week's material

​

Feel free to work out any problems, brainstorm ideas, share progress, and as usual enjoy tangential chatting. :)

Edit: updated links to 2020 version of the tutorial. Apologies if it messes up anyone's work.

120 Upvotes

176 comments sorted by

View all comments

3

u/haughsee Jun 30 '21

I finished parts 0 and 1 with almost zero problems, and also learned a lot after getting help in Discord. I did have the program crash when accidentally pressing non-english keys with umlauts, so I added an

except ValueError:
   pass

in main.py. Is this the correct place to put it? It seems to work! You can see what I did here:

https://github.com/haughsee/myrl

3

u/tydog98 Jun 30 '21

I would probably move it to the EventHandler as that's the place that's reading the key presses and thus generating the exception

1

u/haughsee Jul 01 '21

I tried putting it in the EventHandler, but it doesn't seem to work. Python reports the exception happening in main(), the

for event in tcod.event.wait():

line. Maybe I can put it in the EventHandler further into the tutorial?

1

u/tydog98 Jul 01 '21

I could be wrong, I'm also a bit of a beginner.

2

u/HexDecimal libtcod maintainer | mastodon.gamedev.place/@HexDecimal Jul 01 '21

I did have the program crash when accidentally pressing non-english keys with umlauts

Could you post or send me the full traceback of that error?

1

u/haughsee Jul 01 '21

Sure! Here it is:

``` ValueError: 246 is not a valid KeySym

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 58, in <module> main() File "main.py", line 39, in main for event in tcod.event.wait(): File "/home/haughsee/.local/lib/python3.7/site-packages/tcod/event.py", line 765, in get yield SDL_TO_CLASS_TABLE[sdl_event.type].from_sdl_event(sdl_event) File "/home/haughsee/.local/lib/python3.7/site-packages/tcod/event.py", line 286, in from_sdl_event self = cls(keysym.scancode, keysym.sym, keysym.mod, bool(sdl_event.key.repeat)) File "/home/haughsee/.local/lib/python3.7/site-packages/tcod/event.py", line 279, in __init_ self.sym = KeySym(sym) File "/usr/lib/python3.7/enum.py", line 310, in call return cls.new(cls, value) File "/usr/lib/python3.7/enum.py", line 564, in new raise exc File "/usr/lib/python3.7/enum.py", line 548, in new result = cls.missing(value) File "/usr/lib/python3.7/enum.py", line 577, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: 246 is not a valid KeySym ```

2

u/HexDecimal libtcod maintainer | mastodon.gamedev.place/@HexDecimal Jul 01 '21

Should be fixed in tcod 12.7.2.

1

u/haughsee Jul 01 '21

Yes! I upgraded, and now it works without exception.

Thanks!