[MUD-Dev] Re: Language and platform for Text MUD server

Alex Chacha achacha at hotmail.com
Fri Nov 21 17:30:13 CET 2003


Andrew Batyuck wrote:

> I am doing non-commercial text MUD and rewritten platform from
> scratch several times. Main question is - "What language and
> platform can give good speed and decent extensibility" I discovered
> following in my efforts:

>   - Java - VERY extensible, cross-platform and VERY slow and
>   memory > consuming

>   - C# - MOST extensible, cross-platform? =) and rather slow

>   - C++ - extensible, cross-platform with usage of third-party
>   libs > and decent speed

>   - C - best speed, but not extensible

> The only variant i see is to implement own language compiler or
> interpreter that would be extensible and quick - the only choices
> here are C and C++.

I'll try to answer this without unlocking the crypt of the
programming language flame beasts.  I am a big fan of C/C++/Java and
have used C# in limited capacity (mostly limited by C#'s lack of
what I needed).

The difference between C and C++ is negligible in my experience, so
I will treat it as C++ to imply both, if you feel that C is faster,
then you can then adjust things below as you see fit.  Honestly I
have not written a line of C since 1988 and I don't miss it.  The
best part is that you can write C or C++ code and most of today's
compilers will handle it just fine.  If you need easy access to
collection types in STL, then C++ is your choice, if you like
writing linked lists and maps then by all means do it in C.  This is
your call.

I was at this point few months ago when I was debating about which
language to use to write a text based MUD that will eventually get
some UI.

Performance
-----------

C++: This is an obvious choice since it is compiled native code.
For server end this may be the only choice if you plan on supporting
more than 1000 simultaneous users.

Java: JIT compilers are generating very quick code that makes Java a
worthy programming language for bigger projects. It's not as fast as
C++ but for many tasks it may be fast enough for the task.

C#: is in the same boat as Java, just newer with less refinement (as
of now).

Development Tools
-----------------

Java: Eclipse is an incredible IDE and it's free.

C++: Microsoft Visual C++ 7.0 (aka .NET) is a great IDE for C++ and
C#.  You can also use any C++ compiler IDE that you like, some
people love Code Warrior, some people only use EMACS with g++.

C#: MSDev .NET is the only choice.

Libraries
---------

Java: This is the clear leader in my mind, everything you need is
available from either Sun or Apache. Once you get an idea of the
classes that are included you'll see that everything including the
kitchen sink has been written for Java.

C++: With Standard C++ and C libraries you can write anything else
you may need, however system code can be tricky to deal with and
something like ACE library may be a good abstraction layer when
dealing with sockets, files, synch objects etc, especially if you
plan on using it on different OSes.

C#: .NET is trying the same thing as Java and I am sure in due time
they will get up to speed and get similar support, but .NET is not
quite there yet.  C# does not have the huge support base that Java
managed to build over the years, but it may get there very soon.

Portability
-----------

Java: Probably easiest to make portable, but mind you it's not
automatic, Runtime environments vary so it may not be a perfect
cross-platform language but it's close.

C++: You can write very portable C++ code if you use the right
system libraries.  ACE library is great for OS abstraction. Problem
I ran into was database abstraction library and couldn't find one I
liked enough.

C#: None

Memory footprint
----------------

Depends purely on the code you write.  I have heard rumors that Java
uses huge amount of memory, but it all depends on the code you
write, if you create and destroy objects without any rhyme or
reason, sure it may use up more memory.  This is a design issue more
than anything else.  Overall, Java and C# are a little more memory
hungry than C++.

Databases (unrelated but plays into it)
---------

MySQL: This is my favorite database, probably the most painless
JDBC, ODBC and C++ libraries I have ever used. It is also free,
which is hard to beat.

Oracle: Great database, but a complicated install, you need a full
time person to just manage it.  Then again it can handle huge amount
of data quite efficiently.  It's a great database if you plan on a
very large MUD and have a budget for it.

MS-SQL: Good choice if you are going Windows only path.

Sybase: Same area as Oracle.

MS-Access: If you like pain in your life, this is the database for
you.

Database connectivity
---------------------

Java: Trivial, get the right JDBC driver JAR and you are ready to
go.

C#: Trivial, ODBC based connectivity.

C++: With native libraries this can be done, but on all the projects
I have worked on this has been a sore spot. Everyone want's to write
their own DB access library and they are never portable, so you may
need to support separate code bases with common interface.  If you
have chosen your platform, then this is a non-issue. Just remember
if you change your mind this may bite you.

What I did
----------

C# was out of the picture, I didn't want to write server end code
with it since it bound me to Windows and ODBC.  So the tossup was
between Java and C++, after mucking around with tools available and
the fact I want the code to run on either Win2k or Linux, I picked
Java as I could not find any DB library that I liked and I didn't
feel like writing DB libraries.  Another concern for me was the
socket code, the libraries in C++ that were portable were also a bit
cumbersome to use (I wanted to avoid spending too much time in OS
abstraction and concentrate on the game engines).

As far as the server end of it, I prefer to use Linix for server and
network code for one main reason, I can't afford a Windows network
on my budget.  If I needed more machines I can just build them and
install Linux.  If your budget allows you can use Windows or
Solaris.  My server side decision was driven by cost.  Now that I
chose Linux as my platform, I picked MySQL as the database since it
is free, API is very well written, extremely easy to install and
maintain and very stable.

On the client side you can use anything, since it will be a TCP/IP
connection.  At first you can just use a telnet client and then move
it up as needed.

Further points
--------------

There are few more reasons why I chose Java:

  - My quest engine is very dynamic and uses XML to store quest
  data, Java has very easy to use XML parser code. (Xalan and
  Xerces)

  - Eclipse just plain kicks ass as an IDE, it is so convenient that
  it makes MSDEV 7.0 look like chisel and stone tablet. And I was a
  die hard MSDEV fan until I started playing around with Eclipse,
  this IDE can convert you, be careful.

  - JDBC is extremely easy to setup and use

  - Lots of collection classes available

  - XML and XSL processing is very easy with Xalan/Xerces

  - ANT is a great build tool for building from command prompt

What I miss about C++:

  - Multiple inheritance

  - True Enum classes

  - templates<>

  - fear that Java may not be fast enough in the long run

As you can see it is not an easy decision, you need to write down
what you want to code and what you don't.  If you like writing
socket, thread or database code then you should do it in C++, it you
like writing game logic and don't like system code then you should
do it in Java or C#.

Feel free to email me if you have question, my decision may not have
been optimal, but given the constraints I was faced with, I picked
what I think is the best language for my text based MUD.  Your
decision will depend on your constraints.
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list