AJAX and MUD – is this possible?

Some time ago I wanted to start new project. Basically it was web based MUD. Yes. There is a lot of them, and most of them sucks. Yeah, I know, really know.

But what makes them sucks? To find answer first You must know what makes MUD survive in MMORPG times. Text based interface has some advantages over still not so good 3D graphics. It is players imagination – without visualisation it is easier to imagine worlds which You are wandering through. At least for me, but I’m old RPG (no CRPG) fan. IMO there is one requirement. Player have to be able interact with MUD engine fast. This means that each delay in communication between player and MUD (in both directions) is bad. Web based MUD are slow (page refresh) or just fall in other category than classic MUD.


I had an idea to make web based MUD, but with AJAX based interface. AJAX provides way to interact fast with engine, but as far as I know there is no way to send asynchronously data from server to client (there are some hacks but they are just hacks :) ). It is important for player to see everything what is going around him. It is possible using AJAX periodically check whether is something to show to player, but it has two main drawbacks. First it is performance problem (every client is sending requests to server no matter if there is some action), second one some delay – checking every second means up to second of delay.

Ideal solution would be write telnet client in Java Script, but I’m not sure whether JS engine can make direct network connections (AFAIK – no). Without this it would be hard to write telnet client in Java Script. With such client it can be possible to embed it in web page and provide fast interaction player/engine and have possibility to use browsers graphical capabilities.

So AJAX MUD will stay as only idea (I was thinking about some MUD with very strong economy background – something like old Settlers games), but as for now it is only idea – maybe somebody find it useful and start with this something interesting.

And my interest in MUDs will be still limited to few minutes daily to develop my old and rusty MUD – DiesIrae (in polish) – diesirae.mud.org.pl.

And to answer to question in post title – of course it is possible, but is this worth trying? As for now I have no time to checki it out, other things are more important.

Join the Conversation

20 Comments

  1. I’ve got the same idea and am working on it atm. One thing you’re getting wrong is the idea that you can only check once a second for anything new from the server – you’re under no such constraints.

    Request new info frmo the server, the server will hold it’s reply until there’s something to send, then either it gets sent, or it times out. As soon as you get a reply just request the next chunk.

    It does sound like it’s open to more problems than a telnet based mud, but as a long time mud coder (and other internet servers) it’s no worse. If there is any lag, then it’s going to be there anyway.

    No – the real problem isn’t synchricity – it’s database overhead and security… As the front end of the game is javascript on the players computer, it’s effectively open to cheating without good checks – and every check adds overhead to the database connection.

    If you’re just dropping a text entry frontend in a web page then there’s no problem – but if you’re doing a map view, and inventory handling, etc – then you’re going to have to make sure that the client doesn’t have any power, it’s still got to send commands for the server to execute, and it’s got to make sure it’s using some sort of session management, because even though having the client doing some processing sounds the easy way, it’s just plain stupid ;-)

    Anyway – hope others who are interested in the idea help make it a reality (and if we both get time to do something about it then it might actually be quite fun :-)

    Robin

  2. I started developing a webbased chat program that worked like a mud, or telnet chat about 5 years ago. I wish I had kept working on it. With the advent of AJAX this makes this sorta thing much easier to pull off.

    I have already built a full php login system, that will keep the login in the SESSION. It has a built in sign-up system with email activation. I’ve been spending a little time making it a module to just plug into a php site.

    You may be better off working with flat files for the maps and room descrips. And use the database to house all the specific character info. You’d have to have the hp sp somewhere volatile, maybe you could load it into the session variables.

    I think all battles would probably have to be cut down to a smaller number of attacks, or develop it to just show the results after a given time period. Or make it turn based fighting, so you start the fight and are given an option after each attack, but that slows things down. A major issue that needs resolved.

    As far as security goes, I’m sure it won’t be that hard to work it out. If the AJAX is only displaying things, and then the input box is only giving commands I don’t see where there is a chance of abuse.

    Let me know how I can help.

  3. I currently have a Ruby on Rails game that works largely like a MUD. I found the latency between client and sever is definitely the biggest issue, as you have noted. If the “feel” is quick and responsive, people rapidly loose interest.

    On AJAX, it’s the only way to get things done. Once I figured out how to update multiple div’s with a single request, it became relatively easy.

    Security really doesn’t seem to be an issue, but we are testing with a fairly small sample group. With web applications, most everything is stored on the server, so short of the standard cross-server scripting attacks, SQL injection, etc., I fail to see where people will gain access or alter play that can’t be caught by simple sanity checks.

    To that end, I have tested my code with almost 20 people at one time performing a “raid” and the feedback was quite positive.

    Perhaps someone could throw up a mailing list or such and we could all throw our ideas together. My current project is to add graphics for the on screen inventory, map and display window and I’d love suggestions.

  4. I had exactly the same idea and I started working on it, as well. Unfortunately, I have limited resources and time, and not too much PHP experience.

    The idea does have promise, and I hope that it can also come to be.

    If anyone wants to maybe bounce some ideas off of me or anything, the E-mail is eggeburt@gmail.com

  5. I knew I couldn’t be the only one thinking along these lines. I like the idea of us putting our heads together and seeing what we can come up with. There has to be a way to make this work, if not with the current technologies available then perhaps in the near future but it’s definitely worth experimenting with.

  6. Hey guys! Have you seen this one?:

    http://www.hollowgame.com/

    It looks like they built a regular telnet style MUD but added a web interface using PHP to allow it to be played through a web browser. Not as much use of pictures and sounds as I wanted to try to work in but an interesting interface none-the-less.

  7. Okay, check this out, i actually wrote a webpage based mud but i used flash as my “client” flash allows you to very quickly loop request to the server, the server is asp.net.

    you guys can try it if you want, dont try anything stupid on my server though.

    IMPORTANT: you must change your settings in internet explorer to check for new versions of the page every time you visit it.

    when you get there, type login
    then type garrote
    then type garrote for the password
    then it should log you in. its modeled after circlemud, and i actually wrote a converter and imported ALL of the stock circlemud world files. its buggy as crap, will no doubt crash on you. I have tested it with 5 people on it, and i saw no lag. it is running up to i think 15k rooms.
    the address is
    http://flashmud.yourwebcircle.com/

    A few things you guys may have overlooked when you pondered the asp.net mud. for starters, you can take all of your world files, obj files, mob files, and load them into RAM using data tables defined globally in global.asax. this imediately will stop the whole issue with the database not being able to keep up. past that, it needs to periodically save.

    you are going to have to hack it really to make it work. you have to use a web server in ways it wasnt intended to do, but it can be done as you can see. I spent a couple months working on that, and have a great deal of code. i never quite realized exactly how much code goes into a mud til i tried to make one. its crazy. I would LOVE to see someone take my ideas, put them on a dev site, get a group of coders together and I will even pitch in, to make that a real code base.

    Oh another thing. I am on a us navy ship, limited bandwidth, very constrictive ability to open ports or go to certain sites, and i can get to that all day long, and it runs great.

    EMAIL ME if you want to talk about this, I really want to see someone else work on this and see what happens, but you really need to know your stuff with asp.net really.

    oh if your thinking about using timers, pretty much forget it, i found NO good way to make timers work on a asp.net server.

    oh heh (Lots of stuff eh) another thing, that asp.net mud is hosted on godaddy, nothing special, it doesnt eat a huge amount of bandwidth, but a fully successful mud might need to buy some extra bandwidth. right now it shares bandwidth with my main site (which isnt really functional) and i never go over my 100gigs i think transfer.

    oh another thing on the timer, as i couldnt get timers to work right, instead, it actually feeds off the players request. when the flash client request if any new data, it will do checks if its within a certain time limit from the last last update (to the mud engine) so when no one is logged in, it kinda pauses, i was going to code around that by the first log in, the game runs some procs and it updates everything.

    theres alot of room for improvement, hell its not even half finished, some basic commands, i think you can fight in it, but you cant win or lose. it does take health though. what it needs is a mild rewrite to make it a bit more efficient, and then some people who have some hard core experience with mud engines, and with asp.net to get in on it.

    any takers? (I’m done now)

  8. @Daniel
    Nice work with this MUD. However I don’t think it is worth of time You have spent. Why?

    Well I think that just moving MUD to WWW interface does not feel right https://nhw.pl/wp/2007/04/11/mud-ajax-and-real-world

    More important are issues You have raised in Your comment. MUD it is a huuuge application. Now You do know ;) I have learned that when I ran DiesIrae MUD (SMAUG like one) in mid 90s.

    Second thing – it is forcing web server to do things it was not meant to do. So why bother, when as final result You have flash telnet-like client. Just setup ‘standard’ MUD with C/C++ codebase and provide flash telnet client to access it via WWW. That way You can start with existing code base from some older MUD and will allow access MUD with classic tools like regular telnet or some MUD client.

    MUD fans prefer ‘old ways’ to connect to game, WWW interface is used only as backup or when access via telnet is not allowed.

  9. Hey guys,

    If anyone finds this string, where I described my asp.net mud in a traditional sense of what a mud is (Telnet based)

    I would like to make this offering.

    If someone is willing to organize some asp.net coders, and wants to pick up this mud, then I will host it on my server free, and give them root to the subdomain.

    I will also provide all the code, which is currently up and running at http://www.logicunlimited.net/flashmud/

    I would love to see someone run with this, i think its totally possible to make a great mud using this. as i log into it, and walk around without any lag, it just seems to work.

    Granted my version is not fully developed, but its a good example of how it is possible to do.

    And it is NOT one of those web based muds, there is almost no difference in a telnet mud, and this. go to the link and try it out.

    login and try it: go to the site, type login, then type billy, and for the password, type billy
    you will be in the mud.

    its buggy as crap, if it locks, without an imm to restart the mud, it will have to wait like 20 minutes or so.

  10. It looks to be that no one has really moved forward with this project. What a shame.

    As for NetManiac, well pushing technology is what the point is. And speaking for everyone who plays muds by saying ‘they like the old ways’ doesn’t cut it. You give people no option then of course they wont ever change in a unseen direction.

    I think now more than ever with smart phones, cheap laptops, wifi everywhere, and everything starting to really encompass browsers and the web this is a good endeavor.

    A few problems as they have been mentioned is yes
    1. synchronicity of the data and connections. httpd are not made to seek out clients and give them data, they are made to serve on request.

    2. Data management (unless its face and shallow).

    3. Why make this if telnet clients/servers exists? I agree to a point, but when you need a Phillips screw driver and only have a standard it is nice you still have a functioning tool, unless the screw is cheap. In other words, if you don’t have or can not use telnet but can web surf then this would work for your text rpgmmo gaming, and again would be the point of an AJAX (or similar) mud.

    The google group looks to be dead.
    Not a good sign on the development side.

    As for all the worries of people cracking or cheating the game, well that will happen. Show me a game (mud/2d/3d/whatever.) where people have not found a way to cheat on it… it is our nature.

    My question is doesn’t php have all of this functionality? It has mysql connections, can keep active with the user clients, can process over ssh, what else is there that is needed?

    I see people running chat sites over web pages functioning with mysql and it works very well. Processing like a mud would be the only thing needed to script up.

    What do you think?

  11. @Matthew
    First side note – this post is over 4 years old :) technology limits were pushed many times since then, and I’m sure now is more available know how to make fast and efficient AJAX based MUD.

    This can be PHP, Ruby, Python or whatever it does not make huge difference.

    I have stopped working first on AJAX mud since I had very limited time, short after that I have stopped working on (and playing) with ‘classic’ MUDs – again I have chosen different activities.

    If You want to go ahead – now there is much more information and tools (mature frameworks both server side and JS) available helping create such app.

    Go with what You know at best (unless project goal is to learn new language/framework :)) ) if You will have something playable do not forget to let me know ;))

    My interest are now in different areas, but…. if I think about MUD running on Arduino… Well that would be something :)

  12. I have converted my asp.net mud to using ajax, and it works really well except for a slight lag that actually has more to do with input than output.
    email me at daniel@logicul.com with DOTNETMUD in the subject, and we can see about working on this together. I can provide a server, and my current code, though it needs a rewrite, i only had hacked it to run on ajax instead of flash, but its a huge improvement.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.