Game Programming

Game programming is the software development of video games. Game programming requires substantial skill in software engineering as well as specialization in simulation, computer graphics, artificial intelligence, physics, audio programming, and input. Like other software, game development programs are generated from source code to the actual program by a compiler. Source code can be developed with almost any text editor, but most professional game programmers use a full integrated development environment (IDE).

Share tech news, updates, or what's on your mind.

Sign up to Post

Was wondering if anyone had reference to code or another source to help aid in this project. I would like to scan in 52 images, like a deck of cards, then create code to randomly shuffle the cards and when I click deal, it will display one of these cards, and remove that from the randomizer, so only 51 cards left. Once completed with the 52 cards, the deck would reshuffle and we can deal again. Has anyone created or know where to get going on this would be great, thanks! Preferably html based.

I was wondering if anybody could explain to me in detail how to animate milkshape models after they are loaded. I have code to load and texture map a model in opengl and a matrice class but don't really know how to put them together. Any help would be most usefull and i have attached what i have.

// max values
#define MAX_VERTICES    65534
#define MAX_TRIANGLES   65534
#define MAX_GROUPS      255
#define MAX_MATERIALS   128
#define MAX_JOINTS      128

#define SELECTED        1
#define HIDDEN          2
#define SELECTED2       4
#define DIRTY           8

#ifndef byte
typedef unsigned char byte;
#endif // byte

#ifndef word
typedef unsigned short word;
#endif // word

// force one byte alignment
#include <pshpack1.h>
#include <string>
#include "3dMath.h"

using namespace std;

struct ms_3d_header
    string  id;                                     // always "MS3D000000"
    int     version;                                    // 4

struct ms_3d_vertex
    byte    flags;                                      // SELECTED | SELECTED2 | HIDDEN
    float   vertex[3];                                  //
    char    boneid;                                     // -1 = no bone
    byte    referencecount;

struct ms_3d_triangle
    word    flags;                                      // SELECTED | SELECTED2 | HIDDEN
    word    vertexindice[3];       [/code]…
Im looking for a simple way of rendering an SVG image into OpenGL. I want to render read in an SVG file and render it onto an OpenGL texture. Is there a library pre-defined for this?

Thank you
I have to write a research paper on how to design a system to simulate a game of monopoly. I'm new to this field of software design and am needing some help getting started. Thanks!
Since I'm learning to make movies using the technique of machinima, I wanted to know if instead of MovieStorm or iClone,I could use the editor of Unreal Tournament 3 (or if you know better editors) to build the scenes of my movie. Can I display the players without weapons in their hands ? Can I display my player without using the first person perspective ? Do you know about any map located in space, where I can see stars,planets and even the interior of a spacecraft ?
I have just purchased a HD tele with HDMI inputs and would like to source  a cable for by xbox 360.  Do I need the MS branded cable or will any do?  If I can buy a non-MS cable which should I go for?  They vary widely in price and I see there are many standards with 1.4 being the current.  Not sure if this is relevant to my needs!
Hello. I have a object array in a foreach loop with in a (Do events loop) that I need to take a statring int value (position),pass it to the object, and then add +1 every loop, howver the other objects in the array seem to copy the same values of the first object in the array. Heres the code:

[code]class Program
        public static int[] nummbArray = {100, 333};//array for starting y position values
        static bubblez[] bubblemove = new bubblez[2]; //object array
        static int c=0;
        static int ybub;//value passed to and from object        
        static void Main(string[] args)
           bubblemove[0] = new bubblez();
           bubblemove[1] = new bubblez();
               foreach (int nummb in nummbArray)
                    if (c == 2)
                      c = 0;
        public  static void bubz(int ybub, int nummb)
             ybub=nummb;//from local array to give each object a starting value.
        public class bubblez : Program
            public static int ybub2;
            public static int began;
            //private static int xbub2;

            public bubblez()
I use several web pages in my work. Lately, when i click on a "print this page" or "print" button in a web page, the print function window opens, flashes and closes immediately.  I am not fast enough to even select a printer.  What's going on.  I am running Vista Home Professional
Im trying to download directx10 off the microsoft site but it seems like only directx 9.0c is the only one avaliable. Can someone please direct me to the right place?
I have a Geforce 9600 GT graphics card running on windows 7 with two screens running off it Every time I open IE8 and try to access my CCTV on my secondary screen nothing appears, but when I move the webpage to my primary screen it works fine.

I have re-installed with the latest drivers and have played around with all the settings on the graphics with no joy.
the file can be viewed here

when you click on the ball, it starts checking every 15 miliseconds where the mouse is  - section 1 of code below

section 2 attaches the red arrow (handle) and draws a line - myDraw is the line.

section 3 - while the user moves the mouse around - calculates angles. - the getDist checks that you're actually applying force, where force is determined by how far the arrow is from the ball.

section 4 - once i release the ball it starts moving

if you look at the posted example, if you set the ball into motion (don't make it go too hard or it will go off the screen) - you'll see that it slows down to almost stop, and then it starts "drifting" in a different direction.

What I'm hoping is to figure out why it's doing this. I don't get vectors and stuff - but i'm hoping if someone can help me to "get it" - i can then manipulate the code and also handle collision detection to bounce off obstacles properly.

also note their should be no gravity in this example.

[code]//section 1
distance = (13+Math.min(100, getDist(mouseX, ball.x, mouseY, ball.y)))/5;
mimouse.x -= Math.cos(Math.atan2(mimouse.y-mouseY, mimouse.x-mouseX))*((getDist(mouseX, mimouse.x, mouseY, mimouse.y)))/7;
mimouse.y -= Math.sin(Math.atan2(mimouse.y-mouseY, mimouse.x-mouseX))*((getDist(mouseX, mimouse.x, mouseY, mimouse.y)))/7;

//section 2
I want to make a human face - 3D modeling  using a camera. What kind of software should I use or buy?

The software I use is AutoCAD or 3Ds Max

basiquely, I want to know how DirectX use measure unit.

I want to reproduce the look of a "bumptop" desktop.
I know how to draw the cube with top open, I know how to place the camera.

but how am I supposed to define the unit ?
if for exemple, point 1 of CUBE is at 1,1,1 (x,y,z) and point 2 at 2,1,1
I'll have a valid cube.
but if I want to reproduce the "bumptop" (see image) on a 1024x768, what will be my X-unit for point 2 ?

[embed=doc 233240]
Please see my related question, I have another problem with that code.

Using the example, I am passing 4 vertices with gluTessVertex, however, in the callback function, I am getting four vertices.

I thought the whole purpose of these tesselation functions was to split the polygons into a series of triangles. I would therefore expect to get 6 vertices (for two triangles) in the callback function. My task was to use the OpenGL tesselation functions so I could get the list of triangles out for any given polygon (with holes, later).

Either I've misunderstood something or my code is incorrect.

Any help is greatly appreciate as before.

I need to triangulate a polygon so am trying to capture the tesselated triangles using OpenGLs GLUtesselator class and callback functions.

However, I'm passing the correct data to gluTessVertex but inside the GLU_TESS_VERTEX function I'm just getting the same point.

Here is the tess function:

void _stdcall tcbVertex(GLvoid *vertexP)
  GLdouble *pointer;
  pointer = (GLdouble *) vertexP;

  GLdouble xval = pointer[0]; // always 0.0
  GLdouble yval = pointer[1]; // always 100.0
  GLdouble zval = pointer[2]; // always 0.0

and here's the rest of the code:

QList<Ogre::Vector3> vertexListBox;

vertexListBox << Ogre::Vector3(0.0, 0.0, 0.0);
vertexListBox << Ogre::Vector3(100.0, 0.0, 0.0);
vertexListBox << Ogre::Vector3(100.0, 100.0, 0.0);
vertexListBox << Ogre::Vector3(0.0, 100.0, 0.0);

GLUtesselator* tess = gluNewTess();

gluTessCallback (tess, GLU_TESS_BEGIN, (void(_stdcall*)())&tcbBegin);
gluTessCallback(tess, GLU_TESS_VERTEX, (void(_stdcall*)())&tcbVertex);
gluTessCallback (tess, GLU_TESS_END, (void(_stdcall*)())&tcbEnd);
gluTessBeginPolygon (tess, NULL);

gluTessBeginContour (tess);
     for (int i = 0; i < 4; i++)
       double veccy[3];
       veccy[0] =;
       veccy[1] =;
       veccy[2] =;

       gluTessVertex (tess, veccy, veccy); // Breakpoint here shows veccy is consistent with vertexListBox defined above

I'm getting this error: Access violation writing location 0x00000000 and I can't see any reason why I would get this error.

[code]for (int i = 1; i <= 32; i++)

// The error happens here, because of the Round function
            float x = (float)Round(sin(angle * i),4);
            float y = (float)Round(cos(angle * i),4);

            pVertices[i] = VertexPos(x,y,0.0f);

// The Round function

double MathHelper::Round(double number, int digits)
      double value = number;
      double off = pow((double)10,(double)digits);
      value *= off;

      if (modf(value,0) >= 0.5)
            if (value >= 0)
                  value = ceil(value);
                  value = floor(value);
            if (value >= 0)
                  value = floor(value);
                  value = ceil(value);

      value /= off;

      return value;
i would like some advice on the steps that needed to take a game idea off the drawing board and into reality.

if you have any books on the topis
advice to offer
companies that an be hired for programming different aspecs of the game.
i will accept any info.
I am a C++ programmer, I want to know the best way to head start Graphics programming, and how is the career in this computer graphics field ?

Him I found this great games Twin Blade

I wonder how to create a many level in games like this, are they create some level editor also?
and what is the best solution when we want to create multiple level (around 10 or more) in games like this (2D Sidescroller)?

How about 3D adv games anyway (somekind like mini ninjas games)?
Where can i find a Free 3D space Cadet pinball Download? For XP.
I've beam of light, which has direction in spherical coordinates in right-handed system of coordinates.
angle theta is the angle between the beam vector and axis y,
angle phi is the angle in x-z plane.

i need  the vector to be reflected when it hits a surface, which has normal N.

how can I calculate the new theta and phi angles, of the reflected vector?
Hi again guys,

Hope I can give enough info here for you to be able to give me what I need - I've tried to make sense of this but its a little too complicated for me at present - I've brushed up on all the info you've given me re: rotations / matrices / matrix multiplication etc and that has helped me pose the question better.

The following is a snippet from a website that shows how to obtain a Rotation Matrix from Euler Angles, then how to do the reverse.  However, this implementation is for rotations of the order XYZ only (and it works exactly how I want it to).  I've implemented the code to create a matrix using any of the permutations xyz, yzx, zxy, zyx, xzy, yxz (and the code to 'reverse' an XYZ)... However, what I need is the 5 remaining versions of the code given here to be able to 'reverse' back to eulers those matrices constructed with the rotation orders yzx, zxy, zyx, xzy and yxz. I'm hoping it is only a minor change in the code for each permuration (different matrix indexes but the same calculations?), and it would save me a hell of a lot of time if someone there who is v familiar with all this can do it quickly!  With the full set of 6 functions to reverse all the possible orders I will have enough to be able to monitor the outputs while my vehicle is moving around and ascertain which order is the correct one that was used originally (a reminder - I _do not_ have this particular information, I am reverse-engineering a global co-ord vector to get PRY values …
I have a trial version of my application written in .Net, and I would like to expire it after a couple of months.  Any suggestions on how to achieve this best?  
I'm not sure if this is a rediculous question or not but I was wondering how to convert the sprite structure below into a C++ class. I can't seem to find my old C++ programming book so I've been having a little trouble with this one.
[code]#ifndef _GAME_H
#define _GAME_H 1

//windows/directx headers
#include <d3d9.h>
#include <d3dx9.h>
#include <dxerr9.h>
#include <dsound.h>
#include <dinput.h>
#include <windows.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>

//framework-specific headers
#include "dxgraphics.h"
#include "dxaudio.h"
#include "dxinput.h"

//application title
#define APPTITLE "########"

//screen setup
#define FULLSCREEN 0       //0 = windowed, 1 = fullscreen
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480

//function prototypes
int Game_Init(HWND);
void Game_Run(HWND);
void Game_End(HWND);

//sprite structure
typedef struct {
    int x,y;
    int width,height;
    int movex,movey;
    int curframe,lastframe;
    int animdelay,animcount;
    int scalex, scaley;
    int rotation, rotaterate;

Hi all,

As a basic scenario of my problem:

Say I have a circle on a 400px by 400px form. The centre of the circle is at 200x and 200y, the circle has a diameter of 100px. (Though the diameter and centre positions are variable)

I will have dots randomly moving around the form these will be stored in an array as X,Y coordinates. I need to iterate through the array and determine if any given X,Y coord' is within the circumference of my circle. I then need to know the distance of a given X,Y coord from the circles centre position.

I lack the mathematical skill to think how best to go about this. Whatever the solution it needs to be quick as the X,Y dot coords' are constantly moving. I know there's plenty of resources on the internet, I've probably read them, math isn't a strong point of mine.

Thank you in advance for any help,


FYI: The actual program is to simulate a mobile (cell phone) network and consists of multiple circles acting as masts the dots being mobile phones. I just need to determine when the mobiles are within range of a mast so a solution to the above simple scenario should put me on the right track.


Game Programming

Game programming is the software development of video games. Game programming requires substantial skill in software engineering as well as specialization in simulation, computer graphics, artificial intelligence, physics, audio programming, and input. Like other software, game development programs are generated from source code to the actual program by a compiler. Source code can be developed with almost any text editor, but most professional game programmers use a full integrated development environment (IDE).

Top Experts In
Game Programming