Tuesday, May 12, 2009

Prototyping the MMO

So five days or so have gone by since I last posted on the MMO server development. Like (almost) all personal projects things are going slow but some progress has been made. I started making a server in python and using telnet for testing. I got as far as having multiple clients being able to connect, clients sending a user name/password (simple text strings) and the server telling the client if the authentication was correct by using a text file as my database. It worked well enough even though the sockets were blocking and synchronous, I didn't really care about scalability nor performance as it was just a prototype.

Being the language nazi I am, I found python not to my liking. First I will state some of the things I do like just to be fair.
  1. Indentation instead of brackets.
  2. No semicolons at the end of lines.
  3. Very feature rich set of common functions/tasks.
  4. No compile times.
  5. An interactive console (I miss this in most languages ever since I started playing with lisp/scheme).
  6. Good documentation and beginners guide.
So now for the things I didn't like.
  1. Classes are littered with self because they aren't real classes but rather namespaces.
  2. Global variables have nasty names __init__, __main__ for example.
  3. The state of flux between 2.5, 2.6 and 3.0. Most libraries are still only usable with 2.5 and then some of the bigger ones work with 2.6 but 3.0 is "virtually" unsupported which is shame.
  4. Lack of type annotations when wanted, for example I would love to be able to require that functions only accept and return certain types. This is just a drawback of dynamic languages for the most part however.
  5. Spaces and not tabs. Why people prefer spaces over tabs alludes me, tabs allow you to move around faster with the arrow keys and allow you to setup your preferred spacing. Mixing tabs and spaces is silly however as it will never look right between different computers. (let the religious wars begin)
Now most of these "cons" are just my opinion and I could probably live with them however #3 really annoys me. Once I got up my simple server I wanted a graphical interface for logging on my server and I decided to use wxWidgets except it only supports 2.5 and 2.6 (sort of). The reason I said sort of is because it actually doesn't work on 2.6 on windows because of some gui dll conflict, at least thats what google had to say. It ended up crashing anytime I moved my mouse over a very simple window. Hopefully this will be fixed in the future but it really makes me wonder about the state of python on windows in general. Windows seems to be a second class citizen in general when it comes to programming languages that are either open source or non-mainstream.

I decided to not take the risk and I started writing equivalent programs in other languages. I made a server in C# with async sockets and I really just didn't like the feel of it. I also made a version in C++ and boost.asio which I liked better than the C# version but I know that C++ will just lead to headaches later on and isn't a good prototyping language. Not being satisfied with either solutions I decided to re-look at some of the languages I skimmed over for one reason or another. In conclusion Scala is my next choice for prototyping a server with.

I looked over some of the beginning docs and I liked what I saw so I picked up "Programming in Scala". So far I'm only at chapter 7 however I really like the way the book is written and how material is presented. Most computer science or tech books bore the crap out of me but for whatever reason I like PinS. So what drove me to taking a look at Scala?
  1. The mix of function, imperative and object oriented paradigms.
  2. Having an actors library for concurrent processes in the same thread.
  3. Statically typed with type inference and the option to declare types if you want.
  4. Runs on the JVM and mixes well with Java (cross-platform goodness).
  5. Short concise programs, much like python is compared to C like languages
  6. The syntax is extensible and makes DSLs easy to create
  7. A familiar syntax without many odd operator symbols for everything.
In feel like Scala is mostly related to OCaml however with an object system that people actually use, mixed with Haskell except without forcing you to be purely functional and odd syntax choices. Of course it gets its influences from other languages as well.


Next time I hope to be able to post some code and my experiences with Scala.

1 comment:

  1. Good to hear that you're making progress. Will be cool to see how this progresses as development continues.

    Best of luck!

    ReplyDelete