What sort of programming language would be best suited for my needs?

No, my needs do not involve world domination, economic subterfuge, or ouchies of any kind. Sorry to disappoint anyone expecting the previous.

Which programming language is best suited for a text-only game? My specifications are that the language be a) widely-used, at least on most platforms, b) have the ability to manipulate text about as well as the HTML family does, and c) be able to explain why people always seem to greet a person named Opal on the third item of any list. My first thought was something in the C family, but I’ve heard how hard those are to learn, so I’m asking the Dopers of the geekier persuasion to help me.

Please? I’ll… uhh… (removes handkerchief from pocket) give you my lint-covered, probably dirty from countless mouth-wipings and nose-blowings hanky!

You can either use C/C++ or Perl. I found that Perl is very good when it comes to parsing and HTML editing, especially since it’s been around for a while and is usable on most web hosts. If this is going to just be on a client’s machine, then I guess C++ should be enough.

Choosing a computer language isn’t always a matter of selecting the “best” language for the job. Nowadays most general purpose computer languages will do almost any computing task well and it becomes a matter of personal taste and what you’re used to. Programmer’s tend to be loyal to one or two pet languages. They will give you a long list of reasons why one is better than another but, IMHO, it’s po-TAY-to, po-TAH-to.

Having said all that, Perl was built primarily as a text processor. It’s not hard to learn, although it’s not trivial to learn to use it well. Java (my personal language of the moment) is best if your goal is to deploy over the internet, since all browsers will run a Java program. It’s harder to learn than some languages but not, IMO, as hard as C/C++.

If you are talking about a text-based adventure game, like the Collosal Cave or Zork, there is a specific language designed just for those sorts of games called Inform. It’s been a long time since I used it but there are (or were, anyway) a lot of websites out there with compilers and tutorials.

If cost is an issue you can get free versions of compilers for most popular languages. Add a free text editor and knowing how to use your operating system shell and you will do just fine. If your goal is to turn out code as fast as you can and damn the expense then buy a mid-level IDE (Integrated Development Environment) like (and I hesitate to recommend Microsoft products) VisualStudio.

Good luck.

or COLOSSAL Cave

I don’t think it particularly matters what language you use in this case. Perl has excellent text-processing capabilities, and is also free (www.activestate.com), so that might be your best bet.

Do intend on writing interactive fiction, like the fabled Infocom games of old? May I humbly suggest that you consider Inform, a Z-machine compiler:

I’d recommend something tied more closely to HTML like PHP.

Another advantage of Inform is that the compiled game is platform independent… with an appropriate interpreter, you can play the exact same game on a PC, Mac, Unix workstation, Amiga, Palm/WinCE device, etc.

Another great language for text manipulation is TCL (pronounced ‘tickle’). (Nowadays it comes bundled with a pretty powerful graphics toolkit called TK, forming TCL/TK.)
It is a script language, is relatively easy to learn and is supposedly very easy to make platform independent (runs on any Unix, Mac or Windows).
The drawback is that it seems to loose ground to python and pearl, and that the company that used to support it (Ajuba, formerly scriptics) are decreasing more and more their support, but it seems llike the Open-Source comunity is taking over pretty well.

It’s completelly free, (it’s part of most standard Linux distributions, or can be downloaded from the scriptics link above)

One of the main questions you need to answer before choosing a language is how you want to deploy your project. That is, will it be a website, an installed application, etc.?

Perl is a great language for text processing and is an excellent choice if you’re deploying on the web. Many bulletin boards and other text-based websites use Perl scripts as the back end because it excels at these tasks. However, if you want to make an application your users will install on their own computer, it is a less ideal choice since each user would have to install a Perl script engine as well. This also applies to Tcl, Python, Ruby and other scripting languages. Producing an event-driven GUI is also more complicated with these languages. This isn’t an issue if you’re using a web interface, but it’s a problem for apps that run locally.

Other languages such as Chas.E’s recommendation of PHP are even more tightly bound to the web. If you’re creating an interactive website, PHP is as good a choice as Perl (slightly easier to code since the script is embedded in content pages, less flexibility and lower performance than most good Perl implementations). However, PHP and other web-based systems like ASP have to be run through a web server so they’re not suitable for installed applications.

Languages like Java and C/C++ are good choices if you want flexibility in deployment. If you write your code in Java, it’s a fairly easy modification to make it run as an installed application with a nice GUI, an applet within a web browser, or a server side engine producing an HTML interface (using servlets and/or JSP). Similarly, C++ could be used to make an installed application or a server-side process. Like the script languages, Java would require users of an installed application to have a Java VM on their machine, but many machines will have this already (many compared to the number which would already have Perl or Python) and it’s fairly easy to bundle the VM in an installation.

So, in addition to choosing a language which meets your text processing needs, you should also consider what you’re going to build with it. In most cases, deployment rather than task dictates the language.

Assembler! definitely Assembler!

(ducks, runs)

(shoots Opengrave in the back of the knee for DARING to suggest Assembler)

Deployment… I plan to make it an actual program, independent of a Web browser. So, gathering from the posts, I think Inform. It sounds rather like what I’m looking for. Thanks, guys, for the help. I think I’ll just mosey on down to the Inform page, download what I need, and get cracking…

Wimp. A real geek would’ve suggested machine code. :wink:

As I am a wizard (i.e., coder) on an LP mud, I feel obligated to mention LPC. A mud is an online text environment, a “multi-user dungeon” as it were. It’s basically what you describe: it’s an all-text adventure game. You telnet in (or use one a number of popular mud clients) and interact with real people in a roleplaying context.

This is not exactly what you are asking for, I know. You would need to download the LP mudlib source and compile it on a *nix machine. It is not the easiest compile in the world, at least, it wasn’t for me, but with a little editing you can make it work. The upside is that you instantly have a pre-built framework for darn near everything you could ever want to do in a text environment. Objects, rooms, monsters, weapons, armor, etc., all already set up and debugged. You can then focus on extending and adding your own personal touch to the world.

LPC is derived from C, and anyone with C-family programming experience can pick it up fairly easily. It is custom designed for the world of mudding. In terms of your requirements, well, it can handle text as well as C can, more or less. While you will be forced to run a *nix machine, it will be platform independent for your users – anyone with telnet can play.

If you are interested, there are plenty of helpful websites with information on muds in general and LPC specifically. If you are not interested, well, as I said, as a wizard on an LP mud, I must evangelize when given the opportunity. Here are some links to pursue:

      http://www.sneakers.org/lpmud/www.neosoft.com/genesis/lpc.html -- LPC Programming Language Tutorial
    http://www.imaginary.com/LPMud/lpmud_faq.html -- LP Mud FAQ (imaginary.com is a solid mud resource all around)

There is also at least one mud newsgroup oriented towards wizards and mud administatration. Furthermore, the wizards on most muds I am familiar with tend to be reasonably friendly, and would not mind fielding any questions you might have.

The LP mud FAQ contains links to FTP sites with everything you need to download. I downloaded from ftp://ftp.lysator.liu.se, so I know that one works.

Ok – required mentioning of an obscure little language with a specific mission that does its job quite well is now over. It’s not every day I get to talk about this to someone outside the mud world.