Project Z: A Good Engine?


I find it an absolute wonder that I can still work on programming stuff, even after working 8 hours at a programming job. Maybe it’s because after so much non-creative work, I need to start something creative. Or maybe it’s just that I’m bored. So, I start work on… something that I probably will never finish. Well, what counts is what I learn, right?

Thus, Project Z. No, this project has absolutely nothing to do with zombies. In fact, it has nothing to do with the letter “Z” at all. The only reason the letter Z is involved is that not only do “common” and “client” share a letter, but so do “shared” and “server”. What was I to abbreviate my common files? Z sounded good. Still has nothing to do with what I’m even doing, but…

This started out as an effort to port JAGS, that venerable old semester project. Sure, it was playable, but it’s written in DarkGDK, which I ended up really disliking. Plus, it’s just not a very good game. So, I checked out the source code from the last time I took a crack at it, and… well, let’s just say I spent an hour or two and decided it was best to just start over completely.

Well, first, we’ve got to pick out a framework to use. Graphics, audio, networking… I’d prefer not to have to deal with all that at a low level. Even better, I could pick out an engine, and not really have to write anything but the game logic itself. But… where’s the fun in that? I know I’ve talked before about why having to worry about engine-level stuff is detrimental a lot of times, but still, I really do like building architectures and having complete control over all small details. Those small details do become enormous, eventually, but I think I’m willing to take the risk.

In any case, I still want to work at a high-ish level. So, I pick up SFML again, which recently got to version 2.1. I contemplated going to SDL for this one, because that hit 2.0 after many years of inactivity, but I decided against it for two reasons: one, I want to concentrate on stuff other than learning a new library; and two, SDL is just so dang inconvenient. To get a lot of the functionality that SFML provides, you’ve got to pull in a bunch of other dependencies; SDL_Mixer for loading audio, SDL_TTF for loading fonts, SDL_Net for networking, etc. Not to mention SFML is nicer to work with in C++ - my language of choice.

So, I said I wanted to concentrate on other stuff; what stuff is that? I really would like to do a few things. The first thing is embedding a scripting language. This is something I’ve wanted to do for a long time. There’s a many small benefits you obtain from working a scripting language. Among other things, you get to work in a less strict language; you only ever need to recompile when the core engine changes; and you get to change the game while it’s running and see the effects immediately. That stuff is cool. I’ve chosen Squirrel as my scripting language. While Lua is generally the preferred choice for game scripting languages, I’ve used it a little in the past and I didn’t like it so much. Squirrel is quite similar, but its syntax looks much more familiar.

The second thing I would like to do is implement a fairly robust networking architecture - not an easy task. It’s not even really a well-defined problem; what does “robust” even mean? For this project, I’d like to use ideas from this article. However, I do really want to finish a game here, so if I get hung up on this point, I wouldn’t mind making a single-player game instead. Still, though, I haven’t ever been able to get a good grasp on networking, so I want to try to do it - and JAGS is a good candidate to start with this goal. As far as games go, it’s fairly simple, and that’ll make the networking easier.

The last thing I want to do is implement an entity-component-system architecture. Since this is a fairly involved topic, I’ll hold off on talking about it myself for now, and instead link you to this article on it. ECS may actually be not-so-well suited to this project. JAGS is really a very simple game - just about the only entities in the game are the players and their guns. ECS is huge of overkill for such a game; it’s really focused on a game with many different entities with very similar but not-quite-the-same behavior. Again, this is something I’d be willing to drop if it proves too cumbersome, but if I do end up making a single-player game, or morphing the essential form of JAGS, I’ll probably end up using this approach - so I’d like to have it rather than not.

Over the past two weeks, I’ve begun implementing all these things. You can follow my progress at my github project here. In the next few followup posts, I hope to talk a bit more about the specifics of how I’m implementing ECS, scripting languages and networking.

I’ll leave you with this video of my progress.