Monday, January 28, 2013

Hello Scalatra!

In the last post, I was gladly touting we were using ASP.NET MVC to be pragmatic. In retrospect, this was a mistake, since we are primarily Linux developers. This lead to intense pain points regarding almost everything we tried to accomplish, since almost all tools and systems assume you are on Windows and using Visual Studio. A lot of work has gone into Mono, but the reality is that it will always be a second-class citizen in the .NET realm. Everything from making sure fastcgi-mono-server could run the software correctly, to remote deployment, to ensuring we were compiling with the right libraries (nuget's command line interface is painful at best) was more tedious than necessary. This is fine. I wouldn't waste time developing for the 0.1% of developers using the tools in the manner we tried to.

Scalatra

The JVM is well-supported on Linux, so we decided to move to it. After that, we went with my favorite JVM language, Scala, since it has the best documentation and a wide variety of web frameworks available. We checked out Lift, Play 2, Scalaz and Scalatra. We ultimately went with Scalatra because it was incredibly easy to get the Rails-like pattern matching up and running and for being fairly well-documented.

Gradle

Almost every Scala project assumes you are using SBT. However, I do not much care for SBT. The biggest issue for me is the support for building non-JVM tools isn't really there. Sure, you can do it by writing your own extensions in Scala code, but it is not terribly clean when compared to something like GNU Make. Furthermore, the decisions for which symbols to use seem fairly arbitrary (not that $?, $+, $< are any less random, but I would like to get away from the excessive terseness of Make). The product is not well-developed enough at this point. It seems like the DSL changes every other version and the only way to get SBT is to compile it yourself (which makes life even more painful if you want non-developers to build).

I suppose the C++ hacker in me prefers a build system which thinks of itself as a DAG first and a specific technology second. Gradle does this extremely well -- the core DSL makes no assumptions about using a JVM language, as it is all implemented through plugins. This allows our system to build all resources through a single system -- including compiling TypeScript to JavaScript, converting COLLADA XML into our own JSON representation and anything else we might want to do in the future. Gradle is quite flexible and fairly mature. Furthermore, Peter Niederwieser, one of the Gradle developers is incredibly responsive on things like Stack Overflow.

The Stack Now

  • Gradle - build system
  • Scala - server-side language
  • Scalatra - web framework
  • TypeScript - client-side language

Monday, November 26, 2012

To HTML5!

One of the stumbling block I mentioned in my first post was "making development too difficult." After a few weeks of developing an engine in C++, I realized I was falling into the trap again. Why deal with all those native things and irritating library incompatibilities? It was difficult to get inspired to work on something that people would have to jump through a million hoops to end up playing for 5 minutes (in other words: not play ever).

So, we have transformed Vela into an HTML5 WebGL game. This means easy deployment and simple demos. The web is ridiculously conducive to the multi-player aspect of RTS gaming, although the casual nature of web games conflicts with the mentally taxing RTS game -- something we will have to play around with a lot in prototypes.

One thing that has bothered me about dynamically-typed languages like JavaScript (this isn't going to turn into yet another anti-JavaScript rant) is how they scale out to a larger team. I love the flexibility you get from free-form everything, but when you have multiple people working on a project, simple things like changing the name of a method become a royal pain.

To TypeScript!

TypeScript is a rather nifty language that aims to bring a little bit of static typing to the Land of JavaScript. It has great tools for "linking" to "native" JavaScript "libraries." We are taking advantage of the bindings for WebGL. The only downside is my insistence on running on Linux and relying on Makefiles, as TypeScript's current compiler does not appear to have been designed with this in mind at all.

Mono+ASP.NET MVC on Linux

In the interest of static typing, we have chosen C# as the implementation language for the server and ASP.NET MVC as the framework to work with. A close runner up is Scala+Lift. The decision came from pragmatism, as two of us already know C# and ASP.NET MVC versus only one person knowing Scala and thinking Lift looks really cool. The server software is not very interesting at this point, so it might change in the future, depending on how much of a hassle Mono turns out to be.

Tuesday, October 2, 2012

The Vela Project


I have a history of not completing game projects. While I start out with full confidence that this time will be different and this time I will finish, I always stumble and end up abandoning the project. They say that insanity is repeating the same action and expecting different results, which I realize I have been doing time and time again -- just expecting things to happen naturally. I have dedicated my newest project, Vela, to be the one I will finish. I will finish because I will do things differently.

Stumbling Blocks of the Past

My first step is to think about what has been going wrong and attempt to fix it.

Lack of artwork

After getting a decent amount of prototype code and a basic working engine down, I run into the fact that drawing squares looks really stupid. My first step is to try to find someone who wants to create 3D models. If I manage to find someone, they tend to disappear after about a month. I try to do modeling myself, only to find that I am absolutely terrible at it. After this frustration, I am greatly saddened and it leads me to abandon my work.

I think a large problem here is scope. Creating good-looking 3D art takes a ton of time and energy, which makes it quite difficult to find people who want to work on your project for no pay. Those that think they're okay with it generally lose their muster after the honeymoon period. Part of this is my fault -- by the time I search for an artist, I've already formed a decent vision of what I want the result to be, which does encourage creativity.

To fix this, I'm working on a 2D game, which means content creation can happen much more rapidly. I am also getting artist involvement significantly earlier in the project and I am not planning on asserting any creative control. I want to enable the creative vision of my artist, not the other way around.

Overgeneralization

As a habit, I tend to generalize my code. I'm quite good at this for coding constructs, but that is a result of having tons of practice. I do not have tons of practice creating video games, so I lack the vision to see which patterns I am going to re-use and which I am not. I tend to think too much about the game framework and not enough about the game.

Since I began to work in the real world, I have learned the value of doing just enough to make the product work. I can now look at something and say: I'm not going to need that, so I should not make it.

Lack of Publicity

At some point in every project, I ask the question: Who cares about this crap? I keep expecting myself to end up with a whiz-bang neat result, but I never reach it.

I'm planning on publishing milestones -- rewarding myself and telling the world about the progress I have made. Keeping this blog as a log of the work I have accomplished is part of the change. /r/gamedev has a very supportive community for indie game developers. I want to keep a to-do list, upload things to YouTube and keep a public repository. If nothing else, I'll be able to look back and say: Look how far I have come.

Working Alone

Working alone on things is nice, because you can set your own pace or change huge pieces of the project at will. However, there are advantages to having the help and participation of others. At a slight loss of individual velocity, a good team has significantly more momentum.

Making Development Too Difficult

For almost my entire programming career, I have had an obsession with multithreaded code. This leads me to design my engine in a very multithreaded manner, which leads to overcomplication, which leads to bugs. This time, I am going to write code which is thread-aware, but rely heavily on profiling to optimize later.

Lack of Good Scripting

For whatever reason, I've always implemented everything in whatever the primary language for the project was. This brings development to a crawl when the question of "Why is that unit behaving like that?" inevitably comes up. In Vela, the core of the engine is libvela, a shared object filled with types for consumption in Python (using Boost.Python). Scripting is built-in from the start.