Game Programming...

cgannon64

BOB DYLAN'S ROCKIN OUT!
Joined
Jun 19, 2002
Messages
19,213
Location
Hipster-Authorland, Brooklyn (Hell)
I know nothing about programming a game. I know there is code, and graphics, and engines, but that's about it. Since the idea of making games enthralls me, I was wondering if someone could help me out of my ignorance.

I know there is code that makes the game work, and an engine that runs the graphics and stuff, but how do they make all that? Do they write code for an engine, and then write code for the game, and then make graphics? Or do they make the game from scratch? How do they write code? I mean, how would I write a line of code making a headshot in an FPS lethal? How do define headshot? What are some languages used to write a game?

Sorry for all the questions, but I'm wondering if someone could point me in the right direction. I've always wanted to make games, but I've never known how. I'm just asking for a little info, that's all. :)
 
Several questions are to be asked first:
_ what kind of game do I want to do?
_ which language?
_ which "platform"?

=> If it's a small short game, like Flash game, then you have to use web languages. Otherwise C/C++ or VB would be fine.
=> But just keep in mind that nowadays, any game would require a huge team of people. Programmers, graphists, musicians, scenario makers...
 
Originally posted by GenghisK
Several questions are to be asked first:
_ what kind of game do I want to do?
_ which language?
_ which "platform"?

=> If it's a small short game, like Flash game, then you have to use web languages. Otherwise C/C++ or VB would be fine.
=> But just keep in mind that nowadays, any game would require a huge team of people. Programmers, graphists, musicians, scenario makers...

Just to let you know, I don't want to do anything now. I have no idea about any of those languages, or even what to make the game about. I was just wondering about some of the basic info surrounding game programming, because its always been up there on my list of interests.

I'm not sure my parents would be too thrilled to see me major in programming in college, but if I mentioned that video games are the fastest growing entertainment industry...;) :p
 
Actually in the early 80s, people like Peter Molyneux (Populous legend, Syndicate...) programmed a whole game in their bedroom, in front of their small computer. Remember the game Another World? His programmer, French Eric Chahi did it a 17 year old, beside his higschool. Plus he invented the squeletal animation... that would be used much the years later...
Anyway back to the problem, nowadays, there is no more such a thing. Games have become so complex that they require lot of people and saying "I wanna create games" is exactly like saying "I like to work in telecommunications". It's so vast. So you better have a clearer idea about what you *would like* to do. Which domain you'd be part of. I guess you're more suited for coding, rather than graphics eh :)
 
Originally posted by GenghisK

So you better have a clearer idea about what you *would like* to do. Which domain you'd be part of. I guess you're more suited for coding, rather than graphics eh :)

Probably something like that. I love to design levels (in the rare games that have good level designers ;)) and AI fascinates me. I'm sure, if I worked in the industry, it would be somewhere there. Graphics designing...eh, no. I can't even work Paint! ;) :lol:

Still, I have to find out more about these areas, which leads me back to my problem. Do you know how you can point me in the right direction? (e.g. sites!)
 
cgannon64,

You should learn a language, and once you have the basics create a simple game like draughts. C++ is maybe a good start, or VB if you want a more gentle introduction to programming. Get yourself a good book, or ebook, and use that to learn the basics. Try the samples they give you and try to understand what they're doing. Then apply that to creating a draughts game, just for 2 human players to start.

Once you have the human-human game done, you can make an AI to play against. The AI for moves in draughts is simple enough to do brute-force, so you can learn different algorithm techniques to do it. This would IMO be the best way to get in to programming from a games perspective.

Draughts may seme a little trivial, but it is enough to keep you occupied for a month or so I reckon. :)
 
Draughts trivial :eek:

I recommend starting with noughts and crosses.

I once wrote a OXO program that moved randomly but learned when it lost not to make the last move again. I got it to play itself 10000 times - played nearly perfectly after that. I enjoyed the "learning" aspect of the program rather than a brute force approach. Even the most trivial game has a great deal of complexity when you come to write an AI. Even things like path finding algorithms aka the travelling salesman are far from easy.
 
The problem with a neural 'learning' system is that as a programmer you (e.g. col) can understand how a program can interact with itself and that requires a high level of knowledge. A beginner is better off IMO learing how to write a decent algorithm.

Path finding alrogithms are based in theory of algebra and optimisation theory, but anyone can find the forumla on the internet or in a good book for 'least paths', etc. Knowing how to write this in code form is very useful, and should be the core of any AI-coder wannabe.

Maybe the moral of the story is 'don't try to be an AI-coder unless you are prepard to do some decent coding!' (i.e. mathmatically based coding).
 
Originally posted by cgannon64
I know there is code that makes the game work, and an engine that runs the graphics and stuff, but how do they make all that? Do they write code for an engine, and then write code for the game, and then make graphics?
Now-a-days they have multiple teams working on different aspects of the games at the same time. You will have the programmers hacking away at the engine, the computer artists doing the graphics, the AI programmer(s) working with the engine coders, level designers working with the graphics artists (for FPS games especially).

Or do they make the game from scratch?

Sometimes - Some companies, like Raven, take engines, like Quake or Unreal, and write a game for it (the game being the idea behind it, the AI, the addons to the main engine, the graphics and levels).

How do they write code?
Normally they sit down and list, from the top down what they want to do. They go from We want to do a FPS (first person shooter) and branch down all the way to what color will the shoes be.

I mean, how would I write a line of code making a headshot in an FPS lethal? How do define headshot?
Define a headshot? Well, they would say if the character is aiming and it is within X amount of pixels of point H then it is considered a head shot. It might look something like:

# <- is a comment

#Variables:
MaxHealth = 100
CurrentHealth = (If StartOfGame = Yes; then MaxHealth; else LastKnownNumber; endif)
NormalShot = (CurrentHealth - 25)
HeadShot = (CurrentHealth - 200)
FlyingHead = RemoveHeadFromNeckAndSprayBloodGraphic
Hdistance = (400,200) #pixel on screen

#The headshot code:
If
SniperRifleShot = (Hdistance - X) ;
then
HeadShot ;
FlyingHead;
else
NormalShot ;
endif

This is a rough example of the logic behind it - not the actual code.
What are some languages used to write a game?
C++ is the main one - Nvidia is thrying to push their special programming language - can't remember the name.

Sorry for all the questions, but I'm wondering if someone could point me in the right direction. I've always wanted to make games, but I've never known how. I'm just asking for a little info, that's all. :)
I will look for some links. I have been interested in doing games for a long time also.
 
Basic idea about nowadays programming languages are objects which have attributes, methods and events. Most modern programming languages are event-driven.

What does this mean?

For example, a FPS:
An object is the shootist. A shootist has got a definite location in a game world, say 2nd floor, 4th corner. The character is also member of a playing party, say he is blue or red.

The game character is also able to perform some actions (methods). If he is running, he will change his attributes of location. If he fires his gun (another object by itself), the gun will empty its magazine. (# of shots is an attribute of the gun). Pulling the trigger of the gun (which is an event in this nomenclatura) will envoke the method of firing.

A programmer once defines the attributes/methods/events for any object in the game world and is henceforth free to use this definition to all realisations of the definition.

Example: define a car for once, and your are able to use this definition to a Cadillac, a Mercedes or a Toyota alike.

(Hope this is not too confusing)

C++ is probably the language most used for computer games. But it has a wierd syntax and few built-in fail-safe mechanisms.

If you want to start programming of your own, I'd recommend Java, which is more structured and less close to hardware than C++.

I guess, most programmers are relying on some algorithms (cooking recipes), that have been around for some time. The buzzword is RAD: rapid application developement, which basically means, you don't have to reinvent the wheel every time you need one.
 
If you want to program, learn C, C++, pascal, etc. You need to know how procedural work. If you want to be a designer, then start to draw and learn Softimage or Maya.
 
Don't neglect learning about databases! Lot's of games have the graphics and interface qualities that make a good game but they fall flat cause they can't handle the amount of data that is required to make a game with depth. Without the skills and experience in managing high volumes of data with precision and speed you will hit a wall that will limit the development/potential of your game. With the skills, you will have a much more rewarding approach to development.
 
I am not a programmer and always hesitate to comment in threads like this, but having read it I don't think the original question has been answered. So I'll give it a go..

Games software is built in modules. As you rightly say one of these modules is the engine. This deals with the core number crunching of the game. It takes input from other modules and the user and puts it through various decision making algorithms which changes the data (or not) and then it is output back out to the relevent modules. In my experience such engines like the Quake 2 engine are not written in a high level language like C. The whole quality of the gameplay revolves around tight low level sub-routines that are hyper efficient and minimize the clock cycles required to get from input to output. Because of this they are extremely expensive to develop. The Quake 2 engine has been used in many games an example of which is Unreal Tournament to save development time and money.

Then you have the graphics engines. Again this is not usually written in a language like C. There may be more than one graphics engine for instance to handle both OpenGL (open graphics library by Silicon Graphics) and DirectX (Microsoft). Running such a game in the different modes will make the game look substantially different and give different framerates. Each of these graphics systems have their own language, and you can download developer kits that allow you to program these things.

The graphical "images" themselves are usually 2d bitmaps that are wrapped around polygons (if 3D). The polygons are manipulated by the graphics engine, and the graphics engine is told what to make the polygons do by the game engine. The more polygons the better it looks but the slower it runs, hence the need for speed and tight programming.

Other modules will include AI which is really a subroutine set within the game engine which allows the computer players to react in a comprehensible manner. Then you have the I/O module which handles user input, sound module, networking, environment (MAP) and so it goes on and on.

For instance PTW is a glorified Networking module which has been plugged into the CIV III game engine, yet we pay for it as if its a whole new game.

All of the graphics and sound can be generated on high level software. This is necessary as it is created by artists, animators and musicians who are not programmers.

First person shoot 'em ups put more demands on a computer than any other commonly used software. They are created by huge teams of extremely clever people (e.g. John Cormack), and even then a lot of the programming has been "lifted" from elsewhere.

Duke Nukem 4 has been in development for at least 5 years now and 3D Realms still refuse to even contemplate a release date.

The civilization series is completely different and could (and maybe was) written in C, and may be the reason PTW is soooo laaagggy.

As for the question about headshots.. Well that is really similar to CIVIII. The group of polygons that represent a player have a certain number of hitpoints associated with it. A subgroup of polygons represents the players head. When any of those polygons occupy the same position in space and time as a projectile (Bullet) then the hitpoint reduction is set to be higher than the greatest number of hitpoints the player can have. The engine passes the players "life" to the appropriate death subroutine et voila. You've been fragged.

If you are serious about writing a game from scratch on your own then be prepared for a lot of heartache. I wrote an asteroids program for a PET (I bet you wern't even born then). It took four weeks to write (in BASIC) and 6 months to debug.

Other posters here a correct when they suggest C++ as the language to learn. Visual basic is easier to learn but proggramming a game in it...bleah.

There used to be game design packages around that let you develop simple games with no programming. Dunno if they still exist.

Pontoon (Black Jack) is a good game to start with as it requires no intelligence on the part of the computer. You can just use a random number generator and a linear probability function to decide when the computer will take another card or stick.

I now wait with baited breath for a flood of ridicule from the programming guru community. C'mon I can take it.
 
Start with Pascal.
 
Is Pascal OO these days then? I only remember Borland Pascal from about 8 years ago, and it was procedural.

If not, I would say use an OO language from the start.
 
Must have been version 5 I was using then :eek:
 
Originally posted by mad-bax

There used to be game design packages around that let you develop simple games with no programming. Dunno if they still exist.

Yes, there are quite a few out there. They all suck, too. I'd suggest learning a relatively simple language first. If you want your game to be about as simple as possible, a text adventure, a system like Inform or TADS would make a nice introduction. I don't know much about programming beyond that, but it seems to me a general-purpose system like C++ would be overkill for just a simple game. But then, even simple ones can require a surprising amount of stuff...
 
Back
Top Bottom