Ask a games programmer

Question: I was thinking about getting some programming practice doing a Facebook app game. Is the actual code mostly just Javascript? Is it possible to link that up to some C++ code? Along those lines, I'm kind of wondering why CivWorld doesn't look like crap compared to the average web-browser game.
 
How accurate is this chart, Para? ;)

attachment.php
 
Perhaps somewhat OT, but how does one go about 'writing' a programming language? In fact, how was the transition from a 'conventional' machine to something that could be programmed by tapping on a keyboard ever made?
 
I've always kinda wondered that myself? What came first, the language or the compiler for the language? And if the compiler...well....chicken and the egg?
 
Perhaps somewhat OT, but how does one go about 'writing' a programming language? In fact, how was the transition from a 'conventional' machine to something that could be programmed by tapping on a keyboard ever made?

I've studied some binary and assembly language programming in school, so I'll take a stab at it. Basically it works that computers see the world as a bunch of binary numbers. Data and Instructions are all encoded that way. Above that, there is a pyramid of multiple abstraction levels leading up to common programming languages (e.g. C++) and various scripting languages. The top level of the pyramid isn't a single focus, but could be various programming languages written for different reasons including scripting programs; some of the top level languages actually use a lower level of language as their basis, but generally most are purpose built to talk directly to the computer.

Assembly level is the first and generally most direct way that a programmer could talk to the computer, and coded into the CPU. It turns the binary numbers used as Instructions into a more human friendly symbolic structure. The system is very modular and baby-stepped that it is like constructing a grammatically correct sentence out of syllables though; but it also is very efficient in that the performance benefits of different instructions can be optimized and weighed (e.g. there might be only one way of adding two numbers together, but there might be multiple ways of writing and evaluation a complex mathematical formula). At this level the computer language developer would work (e.g. the guy/girl that made C++ or Pascal or Cobol, etc..).

EDIT: The C++ compiler would be made by C++ guy/girl. The programming language compiler would be written in assembly language while the language was designed. This is why there are multiple compliers for the same language, since they are just different implementations of the language.
 
Actually, C++ was first implemented as an interpreter called CFront, written by Bjarne Stroustrup and others at Bell Labs. It translated C++ into C so it could be ported to any computer that already had a working C compiler.

Modern optimizing compilers are frequently written in the language which they implement. They are then compiled by another existing compiler to create an initial version. Then that version is used to compile the original source so it optimizes itself.

And the precursor to assembly language was machine language, which is programming in ones and zeroes. Assembly language was a giant leap forward because you no longer had to compute addresses manually. You could refer to them symbolically instead.
 
I think this is a fallacy. The bang for your buck considers boilerplate code, memory leaks and other issues that high level languages often keep to a minimum? I believe the future is moving away from the C/C++ standard and it will only open the markets to better applications and definitely games. Why hurt yourself when you can do the same program in less time and less headaches in a higher level language? ;)

I'm guessing you haven't done much or any games programming. The .NET libraries have plenty of nice stuff in them, but they cover very little that's needed in games. 3D graphics API's - all C or C++. Essentially all game engines, physics engines, animation engines, scripting systems, etc - C++. Sure, you will save time tracking down memory leaks - but you'll waste a massive amount of time trying to roll your own wrappers or libraries to deal with all the things you lack.

I wouldn't hold your breath for a change any time soon. More games will probably go towards heavier use of scripting, but there isn't much of a reason to move away from C++ for your core engine.
 
My questions haven't been answered and I'm interested in finding out:

How much are your hands tied to satisfying shareholders/mainstream gamers? It seems to me nowadays with production costs being so high companies are taking the safe route over and over again.

If you could design a game with no expectations of profit, but just for fun, what type of game would you design?
 
Are game engines commoditised? I remember when I was in school, pretty much all decent FPSes used the Quake engines. Is this still the case? Is that a good thing?
 
I'm guessing you haven't done much or any games programming. The .NET libraries have plenty of nice stuff in them, but they cover very little that's needed in games. 3D graphics API's - all C or C++. Essentially all game engines, physics engines, animation engines, scripting systems, etc - C++. Sure, you will save time tracking down memory leaks - but you'll waste a massive amount of time trying to roll your own wrappers or libraries to deal with all the things you lack.

I wouldn't hold your breath for a change any time soon. More games will probably go towards heavier use of scripting, but there isn't much of a reason to move away from C++ for your core engine.

Under the assumption that 90% of games are running on C++ based engines, which is simply not true as the majority of the major engines out there focus on, say, FPS's. There are plenty of libraries available for all major languages for both 2D and 3D game development. You can't rightly afford the 50 grand of royalties to Epic Games for the Unreal Engine if you're a small studio anyhow, and even then there are genres out of of console based shooters.

Do not doubt the open source community when it comes to the tools you need. And on another note, C# is the definite language Microsoft is attempting to gather major support behind for future game releases on its' software. That is what the whole XNA project is about.
 
Are game engines commoditised? I remember when I was in school, pretty much all decent FPSes used the Quake engines. Is this still the case? Is that a good thing?

Several are, like the mentioned Unreal, also the indie Torque engine. Looking at the wikipedia list most proprietary engines stay under wraps (I guess to deter competition), though some are released like Quake to support indie development. http://en.wikipedia.org/wiki/List_of_game_engines
 
I've always kinda wondered that myself? What came first, the language or the compiler for the language? And if the compiler...well....chicken and the egg?

The first general purpose computer, ENIAC, had several walls of switchboards. Programming logic was expressed by how you physically connect these switchboards. To run a different program, you had to rewire the machine, which took days and was error-prone.

The first stored-program computer was the Baby from Manchester University (where I graduated!). "Stored" in the sense that the logic now exists as a list of instructions, each represented by a series of 0s and 1s, in the memory. These instructions are in machine code, and could be understood by the CPU (or the simpler ALU in the case of Baby), ie, the CPU has hardware circuits that do different things given different instructions. Programs were entered by using a panel of switches to individually set each bit of the memory.

Next in line was the EDSAC from Cambridge, the first computer to use a punched tape. By this time you no longer have to flip switches to modify a program.

Each instruction in the machine code usually has three parts: operation code, address, and flags. These are represented by a fixed-length list of 0s and 1s. In the case of EDSAC, the first five bits are the op-code, the next one is unused, followed by 10 bits of address, then 1 bit of a flag, making up a total of 17 bits. For example, 11100 0 000000010 0 means to add the number at memory address 000000010 to a register (a place to store an intermediate value).

As mentioned before, in Baby you'd set each bit separately. In EDSAC, you prepare the punched tape in a slightly different format. Each row in the tape has five locations that could be punched, corresponding to five bits in the instruction. The op-code occupies one row, the address two rows, and the single bit flag occupies one row on its own. So the above instruction becomes this on the tape:

11100
00000
00010
01100

Because this is rather hard to read or remember, the Cambridge folks designed a mnemonic so that the above can be written as A2S, where A is the op-code, 11100; 2 is the decimal form of the binary 000000010; and S (01100) is the code for value 0 for the flag. This was the origin of assembly language. In general, assembly code is just a more readable way of writing machine code.

When you feed the punched tape to EDSAC, the tape reader translates the four rows of holes and not-holes into twenty 1s and 0s. A special program already loaded into the machine, called the Initial Orders, would then translate the twenty bits into 17 bits of instruction. This program in some sense was the first assembler, although much of the translation, e.g. from A to 11100, was done by the programmer when he punched the tape.

For the next twenty-odd years, many programs were entered to a computer using some sort of punch cards. Each card is a grid of punching locations. The most popular version, designed by IBM, has 80 columns, representing one line of code with 80 characters. This allowed input of free text, and with it, higher level programming languages. One line of code in such languages translates to quite a few in machine language. This translation is the job of the compiler. The compiler has to be loaded to the machine first, then you run your punch cards through it. The first compiler would have to be written in some other language, for example assembly. Later iterations of the compiler may be written in the same language, and you can use a previously built compiler to compile a new version. This is called bootstrapping.

On-screen text editors were not invented until late 60s, when time-sharing operating systems were developed, allowing multiple users to use one mainframe computer at the same time. The most famous early editor, ed, was designed as part of the first Unix system, alongside the C programming language. This was pretty much the beginning of modern coding, where you sit in front of a screen, type in your program, compile and run it using just your keyboard.
 
Can you tell more about the profiling of code you do? What do you use to profile (esp. c++ cod), how useful is it, is it hard?
 
I'm on holiday at my Mum's in Northern Cyprus so can't answer all your questions at the moment ;)

A good stab has been made at answering most of them anyway.

For profiling on consoles the manufacturers supply us with a profiling library or kit which can take a snapshot of everything that gets done in a frame of execution (usually 1/60th or 130th of a seconds worh), which includes everything - execution time for functions, cache misses, gpu primitives rendered, how many pixels were rejected before being drawn, which pixels were overdrawn (i.e. drawn once and then replaced by a pixel nearer the camera), etc.

We look at the slowest bits and find ways to improve them.
 
Have you ever got so annoyed with a development process that you just went out to a deserted flour mill and danced all of your frustrations away?
 
Have you ever got so annoyed with a development process that you just went out to a deserted flour mill and danced all of your frustrations away?

Of course.
 
How many days a week do you work? Or hours? Seriously I assume you can email your work in and you have a sweet non office job.

Prove me wrong.
 
CS student here. Was it hard for you to get into tools coding, did you need an extensive portfolio? Do you have a related degree? What would you recommend people interested in games programming (not design) to focus on?
 
Usually work 5 days a week, 8 hours a day, in the office. Sometimes do a bit of overtime or weekends.

We have kit that isn't supposed to leave the office since it is top secret ;)

Read the rest of the thread to see how I got started...
 
Back
Top Bottom