building a web interface

Shel joralemonshelly at gmail.com
Sat Nov 20 20:20:53 EST 2010


X-No-Archive:Thanks for your advice.  Will take a look at
rickadamsadventure.org.  Although I am not actually creating an
adventure game, I'm sure it will be helpful.

Sorry I wasn't clear about the db part.  Most of the data has already
been written and/or generated and tested with the code.  I do plan to
finish all the database stuff before going to the front end, but am
just thinking ahead about how to do the interface.


On Nov 20, 4:10 pm, Martin Gregorie <mar... at address-in-sig.invalid>
wrote:
> On Sat, 20 Nov 2010 14:40:16 -0800, Shel wrote:
> > Hello,
>
> > I am pretty new to all this. I have some coding experience, and am
> > currently most comfortable with Python.  I also have database design
> > experience with MS Access, and have just created my first mySQL db.
>
> > So right now I have a mySQL db structure and some Python code. My end
> > goal is to create a browser-based interactive fiction/game thing. My
> > code is currently just using dummy data rather than pulling in data from
> > the db, but I think/hope it won't be too big of a deal to interact with
> > the db through Python (famous last words...).
>
> Wrong approach. If you're going to use a database, start with writing a
> program that puts your data into it alongside the program that reads and
> uses the data. Do it incrementally: if you are writing an adventure game
> a good place to start would be the 'place' table and the part of the game
> builder that adds/amends/removes a place from the database as well as
> enough of the game program to show the place description and use the
> doors to move from place to place. This way you'll have that working
> before you start adding weapons, monsters, etc. or try to implement
> fights. You'll also learn that writing place descriptions isn't as easy
> as it sounds: if there are several doors into a room the description must
> make sense no matter which way you come into it. Its quite hard at first
> to avoid descriptions like "Further into the forest. Its getting darker"
> which may be OK coming from a road but is pretty stupid if you're on your
> way out of the forest toward the road.
>
> http://www.kitebird.com/articles/pydbapi.htmlwhich tells you what you
> need to know about accessing SQL databases.
>
> > My main problem right now is how to do the web interface. I don't know
> > much about web architecture, unfortunately. I think I need a CGI script?
>
> You're biting off quite a lot at once. It may be easier to first write a
> command line Python program and get it working in that form. Once you
> have the game/application logic working you can adapt it to run as a CGI
> script. Development and debugging will be easier that way.
>
> If you're not familiar with this style of adventure game, look here:http://www.rickadams.org/adventure/You'll find various downloadable
> examples on the downloads page as DOS executables and in C or Fortran
> source code. Have a play with it to see what even this very basic user
> interaction can do - you'll have fun and learn useful stuff.
>
> > What I would really like is to find a GUI tool to design the interface
> > that would have customizable templates or drag-and-drop elements or
> > something, so I wouldn't have to code much by hand. Something easy, if
> > such a tool exists.
>
> If you're doing a textual adventure of something like it a tool won't
> gain you much, since you only need a few skeleton web pages than your
> program can select and drop text or images into.
>
> > Also would prefer something that I would be able to install/use without
> > having much access to the server where the site will be hosted (on a
> > university server that I don't have control over). I don't fully
> > understand how a lot of the tools I have been looking at work, but it
> > seems like they're often things where you'd have to get an administrator
> > to do stuff on the server (is that right?), which I would prefer to
> > avoid.
>
> CGI and Python should be OK providing the server has Python available and
> the admins will let you use CGI, but that's not a good development
> platform.
>
> You really need a web server you can start, stop and fiddle with once you
> get to the point of putting your code in a server. Running a simple local
> web server on your computer would be a better place to start: once its
> running you simply point your browser at localhost:80 and send it the URL
> of the initial page of your application.
>
> Search on "Python web server" for details of building or downloading a
> simple one. You'll also find stuff about interfacing Python programs to a
> web server.
>
> --
> martin@   | Martin Gregorie
> gregorie. | Essex, UK
> org       |




More information about the Python-list mailing list