SDMB Hobbyist Game Design and Development Thread

There seem to be a lot of people who are starting to develop games here, so I figured we could start a game development thread. Just a place to post progress or ask general questions of each other. Or even team up or share assets and ideas.

I guess I’ll open with some of my background? I’ve developed two games before: a MUD – which is essentially a multiplayer text adventure. That one went fairly well, and we (well, mostly I, but still) developed a fairly solid engine that made drafting new stuff a breeze. Unfortunately the game was a bit light on content. The next one was a 2D “hero defense” game. A hero defense is a game where you control one character and attempt to protect some central unit; in our case a castle keep. It was surrounded by walls and as the game went on your defenses got weaker while your character went stronger.

That one went fairly well, except the pathfinding was kind of borked. (Which was partially my fault since it was my responsibility, and partially just the fault of the collision detection we were using; even people who were AI experts couldn’t figure out why the stuff wasn’t working).

Right now, I’m developing an asynchronous engine in Go. It’s been difficult, and if I just wanted to write a game I’d be a fool since it’s taken me a few months to do what I’ve done before in a week at best with a synchronous engine. It’s finally semi-stable though, I stamped out race conditions and bugs. There are still a few catch cases that cause weird problems, but I can avoid them.

The engine is currently about 6k lines – over 11k if you count the graphics-oriented math library I wrote. Since the engine is currently semi-stable I’m gearing into actual game production. The first game is going to be a simple GUI-based game.

If anybody has any questions that aren’t Unity-specific, feel free to ask. I’m decent with graphics algorithms and shaders. If I don’t know the answer I usually know enough to be able to find the answer relatively quickly. For Unity users, I find Quill 18 to be a fairly decent tutorial guy; he’s pretty good at explaining what he’s doing. For everybody, Unity user or not, if you need free assets for your game, check out Open Game Art. Obviously you get what you pay for in some respect, I’ve found the music on that site to be better than the art, but if you need quick mock art or just silly stuff for a 2-week “just for fun” project it’s a pretty good place.

I might have to check out Unity. Reading the GQ thread on it, I understand it can be used with C#? I use C# at work quite a bit, so I would have less to learn that way.

I’ve written a few rather simple games, but nothing with 3D graphics. I wrote a trading/economics game that’s DOS console based, where you try to buy low, sell high, and you can combine various goods to make manufactured items. Most of the fun of that was trying to come up with different styles of AI players. Hoarders, flippers, manufacturers, etc. And there was a double-blind auction system used for buying/selling.

I’ve written a 2D gravity sim / sandbox where you have a limited amount of fuel to try to fly around the solar system, but you can adjust your ship’s mass to the point that you start pulling planets towards you instead of the other way around. I’ve always wanted to transition that to a 3D version but I haven’t made it happen yet.

As for new game ideas, I’ve always thought it would be neat to do a game about wizards facing off against say, the marines or maybe a less powerful force (maybe a WW2 level of technology) to make it easier to balance. Its something I’ve brainstormed over the years, but never really gone beyond the early design with.

I haven’t tried Go yet. I’ve heard a lot about some of the weird decisions behind go. No exceptions, no generics. Do you feel like its been a pain to work in go or not so bad?

Go is my favorite language, but I suspect it may be me being atypical more than anything. I’ve always hated exceptions, and especially try/catch style exceptions. I always would have jumped on better C-style handling. C-style handling was bad because you either had to reserve some “error value” (usually 0 or -1) or set some value in the middle of nowhere (e.g. glGetError, perror). The concept of functions having error values wasn’t particularly bad, IMO, the language constraints were what made it bad and encouraged people to ignore errors.

Go allows functions to return multiple values, and a built-in error type, so there’s no excuse to not just return an error if you need to, and it’s your own damn fault if you don’t check it. People often point to file.Close and Printf as cases where “nobody checks the error, obvious proof this kind of error handling leads to problems”, but these examples are, imo, silly and you usually don’t care if they error. 99% of the time I check error values. Inlining

if err != nil {
// do stuff

makes you handle the error immediately and doesn’t spaghetti the code like the way I find try/catch blocks do. I’ll admit this is preference though. If you really need “exceptions” there’s a bultin called panic which unwinds the stack until it hits something called recover see this blog post, or the top level of the goroutine where it terminates the program and prints a stack trace. It can be used in other contexts, but personally I only use it in “can’t happen” scenarios.

As for lack of generics. It’s a bit of a pain, but not as bad as one might think. It’s been more of a problem in my math library than anywhere else. The majority of the time interfaces are sufficient, though I can’t pretend it’s not obnoxious that the bultin math library only operates on float64 types (what are doubles in most languages), including the Min functions. Still, for most code it’s much less of a problem than you may think it is. You do end up using a lot of type assertions, though. All that said, Go will have generics eventually. Almost everyone wants them, including the development team, they just don’t want to get stuck with something they don’t like (Java’s development team apparently hates the boxed generics they implemented).

Go has a nice framework for event-driven games, though. Because it uses goroutines and lightweight channels to communicate between them, you have a much better alternative to callbacks. In reality passing around an event channel isn’t much better or worse than passing around a function pointer that takes an event argument, but conceptually (at least to me) it feels better to say "I have a listener running that gets notified when something happens) than the callbacks I’ve worked with before. Since Go tracks channel reads and writes it also eliminates the callback hell problems you usually get with event managers where an update is queued somewhere and it causes the program to vomit and you have no idea where the event came from. When a program crashes as a result of an event, I get a stack trace that traces exactly where the event came from, even if it was passed through multiple channels before it got there.

I’ll have to give Go a shot. The platform I’m working on now (C# / WinForms) is pretty much a dead end.

I haven’t heard much about Go in connection with Game development before.

Are there any good graphics libraries that work with it?

Nobody has really done a full game dev project in it yet :). I actually first heard about Go from an article about a failed Kickstarter where the programmer quit and left behind this huge Go codebase that nobody could help with because nobody knew Go.

There’s no big graphics libraries yet. To save you the searching, for Open GL you’d want Go-gl. I use the gl and glfw3 subrepositories. I’m doing all my rendering myself. There were some SDL libraries, but they all seem abandoned.

For audio, I wrapped OpenAL myself, but I’m thinking of open sourcing it.

As far as graphics libraries go, there are a small number of 3D math libraries, most of them are good, I’ll just shill mine mathgl which is supposed to be more or less a standin for GLM in C++, in the examples directory are ports of a decent number of the OpenGL 3.3 tutorials at, with my library swapped for GLM. A couple days ago I added some basic 2D shapes and bezier curves and splines. I plan to add a few more primitives and utility functions as time goes on. (This package was really the only place where lack of generics got me, you’ll see, for instance, that I use code generation to generate matrices for both float32 and float64, and I have to define seperate functions for 2D and 3D versions of things like bezier curves)

I’m still a beginner when it comes to a lot of that stuff, but hopefully I can pick it up . Thanks for the Open GL link, that should be helpful.

I might try to port my ‘Grav’ program to Go just to get used to the language.