Game Developers are Skill Vampires


Game Development is an interesting discipline to say the least… Nowhere near as insular as you might think at a glance.
In any other discipline, you’re probably going to specialise your skills and knowledge to an intense degree… I mean, there are at least 4 different professions involved in building houses (Builder, Architect, Plumber, Electrician), which is a fundamental human need… And these specialisations don’t really need to know much at all about how the others work (for the most part).
No so, Game Development!


Game Developers actually draw skills and knowledge from a surprisingly wide variety of places when making their games…

This thought occurred to me while I was considering OTTD, and how easy (or not) it would be to create something similar as a side-project.

Now, my favourite part of that game is the train system. Complex system configuring, routing, timetabling, optimising destionation-cargo-train relations… Building a robust and efficient system and then sitting back and watching the cogs turn in glorious co-operation. It’s like my very own catnip. So of course, since that’s the most complex part of the game, and therefore probably the hardest to make, that’s where most of my thought went.

(You need look no further for a testament to the complexity of the train system than a 5 part 30-50 minute video tutorial on one of it’s major components, as shown below)

Funnily enough though, I didn’t have to think all that hard about how I’d do it.. I can just bring across my knowledge of network administration (namely how the routing protocol OSPF works) and convert it to a game context.

OSPF works by having nodes which know how to reach their directly linked nodes, and advertise their directly linked nodes to their other directly linked nodes. They in-turn advertise everything they know to their linked nodes, and so-on until everynode knows how reach everynode else.

It’s like driving in a foreign country and you’re trying to get to <Destination> but you don’t know where it is and can’t really speak the language. All you know is the phrase “Which of these roads leads to <Destination>?”, which you ask someone at every intersection you come across. The person at each intersection will point down one of the roads, which you follow until eventually one of them points back the way you came and you realise it’s on the stretch of road you’re on now (except in the case of the game, the destination is also an intersection, so they’d point straight down or something).

(My finely tuned system metaphor in action, look at those happy customers!)

All I’d need to do is implement something like that to make sure that any user-placed track systems could be routed through.
Sure, signalling systems would complicate it in a way that OSPF would never really experience these days, but it could handle it if it had to. Just make certain the link states are kept separately per interface and not per link, ie: “X can reach Y” and “Y can reach X”, rather than “X and Y can reach each other”, to implement it as more of a directed graph than a bi-directional flow (pulling in yet another discipline, Discrete Math, for the graphing terminology).

After that it’s a relatively simple matter of designating any tile containing track, with more than two adjacent tiles also containing track (a junction), as a node. Plus the ability to treat a grouping of tracks, regardless of track adjacencies, as a node (for stations).
Since really all the trains care about is which way to go through a junction to reach a particular station, all the nodes need to do is keep a list for each adjacent track, that contains which stations can be reached via connected nodes along that link.
Now that the nodes are storing all the stations they know how to get to, and the direction to travel to reach them, all the trains need to do is ask each node they come across to point them in the direction of their destination, until the next node they come across is their destination.

(Is this a Computer Network or a Rail Network? You can’t know just by looking, which shows just how similarly they function at a high level abstraction)

Lots of Networking knowledge, still related to computers but definitely not the same discipline as Games Development, being of vital importance to a Game Developer’s ability to make the game. I shudder to think how I’d try to implement that kind of system (read: re-invent a very complex wheel) were I not aware of OSPF and how it works.