Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

python roguelike from scratch, how to start?

1,774 views
Skip to first unread message

Joe Clark

unread,
Dec 5, 2010, 3:43:36 PM12/5/10
to
Hi all, yet-another-first-roguelike post here. I've set before myself
the task to learn Python and build a roguelike in the process. I
quickly found the tutorial at Roguebasin and Kooneiform's tutorial,
both of which use libtcod. I tried the first few steps, though, and
couldn't get it even to load libtcodpy.py... PROBABLY because as a
brand new Python programmer, I went with the latest version (3.1)
which is backwards-incompatible with everything previously written in
Python, like, ever.

For reference, I'm using Windows 7 and I have previous experience with
Perl, Java, and other programming languages (especially PHP) but it's
been years and I'm rusty, so consider me an advanced hobbyist when it
comes to programming.

While libtcod seems like a great resource, I feel like it provides
maybe a little too much work already done for me, and I'd like to go
through the learning process myself. So... what's a good alternative
first step? Do I gather correctly that "curses" is the library for
drawing a text console? If so, which implementation, how does one
install it, and how do I draw my first window and "@" symbol?

(By the way, when it comes to installation, I'd like to put all files
in a single directory so that I can carry my game around on a thumb
drive and run it on other Windows computers. So if there's a choice,
I'd rather not install libraries in my Python root directories... not
sure exactly what my options are though.)

George Oliver

unread,
Dec 5, 2010, 8:41:24 PM12/5/10
to
On 12/5/2010 12:43 PM, Joe Clark wrote:

> While libtcod seems like a great resource, I feel like it provides
> maybe a little too much work already done for me, and I'd like to go
> through the learning process myself. So... what's a good alternative
> first step? Do I gather correctly that "curses" is the library for
> drawing a text console? If so, which implementation, how does one
> install it, and how do I draw my first window and "@" symbol?


hi, I wrote the Kooneiform articles, I admit I'm a little biased toward
libtcod :). But there are a few other libraries I've been meaning to try
out too. You can't go wrong looking at the Roguebasin pages to start:

http://roguebasin.roguelikedevelopment.org/index.php?title=Python#Roguelike_games_in_Python

http://roguebasin.roguelikedevelopment.org/index.php?title=Category:Library

Many of those Python RLs have source available so that'll get you
started. It'll be a little more challenging using Windows and Curses but
I think it's doable.

You also could always go with something like Pygame and simulate a
console as libtcod does, but then of course you couldn't play in a
terminal.


hth, GO

Joe Clark

unread,
Dec 5, 2010, 9:27:47 PM12/5/10
to
On Dec 5, 5:41 pm, George Oliver <georgeolive...@gmail.com> wrote:
> hi, I wrote the Kooneiform articles, I admit I'm a little biased toward
> libtcod :). But there are a few other libraries I've been meaning to try
> out too. You can't go wrong looking at the Roguebasin pages to start:

Hi George, thanks for the articles, I'll certainly use them as I flesh
out the game. Certainly libtcod is a great resource if I were making
Roguelikes on a regular basis... for now, though, I just want to make
one as an exercise in programming.

So far I've figured out that WConio is the library for controlling
terminals (like curses on Linux) but am having trouble getting it up
and running. The documentation (http://newcenturycomputers.net/
projects/wconio.html) says "Place _WConio.pyd and WConio.py in a
directory in your Python path." I've done so and am getting the error
"DLL load failed: %1 is not a valid Win32 applicaton." when I try to
import WConio. Perhaps my problem is that I'm running 64 bit windows
and WConio prefers 32-bit? I have no other hypotheses at the moment.

I'll take a look at UniCurses, thanks for that link!
I wasn't able to find any information about a library called simply
"console", perhaps because it's difficult to Google nouns like that.

George Oliver

unread,
Dec 5, 2010, 9:41:39 PM12/5/10
to
On 12/5/2010 6:27 PM, Joe Clark wrote:

> So far I've figured out that WConio is the library for controlling
> terminals (like curses on Linux) but am having trouble getting it up
> and running. The documentation (http://newcenturycomputers.net/
> projects/wconio.html) says "Place _WConio.pyd and WConio.py in a
> directory in your Python path." I've done so and am getting the error
> "DLL load failed: %1 is not a valid Win32 applicaton." when I try to
> import WConio. Perhaps my problem is that I'm running 64 bit windows
> and WConio prefers 32-bit? I have no other hypotheses at the moment.
>
> I'll take a look at UniCurses, thanks for that link!
> I wasn't able to find any information about a library called simply
> "console", perhaps because it's difficult to Google nouns like that.

I've seen similar errors in the libtcod forums when 64-bit Python users
attempt to use the 32-bit libtcod Python binding; you may just have to
use a 32 bit Python installation for certain libraries. Something like
virtualenv might help you out here as you start to experiment. I've also
heard of people using PDCurses for Windows but have no experience with
that myself.

Sorry, when I wrote 'console' I was just using the term generically. :)

Joe Clark

unread,
Dec 5, 2010, 10:07:29 PM12/5/10
to

Same thing is also happening with UniCurses and the PDCurses.dll ...
"%1 is not a valid Win32 application". I suppose it'd be much easier
on me if I just switched to a 32 bit Python installation. That is,
unless some helpful member of the community replies in the next 24
hours with an awesome solution... (dramatic pause...)

On an unrelated note, am I the only one who sees libtcod and
immediately thinks of T. Coddington Van Voorhees VII?

Joe Clark

unread,
Dec 5, 2010, 10:30:41 PM12/5/10
to
Hmm... this is interesting: a curses "extension" for 64-bit windows:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Importing... successful!
The following program, run by double-clicking, opens a window
(interestingly, the menu bar has the Python icon, not a command prompt
icon, and it reads C:\Python31\python.exe), prints hello world in the
top row, and then does nothing and doesn't respond to clicks. If run
from the command line in a command prompt window it doesn't create a
new window but does print hello world and is similarly nonresponsive.

So, I think I can use this version of curses... if only there were
some documentation!

Joe Clark

unread,
Dec 5, 2010, 10:55:21 PM12/5/10
to
Answering my own question, I found this: http://docs.python.org/howto/curses.html
And it's getting me started.

Mingos

unread,
Dec 13, 2010, 10:44:55 AM12/13/10
to
W dniu 2010-12-06 04:07, Joe Clark pisze:

> On an unrelated note, am I the only one who sees libtcod and
> immediately thinks of T. Coddington Van Voorhees VII?

Yes :D

Jeff Lait

unread,
Dec 13, 2010, 11:16:34 AM12/13/10
to
On Dec 5, 3:43 pm, Joe Clark <joeclar...@gmail.com> wrote:
>
> While libtcod seems like a great resource, I feel like it provides
> maybe a little too much work already done for me, and I'd like to go
> through the learning process myself.

Why not just ignore the extra features of libtcod and just use it as a
framebuffer?

The libtcod has one of the better console interfaces for just saying
"I want a character of colour X to show up at location P".
--
Jeff Lait
(POWDER: http://www.zincland.com/powder)

0 new messages