How do programmers create interactive games? Does every game have a winning solution if the player knows (or guesses) what
sequence of events to follow? Like in the old game Tetris. If the player rotates the falling piece to a specific orientation and
then drops it on a specific spot on a specific line, does that generate a specific next falling piece? Or is it all completely
random? If a person is a great games programmer, could that person also be a great programmer for, let's say, an operating system
if the game and OS use the same language? How does programming for a 2 dimensional game like Tetris differ from programming for a
3-D game like World of Warcraft? And since WoW has so many more variables than Tetris can a programmer really anticipate every
possible move that a player can make? Does a programmer also have to have artistic skills to create (draw) the characters?
Wow. (No pun intended.) That's a lot of questions about gaming and software development.
It's going to be hard to give a detailed explanation of how this stuff all works, but I'll try to make a few observations and
comparisons that might make things a little more understandable. Maybe.
And, perhaps, allow me to write-off this month's World of Warcraft subscription as a business expense.
]]>
<![CDATA[
Become a Patron of Ask Leo! and go ad-free!
Let's start with this whole concept of "winning" that you mentioned.
Yes, many games do, in fact, have a single goal that you either meet, or you do not. You either complete a sequence of
accomplishments or arrive at some kind of end-condition and you're said to have won. Clearing the field in Minesweeper is a good example. You either win, or you don't.
The two games that you mention actually don't work that way, and have a different measure of success: "high scores" or
accomplishments. There's really no end to the game, no place where you say "I've won". You're simply limited by your own ability -
be it speed, patience or something else.
That kind of answers your first question: not all games have solutions at all. While a game like Minesweeper definitely has an
end condition that it checks for, games like Tetris just change their characteristics
over time to become harder and harder as you collect more and more points. There's no solution, only persistence, and "winning" is
only relative in comparison to other players' scores.
Typically, games rely heavily on randomness. While I can't speak for Tetris specifically, it's likely that the next piece (or
rather the next-next piece, since the next piece is actually visible while you're controlling the current piece) is chosen
completely at random. However, that's a choice made by the game designer, and it certainly doesn't have to be that way. Next moves
could be random, they could be sequenced (if you just dropped a "T" then the next-next piece will be an "L"), or as in the case of
computer chess it could be analytical, where the software analyzes all possible moves available to it and chooses the one that's
considered "the best" by whatever algorithm the programmer has elected to use.
Which actually bring us to the real meaty question: just how do these games work?
There's no simple answer, since games have become almost infinitely complex. However, we can try a few generalizations. (Let me
be clear, I have no idea how Tetris, Minesweeper or World of Warcraft really work. I'm simply hypothesizing so as to describe some
general concepts.)
Ultimately, 2-D games like Tetris, and 3-D "Massively Multiple Player Online Role Playing Games" (MMPORPG) like World of Warcraft share some very common conceptual roots, but differ of course tremendously in
size and complexity.
Generally, computer games don't try to keep track of all possible positions, states or combinations that its components could be
in. For example, in World of Warcraft having to keep track of, say, all possible combinations of player characters and walls they
could walk into or cliffs they could jump off of would simply be unmanageable.
Instead, the world of the game is likely more-or-less defined as sets of objects - player characters (like mine), non-player
characters (like monsters), objects that can "do things" (like a sword my character might carry), and objects that simply fill up
the virtual environment (walls, rocks, landscape, buildings and the like) - and the set of states those objects are in (my
character is in this location, and is carrying that sword).
Actions in the game are then defined by the properties of all those objects, and how they interact with each other. For example,
an object like a wall might be solid, meaning that if I try to walk my character into a wall the software calculates the
interaction and prevents me from moving through it. The real work of a 3-D game like WoW is simply defining the hundreds of
thousands, if not millions of objects that make up the game, and the "rules" of how they interact. It's not a process that tries to
anticipate every possible interaction in advance, but rather a set of rules that tries to react to what might happen by
saying things like "this is how this object reacts to this type of interaction".
Once you define the properties of all these objects, you, essentially, just throw a few hundred or thousand players at it, and
let 'em all bounce around and interact with each other and see what happens.
So how do you "play" or "win"? Consider that some of the object's properties might be things like "award points when killed" if
a monster or enemy player, or "unlock or change the properties of some other object when discovered". As players play they
accumulate points, they get stronger (their own properties change over time based on the objects they've interacted with in the
past), they pick up other objects, discover new objects - either items or landscapes or who knows what. It goes on and on.
The goal is often not to "win", per se, but simply to accomplish things, and have fun along the way.
But as you can see it can get extremely complex.
There are so many different aspects to programming games that I can't really make a blanket response to your question of "if
they're good at programming games, would they be good at programming operating systems?". In some cases the answer is a very strong
yes - in fact for a game like World of Warcraft I'm sure that the complexity of the game software, if not some of its actual
characteristics, are very much on a par with operating systems. However, other aspects of gaming are not. The skills that allow a
programmer to understand how to render animated 3-D images in a fast paced game may, or may not, have applicability in operating
systems but could make them extremely valuable in the digital movie-making industry.
I will say that it's my personal belief that a truly good programmer could be quite capable of working well in many areas. More
commonly the true limiting factor is their own passion and interest.
Finally a word about artistic skills. It may have been true when Tetris was written that the programmer had to make it look nice
enough to work, but in today's environment games are so tremendously huge that they're written by large teams of people. As you
might expect those teams are comprised of individuals with a wire range of skills and talents. WoW might well be a team hundreds if
not thousands of individuals. As you might imagine, some are excellent programmers and some are excellent artists. Crossover may
help, but in a case like this it's typically not a requirement.
I totally agree with Leo. A great programmer is actually 10 times better than a regular programmer. If a great Programmer is able to create a game like MineSweeper, there should be no reason why this person could not also *learn* how to create an Operating System.
I am a Computer Engineer and my main concentration is by no means programming, but I am able to program easily, quickly, and intuitively, in multiple languages. It is something I am good at because I have that understanding of how computers really works is uncanny, both because of my major, and because of that *interest* Leo was talking about.
I can teach myself just as easily as I can learn/shift my styles compared to other people. Can I program an Operating System? Yes, I most definitely can as long as I am willing to learn and start a multi year/decade project, but it is very doable for many great programmers.
That’s really true. A good software programmer might be able to do programming for an OS but that’s not entirely necessary. Depends on the programmer’s capabilities and interests also.
A Software programmer may design games at your own will if you please.
If you like you can certainly program anything when you become good at programming.
As per the games that the asker mentioned, most of them are totally random or are based on the user’s stimulus to the game. You might get a cop alerted if you fire a shot at him but not if you just keep going on without doing nothing. Only the events are programmed for all interactions and doings. As far as the latest and greatest games are concerned, there’s not sure shot way of saying that they have sequence to “win”. They might have an overall gameplay sequence but that is supposed to be the “story” for the game.
You can definitely earn more money if you can design AND program a game / software.