Considering writing a server for a virtual world (text-based, like MUD) - Which lang?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Considering writing a server for a virtual world (text-based, like MUD) - Which lang?
I am considering building a multi-user world (similar to a MUD, in principal) where users could telnet/mud-client to the server and play. However I'd need it to be able to multithread and allow for multiple users to be logged in at once.
I know the traditional language of choice would be C/C++, but I'm wondering if there'd be another language that'd be easier. (I'm just getting back into software design, and am interested in trying new languages.)
The system would need to be such that it could be easily ported between OSes with little or no code modification.
I was also considering integrating the world with a MySQL database.
Which language would you suggest, and why?
The server needs to be able to not only manage numerous clients simultaneously, but it must be able to communicate between different users, send large amounts of data (e.g. send files b/w users while in-game) and various other tasks.
Any suggestions?
Also, would anyone be interested in working on a project like this?
(( If you've ever read Snow Crash by Neil Stephenson, imagine the Metaverse, only text-based (for the moment). I know Linden Labs created Second Life, which is similar... But I'd like to create something a little different. ))
Well Java's easy with less to worry about with the memory management and even has the Enterprise Edition for use with webapp servers like Apache-Tomcat, but Python is also multi-platform, object-orientated etc. and the latest version, 2.5, was just released. You may have more fun adding the mysql support module, and getting used to the whitespace vs {} use.
Just choose the language you feel most comfortable with. If you plan to have a small number of users, you have a very wide choice. If you need to support quite many users, however, think about performance, load balancing and so on.
Also, there are really many MUD or MUD-like engines. It takes quite a long time to write a good one, so it may be a good idea just to take an existing ones, apply needed patches (if any) and deal with the world, not the engine.
@Proud: I considered Java, as I've used it before and am quite familiar with its syntax. However, I've recently been wanting to learn Python... Maybe this would be a good way? Though it'd be a good bit difficult at first. I think Java would be a good choice, as most users have some form of Java on their machines (Windows/OSX/Linux/Solaris all come with support, and I'm pretty sure BSD and HP-UX do too. Not that anyone's going to game with HP-UX...) It would be easier for the less-tech-savvy to use a Java system.
@Mara: I've considered using a premade MUDbase, but the one I like most is CircleMUD, and it's not (from what I remember) completely open source. (e.g. I couldn't include it with Debian, due to the DFSG.) The CircleMUD license is somewhat restrictive. Also, I've had little success getting any other codebase to compile properly. (Maybe I'd have more luck now that I've got more linux experience.)
All in all, the fact is that the codebases I like are all C/C++, and I'd prefer something a little more portable. One compile, and that's that.
Java seems right for the job.
Now I've gotta get back into my Java swing...
If anyone out there is interested in working on this project with me, please let me know!
And if you've got any other suggestions, I'd be grateful!
Just some more stuff FYI: Python is definately suited to networked programs such as this, with strong string processing and internet protocol support. Also if you've ever used functional programming languages you may quickly come to love the slice notation. Creating stand-alone portable apps is supported too. Lastly, Google's been using it for years!
Btw, when you said you may be using MySQL, did you mean just for the server program that you'll be maintaining, or were you planning to release that too? Because then you may want to look into other databases like Berkely DB, which is as I understand it, more file-based than relational, but with a management layer to make life easier for all, and easy to distribute.
I was thinking that I could use MySQL to store world data, including room descriptions, item descriptions, user-made scripts, actual files, and various other things.
I'm not sure, though, if it would be feasable to bundle MySQL with my software... Could become trouble.
It might be better to do it the Traditional MUD Way and just have everything in individual files.
I'm going to allow users to create their own world on their own computer, as well as items and such. And items/rooms/etc will be scriptable in a simple script language, so that they can generate their own content (e.g. LSL for Second Life).
It's an extremely complex idea.
- Users will have the ability to host their own server, seperate from the main server. This server would be accessible to them offline (e.g. loopback) so that they could create when there's no internet connection. When they're online, they could invite other users into their server (in which case those users would be transferred from the main server to the users' personal server.
- Users can travel between servers and make links between servers. However, users may only make links to places that are public access - a user couldn't make a permanent link into another user's server unless the second user gives explicit permission. However, they could connect to any public access linkstation on the main server.
- Users can create their own world while in-world (like a MUSH, you can build while you play). They can only modify items they've created or rooms they own. Exception is if someone gives them explicit permission to modify their rooms or items. (Similar to Second Life, again.)
- Items and rooms will be scriptable, in a simple, easy-to-use language. There will be limits on scripts, of course, so that nobody creates anything too.... mean.
- Users can attatch real-world files to items in-game and transmit them to other users. For example, if you downloaded the text to Oscar Wilde's "Picture of Dorian Gray" from the Gutenberg Project, you could create a book in-game and attatch the file to it. Then, you could give it to a friend, and they'd be able to take the file from the book and have their own copy of the file. (FTP, maybe?)
I'm not sure how I'd want to structure everything though, in terms of licensing. I'm thinking I'd GPL everything, since I'm allowing everyone to run their own servers, but this could lead to trouble if someone starts running a custom build and links up to the main server. Maybe include a warning for users, stating "You may visit other users' domains, but be warned: they're using their own personal server, and the rules there might be VERY different from the main grid."
It would also open me up to hackers, but at the same time it would allow others to help me fix problems faster...
Meh, I'll GPL it.
...
Well, I'm thinking I should stop spewing all this information here, make a SourceForge project instead.
With a basic idea, though... Do you think Python would be good for this?
Though I haven't worked with Python myself, everything I've read and seen indicates that it will work well, unless you are looking for extremely high performance. I used to be an administrator/owner/coder on a MUD, and it was completely written in C. We eventually had a codebase in the 100s of thousands of lines... a language that supported classes would've been nice. Too many similar functions: char_to_room(CH *player,ROOM *rm);, etc.
It definitely sounds like you have an interesting project going here, though maybe a bit on the ambitious side.
FreeBSD has official Sun JDK / JRE binaries; other members of the BSD families don't. However, many other BSDs can run Linux and FreeBSD binaries under emulation. Plus, there are decent free (in all senses) Java virtual machines out there. (Most specifically I'm thinking Kaffe.)
Last edited by taylor_venable; 09-22-2006 at 12:19 PM.
Reason: Incorrect "quote" tags.
From what I've seen, though, Python could well be the language of choice for this project.
The website states that it can be learned in a few days, so I'm assuming it's not the most difficult language to learn, though having been used to C/C++/Java syntax, it'll be an interesting switch getting to know Python.
First, though...
I want to document exactly how I want the system to work.
Extensive, extensive planning.
I want there to be no question about how this thing should exist.
Granted, I can't account for every possibility, but consider the system a base for an extendable environment. Much like the Linux Kernel is the base for an extendable OS. The basic server would start with the default server settings and a single, plain room. Nothing more, nothing less. All content within the world would be added by the users. (The main server, of course, would be maintained and created by the main server administrator.)
Now I'm using this thread as a brainstorm session... Hope nobody minds.
If any of you have ideas you think would be fun to implement into this system, let me know!
Java networking isn't that difficult, but I'm not sure how easy it would be to implement command parsing and such... I don't know much about threads or other advanced features, either.
And if Python is as simple and powerful as it sounds, I'm thinking I'd love to learn it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.