Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


moneal2001

Member Since 02 Dec 2011
Offline Last Active May 04 2015 06:22 PM

Topics I've Started

Business Sim Game How to simulate the Market

01 May 2015 - 09:24 AM

I am working on the design of a Game development tycoon style game, and trying to figure out how to effectively simulate consumers.  The player will be competing against, and cooperating with AI controlled companies for the sale of consoles, games, and game engines.  I want the market to flow similarly to the real market.  An example of this is Halo for xbox, it kinda started the boom of FPS games becoming mainstream.  Another example was Final Fantasy VII for RPGs. 

 

My current Idea is creating consumer  objects to represent a smaller part of the market.  Each consumer would have a tech and value score for deciding which consoles to buy.  It would also have a budget for each month to purchase software, and have a list of liked genres, and minimum game score.  if the player or AI release a game and its above the game score and in one of the liked genres list the consumer will buy the game, if they still have room in their game budget.  Multiple games with a really high game scores in the same genre being made in the same year or two can influence the liked genre list for consumers.

 

The market as a whole will trend from great, consumer growth at 80 to 100% all the way to bad consumer decline at 5 to 10%.  I was thinking that each consumer object would represent 1000 actual consumers, with some randomization so all sales numbers aren't exactly 1000.  My problem is the size of the consumer base.  I mean its probably not too bad when the game begins and there are only 1 or so million and I need 1000 consumers objects.  When the market grows to something like it is today with 300 million or more consumers. 

 

My current Idea to deal with market growth would be to boost the number of actual consumers each consumer object represents when the actual base reaches certain milestones.   At 10 million actual customers the objects would then represent 10000 customers, and at 20 million objects would represent 20000 customers. This would keep the max consumer object number at 1000.

 

Does anyone else have any ideas for representing the consumer market in a semi realistic way?


Pong Collision Question [XNA]

14 April 2013 - 01:44 AM

I am working on collision for a pong clone i am working on.  I set up a rectangle for the ball and the paddles and when those intersect, I want to invert the X or Y direction the ball is moving based on the area of the ball that collides with the paddle.

 

Examples.  bottom of ball hits the top of the paddle invert the Y direction of motion, or right side of ball hits the left side of paddle invert X direction of motion.

 

So after the collision call happens I created 4 rectangles representing the ball 1 for each 4th of the ball: top left, top right, bottom left, and bottom right.  and set up if statements to check for intersection between those and the paddle rectangle.

 

here is the collision code i have

 

        private void checkPaddleCollision(List<Paddle> paddles)
        {
            CollisionType type = CollisionType.Left;
            bool collide = false;
            Paddle paddle = new Paddle();
            
                       

            foreach (Paddle p in paddles)
            {
                

                if(rect.Intersects(p.Bounds))
                {

                    paddle = p;

                    collide = true;

                    Rectangle topLeft, topRight, bottomLeft, bottomRight;
                    int height = rect.Height / 2;
                    int width = rect.Width / 2;

                    topLeft = new Rectangle(rect.X, rect.Y, width, height);
                    topRight = new Rectangle(rect.X + width, rect.Y, width, height);
                    bottomLeft = new Rectangle(rect.X, rect.Y + height, width, height);
                    bottomRight = new Rectangle(rect.X + width, rect.Y + height, width, height);

                    if((p.Bounds.Intersects(topLeft) || p.Bounds.Intersects(topRight)) &&(!p.Bounds.Intersects(bottomLeft) || !p.Bounds.Intersects(bottomRight)))
                    {
                        type = CollisionType.Top;
                    }
                    else if ((p.Bounds.Intersects(bottomLeft) || p.Bounds.Intersects(bottomRight)) && (!p.Bounds.Intersects(topLeft) || !p.Bounds.Intersects(topRight)))
                    {
                        type = CollisionType.Bottom;
                    }
                    else if ((p.Bounds.Intersects(bottomLeft) || p.Bounds.Intersects(topLeft)) && (!p.Bounds.Intersects(topRight) || !p.Bounds.Intersects(bottomRight)))
                    {
                        type = CollisionType.Left;
                    }
                    else if ((p.Bounds.Intersects(bottomRight) || p.Bounds.Intersects(topRight)) && (!p.Bounds.Intersects(topLeft) || !p.Bounds.Intersects(bottomLeft)))
                    {
                        type = CollisionType.Right;
                    }
                                    
                }
            }

            if (collide)
            {
                switch (type)
                {
                    case CollisionType.Left:
                        position.X = paddle.Position.X + paddle.Bounds.Width;
                        break;
                    case CollisionType.Right:
                        position.X = paddle.Position.X - texture.Width;
                        break;
                    case CollisionType.Bottom:
                        position.Y = paddle.Position.Y + texture.Height;
                        break;
                    case CollisionType.Top:
                        position.Y = paddle.Position.Y + paddle.Bounds.Height;
                        break;
                }

                if (type == CollisionType.Left || type == CollisionType.Right)
                {
                    direction.X *= -1;
                    direction.Normalize();
                }
                else
                {
                    direction.Y *= -1;
                    direction.Normalize();
                }
            }
        }

The collision works fine when the ball hits the top or bottom of a paddle but it is not regestering correctly when it hits the left or right of a paddle.  It sees it as either top or bottom until the ball is halfway through the paddle then it regesters.  can anyone point me in the right direction.  Thanks.


help developing better coding

22 February 2012 - 12:39 PM

if anyone could be kind enough to download my number guessing game source code and give me some feedback on how to improve the structure and general coding. it can be downloaded here: http://www.mediafire.../?4zlc9wipcsdp1 I can post the code here if no one wants to download it. any help would be greatly appreciated.


edit:

here is my main code

#include "stdafx.h"
using namespace std;
string anWords[] = { "town", "house", "slant", "light", "orange", "time", "workout", "jumprope", "baby", "eraser"};
string word = "";
int misses = 6;
char playAgain = 'y';
int win = 0;

int _tmain(int argc, _TCHAR* argv[])
{
srand(time(0));

while (playAgain != 'n')
{ word = anWords[nrand(0, 9)];
  StartGame(word);
  while (win != 1 && win != 2)
   win = PlayGame(word, misses);
  GameOver(win, word);
  win = 0;
  playAgain = PlayAgain(playAgain);

}

return 0;
}

this is my function code, was mostly doing this to see if i knew how to use multiple code files and headers:

#include "stdafx.h"
using namespace std;
void StartGame(string word)
{
int s = word.length();
cout << "I have a word in my head. It is " << s << " letters long can you gess it.?" << endl;
}
char PlayAgain(char playAgain)
{

cout << "Play again? y or n " << endl;
cin >> playAgain;
while (playAgain != 'y' && playAgain != 'n')
{
  cout << "Choice was not entered correctly please enter y or n again? ";
  cin >> playAgain;
}

return playAgain;
}
int PlayGame(string word, int m )
{
int win = 0;
char guess;
int wordSize = word.length();
string guesses;
string playerWord;
for (int i = 0; i < wordSize; ++i)
{
  playerWord += "_";
}
string tempWord = playerWord;
cout << playerWord << endl;
while (win != 1 && win != 2)
{
  cout << "You have " << m << " guesses left." << endl;
  cout << "Please guess a letter. " << endl;
  cin >> guess;
  unsigned int x;
  for( x = 0; x < guesses.length(); ++x)
  {
   if (guess == guesses[x])
   {
	cout << "You have already guessed that letter." << endl;
	cin >> guess;
	break;
   }
  }
  int i;
  for (i = 0; i < wordSize; ++i)
  {
   if (guess == word[i])
	playerWord[i] = guess;
  }
  if (playerWord == tempWord)
  {
   --m;
   tempWord = playerWord;
  }
  else
   tempWord = playerWord;
	  
  guesses += guess;
  if (playerWord == word)
   return 1;
  else if (m == 0)
   return 2;
  else
  {
   cout << playerWord << endl;
   cout << "You have guessed these letters so far: " << guesses << endl;
  }

}
return 0;
}
void GameOver(int win, string word)
{
if (win == 1)
{
  cout << "You won way to go." << endl;
  cout << "You were right.  The word was " << word << "." << endl;
}
else
{

   cout << "Sorry you lost." << endl;
   cout << "The word was " << word << "." << endl;
}
}

PARTNERS