r/roguelikedev • u/MetalMonkey91 • Jul 28 '25
libtcod (Python 3) *recommended Tutorial code is broken?
See title - I'm at the beginning of part 11 as a newbie. I have SOME coding experience, but not enough to help me solve the issues I'm encountering.
To make certain I didn't screw something up, I even (reluctantly) copied and pasted the files given in the github page linked at the end of part 10 to be certain it was absolutely exact.
When I try to run main py it opens the game but it just hangs until I have to force close.
Looking at the code, my editor is throwing 14 errors, seemingly mostly to do with mouse_location in the input_handlers (which was already a problem starting around part 7 or so, if I mouse over the game window it just crashes outright and has since that point.)
Another issue in the code is parent: Actor evidently overrides 'symbol of the same name in class "BaseComponent"'.
I'm not entirely sure where to go from here, as being a newbie I have virtually no clue how to correct what my editor is telling me is wrong, but there is no updated material to correct where the code went wrong.
I've tried googling the error codes, tried to find solutions but to no avail.
Any help would be suuuuuuper appreciated.
View all comments
6
u/HexDecimal libtcod maintainer | mastodon.gamedev.place/@HexDecimal Jul 28 '25
This is from tcod 19.x which has floating point mouse coordinates thanks to SDL3. Pin the version to
tcod==18.1.0to rollback these changes, or convert these values to int wherever your type checker tells you to.It isn't entirely clear what you mean, but it's possible the tutorial violates the Liskov substitution principle here and your linter is pointing that out. In that case your linter wants the override to be either removed or made explicit. You'll have to tell the linter to suppress those warnings to follow the tutorial. For example if the linter was Mypy then you'd add the comment
# type: ignore[override]to the offending lines.