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


I am working on below challenge.

My psedo code of approach is
1. iterate given arry
2. find position of 4
3. set next position to 5 by keeping orignal value in buffere
4. create other for loop from  index position where we found 4 plus two and if that value is 5 replace with buffere
5. return modified array

public int[] fix45(int[] nums) {

	    for (int z = 0; z < nums.length; z++)
	        if (nums[z] == 4) {
	            int buffer = nums[z + 1];
	            nums[z + 1] = 5;
	            for (int j = z + 2; j < nums.length; j++)
	                if (nums[j] == 5) 
	                	nums[j] = buffer;
	    return nums;


Open in new window

i am failing below tests. please advise
Expected      Run            
fix45([5, 4, 9, 4, 9, 5]) → [9, 4, 5, 4, 5, 9]      [5, 4, 5, 4, 5, 9]      X      
fix45([1, 4, 1, 5]) → [1, 4, 5, 1]      [1, 4, 5, 1]      OK      
fix45([1, 4, 1, 5, 5, 4, 1]) → [1, 4, 5, 1, 1, 4, 5]      [1, 4, 5, 1, 1, 4, 5]      OK      
fix45([4, 9, 4, 9, 5, 5, 4, 9, 5]) → [4, 5, 4, 5, 9, 9, 4, 5, 9]      [4, 5, 4, 5, 9, 9, 4, 5, 9]      OK      
fix45([5, 5, 4, 1, 4, 1]) → [1, 1, 4, 5, 4, 5]      [5, 5, 4, 5, 4, 5]      X      
fix45([4, 2, 2, 5]) → [4, 5, 2, 2]      [4, 5, 2, 2]      OK      
fix45([4, 2, 4, 2, 5, 5]) → [4, 5, 4, 5, 2, 2]      [4, 5, 4, 5, 2, 2]      OK      
fix45([4, 2, 4, 5, 5]) → [4, 5, 4, 5, 2]      [4, 5, 4, 5, 2]      OK      
fix45([1, 1, 1]) → [1, 1, 1]      [1, 1, 1]      OK      
fix45([4, 5]) → [4, 5]      [4, 5]      OK      
fix45([5, 4, 1]) → [1, 4, 5]      [5, 4, 5]      X      
fix45([]) → []      []      OK      
fix45([5, 4, 5, 4, 1]) → [1, 4, 5, 4, 5]      [5, 4, 5, 4, 5]      X      
fix45([4, 5, 4, 1, 5]) → [4, 5, 4, 5, 1]      [4, 5, 4, 5, 1]      OK      
fix45([3, 4, 5]) → [3, 4, 5]      [3, 4, 5]      OK      
fix45([4, 1, 5]) → [4, 5, 1]      [4, 5, 1]      OK      
fix45([5, 4, 1]) → [1, 4, 5]      [5, 4, 5]      X      
fix45([2, 4, 2, 5]) → [2, 4, 5, 2]      [2, 4, 5, 2]      OK      
other tests
I need a large selection of 3D household objects, like books, furniture, appliances, computers, etc. Could someone recommend a place that offers them for free?

For example, I was thinking maybe there's an open source DB of objects used for gaming that's the standard among developers.

Thank you in advance,
I am investigating cloud gaming as a future possible project for my company. Could you provide a few sites that currently provide such free or paid services? What I understand as cloud gaming is actually running any performance intensive game in the cloud so that it can be run on computer that do not meet even minimal system requirements for that game. I assume that it should use HTML5 rather than Adobe Flash. Also all other information on current state of Cloud gaming will be greatly appreciated.
I am trying to convert a X,Y,Z rotation from the rotate anim curves to a local quaternion of a bone.

I've read that "Total Rotation = Pre Rotation * Rotation * Post Rotation

where Pre Rotation = Joint Orient,  and Post Rotation is Rotate Orient

How exactly out of Maya SDK do I get these  Pre and Post rotations?  -- What exactly are they?

My friend wants to build a monster gaming computer. Money is not a problem.
I want to know if you have any  recommendations or any comments to this setup.

The build, as it are right now.

ASUS Z170 PRO GAMING, Socket-1151

Intel Core i7-6700K Skylake Processor
Corsair Hydro Series H100i v2 CPU Cooler

Gigabyte GeForce GTX 1080 Xtreme Gaming

Fractal Design Edison M 750W PSU
ATX 120V v2.4, 80 Plus Gold

Cooler Master MasterCase Pro 5

Kingston SSDNow UV400 480GB SSD

HyperX Fury DDR4 2400MHz 16GB
2x8GB 2400MHz (PC4-19200) DDR4

Here is a list from a Danish webshop. >
What are your thoughts ?  (Please note that there is a quantity of 2 in the basket - I have to build two identical systems)

Is there something I've overlooked ? Should all hardware be compatible?

Thank you
Hi.  I am trying to compile the C++ version of the OpenGL Utility Toolkit (GLUT) 3.7, available from:

using the Visual Studio 2015 Developer Command Prompt and running simply the "glutmake.bat" file, but I keep getting the following link error:

    LINK : fatal error LNK1104: cannot open file 'glut32.lib'

which is odd, since "glut32.lib" is what I am trying to build.  Have any of you been able to compile GLUT using Visual Studio 2015 (or an earlier recent version of Visual Studio)?

Thank you.
Hi, I have a scene in a Unity 3D game (Windows version using C# as a programming language), which I would like to see the player from multiple angles. I plan to add four other cameras to the scene and focus each of them on the player. So, as the player moves through the scene, I'll be able to see different visual perspectives.

That all of in itself is not difficult. The part I need help with is - how can I make the cameras record the play-through, so I can play them back after the scene is over and so I can watch the different perspectives?

I would need a script of some sort that is added to each camera that does the following as soon as the scene begins:

1). Create a file on the hard drive to capture each of the camera views.
2). Record the video for each camera while the play-through is ongoing.
3). Close the file containing the recorded video for each camera.
4). I would then need a way to play the videos back.

Your help and suggestions would be greatly appreciated.

Thank you,
Drawing ellipses involves an A, B value set, which basically specifies a rectangle that will frame the ellipse.

I'm at the point in my game where I'd like to draw a solar system from a view as if having arrived at it, in a capital ship, overlooking it.
I can do the spinning ( orbiting ) planets in the ellipse box, but my code is an entire RTS network game, so maybe we can discuss how the framing of the planets' orbits would best be done, in Java, so that the elliptical centers are where the sun would be, with up to 4 or 5 planets. It would not be a simple above view of many circles, but a 3D type view of arriving at the solar system, like looking over a landscape.

I have a desktop in the front of a conference room and I'd like to have the attendees who are currently in the room (NOT REMOTE) "buzz" in their responses to my questions --kind of like a game show.  I'd like to know see was the first person to buzz in.  I'd like them to use their laptop, android or iPhone device to "buzz" the moderator in front.
 Nothing elaborate here.  All the attendees are in one room, with one pc in front.
Im trying to do a star field view for my Java game that has a few dozen stars fixed in 3D space.
How should I represent my star field?
What is the best way to draw them all on to a JFrame, in a 3D view?

Im thinking that the eclipse equations
are useful from here

x = a cos Theta
y = b sin Theta

Would be useful. I have them with height and radius positioning now. - Stars around a central column?


I'd like to make my game occur in a 3D factual galaxy of neighborhood stars.

I have a pictorial map of our region here

I have the  factual light year distances from Sol, our system. here

They did this exactly in Star Control 1.
With the stars positioned vertically around an upright core y-axis, How would you go about assigning the height parameter for each star, if I have the radii for the stars?

I want to make an online game but one problem I see coming is storing peoples passwords.

I'm hoping there is some service that could store them for me or do I have to learn how to encrypt passwords?
I'm more or less against storing peoples passwords on my computer because two things. One that sounds illegal if done wrong and two I most likely couldn't do it right to be safe.

The main reason I don't want to store peoples passwords on my computer is also, I want people to trust giving their password out to my game.

last thing, I am fine will learning a new API.
But I will be coding in C#
In my RTS, I could load all possible images at the start of the game for the races in play, or load them when they could potentially be needed. (new unit type creation.) I am using Java right now.

Which is the best? I don't want to load a ton of ordinance images etc, if they aren't needed. ( that race isn't playing) The unit that invokes them might not even be used.
Well, with modern computers, it probably doesn't matter. This isn't the good old days of 256 MB memory.

What it best?


My Python code that is supposed to print a 2D array of width and height doesn't  compile, work, and I can't see why!?

Any pointers?

for y in range(0,height) :
    for x in range (0,width) :
        widthString = widthString +", "+str(x);

Open in new window

I'm looking for an online resource that lists the current McDonalds Monopoly game odds of winning.

For example I have collected the Marvin Gardens property and am wondering what the odds are for collecting the other two properties in this set. Also what are the odds of getting the Marvin Gardens property in this game?

I'm looking for information that pertains to the current McDonalds Monopoly game and odds of winning.
I can't get numbers on their sites, other than syllabus,
but might anyone give me an idea of the size of MIT and UC Berkley Artificial Intelligence programs - Masters, PHD's, undergraduates?
What is the premier AI institute? Is it in the USA? Gaming AI? NLP? Stock Market analysis?

Is Java the most often used language when it comes to AI research?

I am a beginner,Unfortunately, the snake's movement can not write I do not understand how to do it? Do you like the idea?
note:In fact, I mean, flexibility is a must have when moving in different directions.
This is my idea:I've used several picturbox But I do not know how to join these To be flexible.Is this idea is wrong?
 I placed a picture of the game
My RTS engine is ready for a DEMO, butI'd like to have decent scenery tiles, structures and transparent unit animated .gif 's
Is there a page with selections of tile-sets, units and tiles? Now, my game is a giant mutalisk flapping party and it's ready for the next step.

In installing pygame on Mac OS 10.9.5, on the install instructions page here

Is that correct? There are new commands. For OS X, Is this a list of commands, or an unzip?

What is

Where do I type all those commands in? install . . . a terminal?
I thought this wasn't this complicated.. Where do I specify my .zip install file's location? Where must it install to? The Python 3.3.3 root folder? Must I forget the install zip and rely on the terminal commands?

Must I just cut and paste all those commands?
I don't see how it gets the correct install file for my comp, or knows where to install to, or how to link to IDLE
I have a PC that I built for my son. It has 24GB of ram (recently upgraded from 8GB),  i5 Processor and a 2GB Asus Radeon R9 270x graphics card.
Lately he's been getting into 3d Rendering with UnReal Engine, something I hadn't foreseen. When he does certain actions, task manger says the CPU is at 100% (he's running Windows 8).
Two questions.
1. I was thinking if I upgrade his processor to an i7, it might help out with the performance issues. Is upgrading a processor as simple as just pulling the old one out and putting the new one in? I'm hoping I won't need reinstall the OS and all other software.

2. I know that a high end graphics card is important in 3D rendering.  When the task manager says the CPU is at 100% could it be talking about the graphics card and not the CPU?

I want to make sure I upgrade the right piece of hardware.
I'm assuming functions like "OnMouseOver" are ray casting or something similar behind the scenes. In order for it to know to call the function, it has to spend the resources to find out if the mouse is over the object.

I'm wondering if it does an internal check if the function exists before seeing if the mouse is over it or if that still happens behind the scenes anyway.

- Thanks!
I'd like to make sure I have the best / proper Pygame download for my OS X  Python
Many choices on ! I'm going to be doing a lot of game making.
Previous downloads have not connected. Where should I install it to on OS X - In my Python directory, where does it live?
I can go to the applications folder, there is a python folder with IDLE, and the launchers. What should I know? In to there?

My specs don't seem to be matched
OS X 10.9.5
Python 3.3.3

I asked a similar question, posing this possibility, but now I'm committed. . a local mom interested . .
In 1984, when I was 5, my dad showed me some code and got me started making games on our Apple IIe, and 16 years later, I sat in an Xbox office (coding)

I am going to teach local youths how to code, with private lessons. Can anyone suggest an example w/ page of some seriously cool Python code to excite a kid today. Things are v. different now. Paratrooper or King's Quest was enough for me back then, but now, I'd like to be able to show a student's mom that something like *this* is possible. - tho it took me a while, I was making decent stuff in 3rd grade. Turbo Pascal hit the scene soon.
I know Python doesn't have DirectX, or even AWT (well, it does in Jython) but what might be a decent bet to be able to show parents and child what Python can do, just like my brother and I started on textual maze games in Apple Basic, and 320x200 packman clones, PC soon.
I know there's a long learning time needed, but for starting, are there any suggestions w/ page? I could also show my chess game JFrame, with invulnerable AI. (makes random legal moves)
I'd prefer Java or C++, of course, but that's not very practical now. Python is the way.
We have an app that works great, but there is a minor cosmetic issue I would like to resolve.

The app's primary job is to collect information from a user (fill out a fancy form) and send it to a centralized server. Sort of like a wizard.

At each step, we execute a loop to move all the panels off the screen by setting "left" to 2000.

Then, we set the left value of the panel for the current step to 20 (it's actually calculated based on the screen resolution, but let's say "20" for now).

The problem is: the screen flashes when we cycle through the forms. It's minor, and only for a split second, but you can see it, and I think it's distracting.

Part of the issue (I think) is that the background image for the form is 1920x1080, and we have set the panels background color to transparent. Thus, it's painting the screen and calculating transparency.

Is there a better way to do this?
I am trying to program an MMRPG so it can be played on Xbox One and Play Station 4 and I do not know the coding. The game is an online interactive game, and multiple components will need to be connected via bluetooth to the game. Does anyone know how to program the drive in order to do this?

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