Author Topic: First Roguelike on Python 3  (Read 9865 times)

Mathematikus

  • Newcomer
  • Posts: 2
  • Karma: +0/-0
    • View Profile
First Roguelike on Python 3
« on: July 28, 2015, 03:39:15 PM »
Lately I have been learning Python 3 I would like to try and make a simple roguelike.

The apparently popular "Complete Roguelike Tutorial, using python+libtcod" uses Python 2.7. and says that libtcod is incompatible with Python 3.
However I have found a library called tdl (https://pypi.python.org/pypi/tdl/1.5.0) which promises to be a similar library that works with Python 3.4.
Does anyone here have experience with it? Is it similar enough to libtcod that one can follow the old tutorial?

For context:
I'm not very experienced programmer, but I can handle basic things and am not afraid of math or logic.
Admittedly there are things in programming that baffle me, although hopefully that can be surpassed.

So: Is it good idea for a beginner to try to make a roguelike in Python 3?
I would prefer to do this rather than revert to Python 2.7.
I could also imagine learning an engine (Unity? Godot?), but learning an actual language seems like it could be a good time investment.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: First Roguelike on Python 3
« Reply #1 on: July 28, 2015, 09:49:03 PM »
It's an idea. It's not good or bad I guess. Creating a roguelike (even a simple one) if you are not experienced in programming or game development may possibly be a bad idea, but it can be also a learning process. I would start with simpler projects.

Untrustedlife

  • Rogueliker
  • ***
  • Posts: 162
  • Karma: +0/-0
    • View Profile
    • My Blog
    • Email
Re: First Roguelike on Python 3
« Reply #2 on: August 02, 2015, 03:31:13 AM »
I personally dislike Jice's coding style .Though libtcod is a great library for making roguelikes and hes a very cool guy.
(His c++ tutorial's code is cringe inducing for people who have been formally taught, but great for beginners (IMO))
when I followed it I basically rewrote most of his code to fit conventions, but thats just me)

The python tutorial isn't by him I believe.


But the c++ library is mostly up to date.
You might be better off using that. Its a bit more confusing for beginners then python, but it is also 'lower level', which means you get more into the minutia of programming when using it.
« Last Edit: August 02, 2015, 03:37:46 AM by Untrustedlife »

SteveRL

  • Newcomer
  • Posts: 1
  • Karma: +0/-0
    • View Profile
    • Email
Re: First Roguelike on Python 3
« Reply #3 on: September 06, 2015, 03:22:36 PM »
The apparently popular "Complete Roguelike Tutorial, using python+libtcod" uses Python 2.7. and says that libtcod is incompatible with Python 3.
However I have found a library called tdl (https://pypi.python.org/pypi/tdl/1.5.0) which promises to be a similar library that works with Python 3.4.
Does anyone here have experience with it? Is it similar enough to libtcod that one can follow the old tutorial?

Hi,

I'm doing essentially the same thing myself.  I'm not a professional programmer by any means, although I suspect I may be slightly more advanced than you are, based on what you've said about yourself.  I've been working in software QA (read: "programmer-adjacent") for several years now, but I've only recently begun to learn Python as a specific language.

I'm using Anaconda as my dev environment for Python 3.4, and untdl as my roguelike library (itself a port of tdl, which you mentioned.)  I'm following along the same "Complete Roguelike Tutorial" which you mentioned and altering the code snippets as necessary to make it work with untdl rather than libtcod.

I wouldn't say this is easy, by any means, but it's doable.  If you're up for a challenge and a learning experience, it would certainly be educational.  Untdl's documentation is not always as complete as one might like, which can make it tricky to figure out what you need to do differently.  But basically, whenever you see the tutorial calling some function from libtcod, you know you need to find an equivalent function from untdl.  The mapping is not always one to one, so this can take some digging.  The rest of the code can be left largely unaltered.

If you want to try this as well, I'll just say this: use the 32-bit version of Anaconda, even if you're in a 64-bit operating system.  Untdl apparently does not fully support 64-bit.

Also, when it came time to start generating random room sizes, I just used the standard Python "random" library.  I'm not sure if untdl has RNG functions like the ones libtcod uses in the tutorial, but why reinvent the wheel?
« Last Edit: September 06, 2015, 03:25:49 PM by SteveRL »