Monday, May 4, 2009

New Project

So I haven't updated my blog in awhile, I'll talk a little bit about languages I've been messing with then I'll move into my new pet project.

Haskell was the last language I posted about and pretty much nothing has changed in my mind about it. It is a neat language and I hope to use it more some day however monads have really turned me off for the moment. Why have monads turned me away? Well it's actually quite simple, being a game programmer in C like languages I'm use to state and monads just makes it either more difficult, painful or ugly compared to the "C" way of doing it. There is always functional reactive programing which is suppose to be the new "cool thing" for programming in Haskell however I just don't feel like learning them as the concept is quite academic (like a lot of things in Haskell) and not really proven for game development yet. So to conclude I like Haskell as a language and it brings on some neat ideas however for game programming I'm having a hard time accepting it.

After I looked at Haskell I stumbled upon factor. Factor is a neat stack based language derived from Forth. I really liked how simple it was, push stuff on the stack then push a function that read the previous stack items and put the result on the stack. It seemed a lot like functional programming but a bit different. I really loved the idea of an image based programming language, basically what that means is that the programming language, libraries and programs are contained in an image file. What this means to the user is that it's very simple to import/include other modules as the programming language knows about everything in it's image. It also makes it painless to add new modules to the image, no need to worry about system paths and the such. As I worked with the language I just couldn't get my brain trained to think in the way factor wants you to (basically backwards or postfix). Because the language is stack based it depends what is already on the stack meaning you really don't pass arguments to a function it just reads from the stack. Also it reads the variables on the stack from back to front meaning it seems backwards in that way as well "push 3; push 4; +"(pseudo code). you would think that this translates to "3 + 4" if it was converted to infix but it's really "4 + 3". This seemed to cause me pain when coding, it made comprehending the code harder. I thought it would get better with time but I gave it a week of coding in my spare time and I felt no better than when I started. Curiously I looked around about factor and according to other blogs some guys had been programming in it for over a year and still are having the same problem I am. I decided that I will look at the language at another time.

Given all the languages I've looked at I got somewhat burnt out on looking for something to replace C, I decided I'd rather just make something. I decided up front that I wanted to make something that deals with networking as I haven't explored that area like I have graphics, sound and general game programming. Networking is becoming more and more important for game developers, it's getting harder to sell single player games and not having much experience with it I feel lacking.

So what did I decide on? I decided I want to design an mmo server. I'm unsure how far I will get with this but I do know I will take away some good knowledge from it. Right now I'm in the planning stages, designing protocols, server layouts and road maps/feature lists on how I will develop it. If your interested in this then I'm keeping all the information at my site here. Being a game programmer and having used C/C++ extensively, I naturally decided to use C++ for my language of choice without really considering my options. Upon doing research I came across Eve Online and surprisingly they use (stackless) python of all languages, this really surprised me because of how slow it is compared to C and how it had to handle tens of thousands of connections at a time (I believe peak is arround 50-60k players all on the same world). Also while I heard of python before I hadn't heard of stackless python. Apparently stackless is a modification to regular python for continuations, coroutines and talking between coroutines.

Now I saw why Eve could handle so many players at once. Still I wasn't exactly convinced python was the right choice so I started looking at other languages like erlang, boo, scala, clojure and even C#. I'm sure all those languages would work for an mmo server as well but besides from C# those are relatively obscure programming languages and if I ever wanted help (on the project, not in general) I probably shouldn't choose them. I then looked into the state of mono on the mac as that is my work machine and if it didn't work well at home and work then I didn't want to use it. I have to say mono has matured quite a bit since I last looked at it (over a year ago) however monodevelop still lacks a debugger and the coroutines that were recently hacked in were a hack that only mono has (.net doesn't support them) and the memory usage was almost double that of stackless python. So I've come to the conclusion that stackless python while it may not be the end result it will be good enough for prototyping and if I really need speed I can always extend with C.

I also must thank Richard Tew (for his posts on gamedev), the Eve Online developers (for their video presentations and developers blog) and lastly the other peoples that responded to my thread at for helping me come to my conclusions on the subject so far.

In conclusion I've started work designing an MMO server/client and hope to have something to show for it in a couple of months. Lastly I've decided to start using twitter again for the sole purpose of letting people know about my latest developments on the MMO and this blog. You can follow me as Sean Chapel if your interested.


  1. There is also Cobra which currently runs on Mono, but is also being ported to JVM. And while Mono may take more memory, it does compile to machine code an run-time. It also offers structs and arrays which can be used to "pack" your data tightly, thereby reducing the footprint of your program. In an mmo server, this may come up.

  2. I'll take a look at cobra, thanks. My point against mono was a combination of memory size and that the coroutines hack (they actually acknowledge this) is specific to mono and does not work on MS's .net . I'm aware of mono's AOT but last I checked it didn't support quite a bit of features such as generics.

    However, right now the idea is still in proof of concept/prototype mode and I think python suits this well.