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 developing a mini game in which the user must recognize the person's face and type in that person's name. Each picture is "saved" in a folder with the person's name, so the game uses both the picture and the filename... This is my code :

using System;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace FaceNameGame
{
    public partial class LevelOnePartTwo : Form
    {
        int point = 0, buttoncount = 0, i=0, h=3, hbuttoncount=0;
        public LevelOnePartTwo()
        {
            InitializeComponent();
        }

        private void LevelOnePartTwo_Load(object sender, EventArgs e)
        {

            string[] files = Directory.GetFiles(@"C:\Users\Marina\Desktop\FaceNameGame\images\Level1\used", "*.jpg", SearchOption.AllDirectories);
            PhotoPicBx.Load(files[i]);
            NameTxtBx.Focus();
            Pointlbl.Text = point.ToString();
            

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void PhotoPicBx_Click(object sender, EventArgs e)
        {

        }

        private void TemplatePicBx_Click(object sender, EventArgs e)
        {

        }

        private void 

Open in new window

0
How complex is this course .... and Java in general?
http://www.fitzwilliaminstitutegroup.ie/java_programming_courses_dublin_evening_diploma

My nephew (age 16) is starting this course later this month.
He wasn't very good at Primary School (i.e. Elementary School) and didn't do any Secondary School (i.e. High School).
He effectively left school at age 12.  His knowledge of maths/algebra is very limited.

He plays games all through the night ..... and like many teens, he is very lazy and respects no one.
He did set up and manage his own Minecraft Server. He still has a dedicated Server (mostly for games).
He regularly has code windows open modifying game scripts.
I don't think he creates scripts from scratch.

He is well above average on the IQ scale.
All he wants to do is Java and he is convinced that he will be a successful game programmer.
He has burnt many bridges behind him and has pinned everything on this course.

The course looks complex to me (and is way beyond my skill level).

What are his chances of succeeding at this introductory course
and some of the specialised follow-on Java courses?

Personally, I think he will flunk the course - but I hope I am wrong!
0
I have 54 flashcards to sequence in a card game I am creating, where some cards have required information contained on a prior card. And some cards should follow multiple cards.

Is there any online tool, downloadable software, or way to configure Excel (or MS Office program) so I can input the prerequisites for each card and have the sequence of the cards flow from there?

Thanks
0
Hi,
I am working on below challenge

http://codingbat.com/prob/p192383

Given a non-negative int n, compute recursively (no loops) the count of the occurrences of 8 as a digit, except that an 8 with another 8 immediately to its left counts double, so 8818 yields 4. Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12).

count8(8) → 1
count8(818) → 2
count8(8818) → 4

i am not clear on how to find eight count using recursion. please advise
0
Hi,

I am working on below challenge

http://codingbat.com/prob/p101409


Given a non-negative int n, return the count of the occurrences of 7 as a digit, so for example 717 yields 2. (no loops). Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12).

count7(717) → 2
count7(7) → 1
count7(123) → 0

Not clear on how to get 7 count recursively. please advisde
0
Hi,

I am working on below challenge

http://codingbat.com/prob/p194781

Recursion-1 > triangle
prev  |  next  |  chance
We have triangle made of blocks. The topmost row has 1 block, the next row down has 2 blocks, the next row has 3 blocks, and so on. Compute recursively (no loops or multiplication) the total number of blocks in such a triangle with the given number of rows.

triangle(0) → 0
triangle(1) → 1
triangle(2) → 3

i have not understood above description.
what is row and what is block and how they are related to triange and what we have to return
Can you please advise
0
Hi,

I am going through below challenge.

http://codingbat.com/prob/p107330


I have not understood below description

Recursion-1 > bunnyEars2
prev  |  next  |  chance
We have bunnies standing in a line, numbered 1, 2, ... The odd bunnies (1, 3, ..) have the normal 2 ears. The even bunnies (2, 4, ..) we'll say have 3 ears, because they each have a raised foot. Recursively return the number of "ears" in the bunny line 1, 2, ... n (without loops or multiplication).

bunnyEars2(0) → 0
bunnyEars2(1) → 2
bunnyEars2(2) → 5
So even bunnies has 2 ears and odd ones have 3 ears and we have to return total ears?
please advise
0
Hi,

I am working on below challenge
http://codingbat.com/prob/p120015

Psedo code:
1. if first two numbers return same
2. else call same fibonacci method by passing n-1 and n-2 and sum it up

public int fibonacci(int n) {
  
   if ((n == 0) || (n == 1)) // base cases
      return n;
    else
      // recursion step
      return fibonacci(n - 1) + fibonacci(n - 2);
  

}

Open in new window




I am passing all tests
Expected      Run            
fibonacci(0) → 0      0      OK      
fibonacci(1) → 1      1      OK      
fibonacci(2) → 1      1      OK      
fibonacci(3) → 2      2      OK      
fibonacci(4) → 3      3      OK      
fibonacci(5) → 5      5      OK      
fibonacci(6) → 8      8      OK      
fibonacci(7) → 13      13      OK      
other tests
OK      

How to improve/modify my design, code and any other alternate approaches. please advise
0
Hi,

I am working on below challenge
http://codingbat.com/prob/p183649


We have a number of bunnies and each bunny has two big floppy ears. We want to compute the total number of ears across all the bunnies recursively (without loops or multiplication).

bunnyEars(0) → 0
bunnyEars(1) → 2
bunnyEars(2) → 4
I am not clear on above desription. what it mean by computing recursively?
 please advise
0
factorial



Hi,

I am working on below challenge
http://codingbat.com/prob/p154669

Psedo code:
1. return the n multiplied by same method call with n-1
I wrote my code as below

public int factorial(int n) {
  return n * factorial(n-1);
}

Open in new window




I am failing below tests

Expected      Run            
factorial(1) → 1      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(2) → 2      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(3) → 6      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(4) → 24      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(5) → 120      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(6) → 720      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(7) → 5040      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(8) → 40320      Exception:java.lang.StackOverflowError (line number:2)      X      
factorial(12) → 479001600      Exception:java.lang.StackOverflowError (line number:2)      X      
other tests
X      

How to improve/modify my design, code and any other alternate approaches. please advise
0
I have an online game I will charge $9.99 for an unlimited license. I have a WordPress site that uses WooCommerce as the store front.

It's easy for me to add a new product to my list of products, and to embed the online game into WordPress. How do I authenticate the user before enabling them to play the game?

If they pass a URL to a friend, that URL NEEDS to fail. It they pass their username and password to a friend, then play, I WOULD LIKE that also to fail.

Suggestions?

Thanks
0
Hi,

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html
package com.solution;

class ContinueDemo {
    public static void main(String[] args) {

        String searchMe = "peter piper picked a " + "peck of pickled peppers";
        int max = searchMe.length();
        int numPs = 0;

        for (int i = 0; i < max; i++) {
            // interested only in p's
            if (searchMe.charAt(i) != 'p')
                continue;

            // process p's
            numPs++;
        }
        System.out.println("Found " + numPs + " p's in the string.");
    }
}

Open in new window

Found 9 p's in the string.

How below printed 35 when i comment continue where as above printed 9
package com.solution;

class ContinueDemo {
    public static void main(String[] args) {

        String searchMe = "peter piper picked a " + "peck of pickled peppers";
        int max = searchMe.length();
        int numPs = 0;

        for (int i = 0; i < max; i++) {
            // interested only in p's
            if (searchMe.charAt(i) != 'p')
               // continue;

            // process p's
            numPs++;
        }
        System.out.println("Found " + numPs + " p's in the string.");
    }
}

Open in new window


Found 35 p's in the string.

peter piper picked a " + "peck of pickled peppers

when i counted above it has 49 characters including spaces though

please advise
0
Hi, my question isn't strictly a technical one, but rather a design theory based question. -- Putting aside all the different technologies offered by the many game development engines of today, game design basically boils down to - storytelling. If you can capture the players attention and immerse them into your game, you accomplished a - huge - part of making your game successful. If you can capture their emotions, you've done something that many game developers only dream about doing.

I've been doing a lot of research into the storyline aspect of game development and find a tremendous lack of good resources on such an important subject. I'm not looking for game story topic ideas, but rather material discussing the theory behind developing a good storyline. In other words, how does one go about determining how many side quests your game is going to have? What are the purpose of those quests and how do they affect the game's main storyline?  How to you plan out the puzzles in the game? Where do you place your puzzles to make them more effective and relevant to your story?

Clearly, much of this comes with years and years of experience, but in today's world where there is a "How To" video or article on just about any topic imaginable, I find there to be a lack of resources in this very important topic.

Does anyone here have any good resources (articles, video tutorials, books or white papers) on this subject? Or, can you offer some good advice …
0
Hi,

I am working one below challenge



 copyEndy
prev  |  next  |  chance
We'll say that a positive int n is "endy" if it is in the range 0..10 or 90..100 (inclusive). Given an array of positive ints, return a new array of length "count" containing the first endy numbers from the original array. Decompose out a separate isEndy(int n) method to test if a number is endy. The original array will contain at least "count" endy numbers.

copyEndy([9, 11, 90, 22, 6], 2) → [9, 90]
copyEndy([9, 11, 90, 22, 6], 3) → [9, 90, 6]
copyEndy([12, 1, 1, 13, 0, 20], 2) → [1, 1]

i am not clear what above description is talking about. How

copyEndy([9, 11, 90, 22, 6], 2) → [9, 90]
copyEndy([9, 11, 90, 22, 6], 3) → [9, 90, 6]
copyEndy([12, 1, 1, 13, 0, 20], 2) → [1, 1]
please advise
0
I am working on below challenge
http://codingbat.com/prob/p134174

Psedo code:
0. create new array of given count
1. for given arry loop through it
2. check if each element is even or not
3. if even fill till the new array ends
4. return new array
I wrote my code as below

public int[] copyEvens(int[] nums, int count) {
  int[] arr=new int[count];
  for(int i=0;i<nums.length-1;i++){
    if(nums[i]%2==0){
      arr[i]=nums[i];
      
      
    }
  }
  return arr;
}

Open in new window






I am not passing all tests
xpected      Run            
copyEvens([3, 2, 4, 5, 8], 2) → [2, 4]      Exception:java.lang.ArrayIndexOutOfBoundsException: 2 (line number:5)      X      
copyEvens([3, 2, 4, 5, 8], 3) → [2, 4, 8]      [0, 2, 4]      X      
copyEvens([6, 1, 2, 4, 5, 8], 3) → [6, 2, 4]      Exception:java.lang.ArrayIndexOutOfBoundsException: 3 (line number:5)      X      
copyEvens([6, 1, 2, 4, 5, 8], 4) → [6, 2, 4, 8]      [6, 0, 2, 4]      X      
copyEvens([3, 1, 4, 1, 5], 1) → [4]      Exception:java.lang.ArrayIndexOutOfBoundsException: 2 (line number:5)      X      
copyEvens([2], 1) → [2]      [0]      X      
copyEvens([6, 2, 4, 8], 2) → [6, 2]      Exception:java.lang.ArrayIndexOutOfBoundsException: 2 (line number:5)      X      
copyEvens([6, 2, 4, 8], 3) → [6, 2, 4]      [6, 2, 4]      OK      
copyEvens([6, 2, 4, 8], 4) → [6, 2, 4, 8]      [6, 2, 4, 0]      X      
copyEvens([1, 8, 4], 1) → [8]      Exception:java.lang.ArrayIndexOutOfBoundsException: 1 (line number:5)      X      
copyEvens([1, 8, 4], 2) → [8, 4]      [0, 8]      X      
copyEvens([2, 8, 4], 2) → [2, 8]      [2, 8]      OK      
other tests
X      
Your progress graph for this problem

How to improve/modify my design, code and any other alternate approaches. please advise
0
Hi,

I am working on below challeng



I have not undersood the description.



We'll say that a positive int divides itself if every digit in the number divides into the number evenly. So for example 128 divides itself since 1, 2, and 8 all divide into 128 evenly. We'll say that 0 does not divide into anything evenly, so no number with a 0 digit divides itself. Note: use % to get the rightmost digit, and / to discard the rightmost digit.

dividesSelf(128) → true
dividesSelf(12) → true
dividesSelf(120) → false

why if 0 then doe not devide and false?

please advise
0
Hi,

I am working on below challenge
http://codingbat.com/prob/p191212

Psedo code:
1. for given number % with 10
2. if 1 return true
3. else return false

I wrote my code as below

public boolean hasOne(int n) {
  if(n%10==1){
  
 // if(n/10==1){
  return true;
 // }
  }
  return false;
  
}

Open in new window




I am not passing all tests
Expected      Run            
hasOne(10) → true      false      X      
hasOne(22) → false      false      OK      
hasOne(220) → false      false      OK      
hasOne(212) → true      false      X      
hasOne(1) → true      true      OK      
hasOne(9) → false      false      OK      
hasOne(211112) → true      false      X      
hasOne(121121) → true      true      OK      
hasOne(222222) → false      false      OK      
hasOne(56156) → true      false      X      
hasOne(56556) → false      false      OK      
other tests
X      

How to improve/modify my design, code and any other alternate approaches. please advise
0
I have three playing cards, each with there orientations, I want to put into a single PDF. And I need to know if this is possible.

Card 1: Front of card
Card 1: Back of card, upside down
Card 1: Back of card, right side up

Card 2: Front of card
Card 2: Back of card, upside down
Card 2: Back of card, right side up

Card 3: Front of card
Card 3: Back of card, upside down
Card 3: Back of card, right side up

I would love for the user to need to click a button (or some other thing) to go to the next image. This is a flash card game, so I do not want to show too much too soon.

On the back, the two orientation of the card involve the hint and the answer. I do them as opposite to you can read the hint and not accidentally read the answer.

Does PDF support this? If not, what other things can I do to have a portable document that is 100% platform independent?

Thanks.
0
So i am making a game in visual c#...the first stage is looking through the photos that are shown in a picturebox. I have written this code so far:

namespace FaceNameGame
{
    public partial class LevelOnePartOne : Form
    {
       
        int m , piccount=0, k;
        Random rd = new Random();
        public string[] picturenames= new string[4];
        public string[] links = new string[3];
        string sourcePath = @"C:\Users\Marina\Desktop\FaceNameGame\images";
        string targetPath = @"C:\Users\Marina\Desktop\FaceNameGame\images\used";
        bool directoryexists = false;
        string[] files = Directory.GetFiles(@"C:\Users\Marina\Desktop\FaceNameGame\images\", "*.jpg", SearchOption.AllDirectories);

        public LevelOnePartOne()
        {
            InitializeComponent();
        }



        private void LevelOnePartOne_Load(object sender, EventArgs e)
        {


            ProceedBtn.Hide();
           
            PreviousBtn.Hide();

           
           

            if (!System.IO.Directory.Exists(targetPath))
            {
                System.IO.Directory.CreateDirectory(targetPath);
                directoryexists = true;

            }

            Random rand = new Random();
            string[] files = Directory.GetFiles(@"C:\Users\Marina\Desktop\FaceNameGame\images\", "*.jpg", SearchOption.AllDirectories);


             for (m = 0; m < 3; m++)
            {

               Loop:
   …
0
I tried a laptop yesterday in the store, and I intend to use this laptop only for streaming online video. This was the first laptop that worked on a specific video site (I've tried several others, but so far only this laptop has worked, and it worked excellent; it is a gaming laptop with 16 GB RAM and SSD etc.).

I am thinking of ordering this model with even higher specs than the model I tried had. But I am hesitating regarding whether to have a version with Ultra HD 4K (for super sharp videos) or 1080p/Full HD. It's not that important to get super sharp videos, much more important is no interruptions during playback, which is approximately 2-3 minutes for each video. The model I tried in the store had 1080p/Full HD, and there were almost no interruptions at all.

Furthermore, the model I tried in the store had Thunderbolt 3 (8x faster), and 15.6" Full HD screen (1920 x 1080). I'm not sure this higher specs model (17") has Thunderbolt 3; would that make streaming videos less effective with more interruptions if it lacks Thunderbolt 3?

I think the frame rate will be much lower for Ultra HD 4K compared to 1080p/Full HD. Wouldn't that make streaming of online videos going slower for Ultra HD 4K compared to 1080p/Full HD? This website with online videos (the videos can't be downloaded, they are constantly buffered from the website) has receveived numerous complaints about interruptions during playback of the videos (the playbacked video interrupts in the middle of the …
0
Hi,

I am working on below challenge

http://codingbat.com/prob/p123837
I wrote my code as below
public int scoresAverage(int[] scores) {
  int result=0;
  int len=scores.length;
  int lenHalf=len/2;
  int sumEven=0;
    int sumOdd=0;
for(int i=0;i<lenHalf;i++){
    sumEven=(scores[i]+scores[i+1])/2;
    //result=sumeEven;
    //return result;
  }
  
  for(int i=lenHalf;i<len;i++){
    sumOdd=(scores[i]+scores[i+1])/2;
   // result=sumeOdd;
    //return result;
  }
  if(sumOdd>sumEven){
    return sumOdd;
  }
  else{
    return sumEven;
  }


}
return result;
  

}

}

Open in new window





I am not passing all tests with below error

Compile problems:


Error:      }
      ^
Syntax error on token "}", { expected after this token


How to improve my design, approach, code? please advise
0
Hi,

I am going through below challenge.
http://codingbat.com/prob/p194530
Expected      Run            
scoresClump([3, 4, 5]) → true      false      X      
scoresClump([3, 4, 6]) → false      false      OK      
scoresClump([1, 3, 5, 5]) → true      false      X      
scoresClump([2, 4, 5, 6]) → true      false      X      
scoresClump([2, 4, 5, 7]) → false      false      OK      
scoresClump([2, 4, 4, 7]) → true      false      X      
scoresClump([3, 3, 6, 7, 9]) → false      false      OK      
scoresClump([3, 3, 7, 7, 9]) → true      false      X      
scoresClump([4, 5, 8]) → false      false      OK      
other tests
X      
Your progress graph for this problem

i wonder how below is false?
scoresClump([3, 4, 6]) → false
i expected above true as difference is atmost 2?  please advise
0
Hi,

I am working on below challenge

http://codingbat.com/prob/p179487

Pseudo Code:
1. loop through given array
2. find elemt a i position and i+1 position.
3. check their equality.
4. if equal return true
5. if not equal reurn false

I wrote my code as below
public boolean scores100(int[] scores) {
  
  boolean result=true;
  int len=scores.length;
for(int i=0;i<len-1;i++){
  if(scores[i]!=100&&scores[i+1]!=100){
   // i=i+1;
    result=false;
    
    return result;
  }
}
return result;
  

}

Open in new window



Expected      Run            
scores100([1, 100, 100]) → true      true      OK      
scores100([1, 100, 99, 100]) → false      true      X      
scores100([100, 1, 100, 100]) → true      true      OK      
scores100([100, 1, 100, 1]) → false      true      X      
scores100([1, 2, 3, 4, 5]) → false      false      OK      
scores100([1, 2, 100, 4, 5]) → false      false      OK      
other tests
OK      

I am not passing all tests

How to improve my psedo code, approach, code? please advise
0
Hi
I did a run at stock trading a few years ago, and I'm interested now in SPDR investing.
In stocks, it's EPS earnings per share.
I couldn't see how to evaluate a fund's earnings, exactly. Is it monthly, quarterly, or yearly periods? What is my earnings multiple?
How can I research decent funds to buy? How much to spend? I have nearly $100k
Is tech set to have a decent run? How is Google car coming along?
Was apple watch a flop? Its successor a good adjustment?
Jim Cramer ran a hedge fund. Is that similar to a SPDR?
Thanks
0
I have a question regarding performance and how game engines handle mesh objects. – For the purpose of this question, let’s assume we have a wall asset within a game. If we make our wall 10 feet tall and 100 feet long, we have a rectangle, which can be made up of two large triangles.

So, our first example is a wall that is 10 feet tall X 100 feet long and is made up of 2 triangles.

Let’s now assume we broke up that same wall into smaller 10 foot sections (i.e. 10 feet tall X 10 feet long each).

So, in our second example we have our 100 foot long wall made up of 10 individual sections, which are each 10' x 10' made up or 2 triangles each, so our 100 foot wall now contains 20 triangles.

In recap:
Example 1 = A wall, 10 feet tall X 100 feet long and is made up of 2 triangles.

Example 2 = A wall made up of 10 sections, each at 10 feet tall x10 feet long and each section is made up or 2 triangles, so our wall has a total of 20 triangles.

My question is which of these designs approaches to our wall is more memory intensive for the game engine to deliver to the scene?

Is it more expensive (in terms of memory resources) to draw 2 very large triangles. Or, is it more expensive to draw 20 much smaller triangles?

Or are they equivalent…after all, we’re producing the same asset which is 10 feet tall and 100 feet long? The only difference is that in one instance we're drawing 2 huge triangles and in the other we're drawing 20 much …
0

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
<
Monthly
>