Jump to content

  • Log In with Google      Sign In   
  • Create Account

kaktusas2598

Member Since 25 Mar 2010
Offline Last Active Yesterday, 10:02 PM

#5155654 Setting up OpenGL with Code::Blocks

Posted by kaktusas2598 on 24 May 2014 - 08:25 AM

http://www.codeincodeblock.com/2013/05/setup-modern-opengl-3-and-4-with-glfw.html - try this one.




#5153262 tips for beggining to make video games? have programming knowlege

Posted by kaktusas2598 on 13 May 2014 - 03:02 AM

I recommend you trying to ocmbine C++ with SDL. Try these tutorials - http://lazyfoo.net/tutorials/SDL/index.php




#5143425 Linux development...

Posted by kaktusas2598 on 31 March 2014 - 03:17 AM

I still recommend you to give QT Creator another chance, it is really powerdul IDE, you could also use Code::Blocks as DareDeveloper have mentioned. Personally, I use vim for source editing, gcc and g++ for compiling and wrap all building process with makefiles - this works perfectly for me with SDL2 and OpenGL.

 

If you want to do cross-platform development, you could try CMake(which also works with QT Creator).




#5136718 Is learning 3D modelling for programmer is TIme Waste?

Posted by kaktusas2598 on 06 March 2014 - 02:07 AM

Frob, I agree with u, but I do not consider myself a beginner programmer, because I have been programming since 14 (7 years now), and I am fearly comfortable with C++, Python, Java, Javascript, HTML and CSS, SQL, Matlab, a little less with C#. Thank you for advices, I will keep in mind that :)




#5136557 Is learning 3D modelling for programmer is TIme Waste?

Posted by kaktusas2598 on 05 March 2014 - 11:33 AM

 


I dont want unity because it's not C++ based.

 

God I want to smash my head off a wall everytime I read something like this.

 

Why? :) I am comfortable with C++ and want to use tools what are oriented with it, is it bad?




#5136410 Is learning 3D modelling for programmer is TIme Waste?

Posted by kaktusas2598 on 04 March 2014 - 05:54 PM

Yes, I could use SDl for Windowing and Input, OpenGL for Graphics and Blender for models :) I dont want unity because it's not C++ based.




#5136395 Is learning 3D modelling for programmer is TIme Waste?

Posted by kaktusas2598 on 04 March 2014 - 04:36 PM

Thanks, for responses :) That would u recommend me to learn after blender for creating full 3D game? I was thinking either jump to OpenGL and hard-code everything, or first try to use engine such as Ogre, learn engine principles and after that dive inti OpenGL... Which option would be better? I eventually plan to start learning OpenGL in max one year period.




#5136028 Is learning 3D modelling for programmer is TIme Waste?

Posted by kaktusas2598 on 03 March 2014 - 02:20 AM

Thank you all for responses, I really aprreciate then. Now I think having free time after uni (studying Computer Engineering) I will pick some Blender tutorials at official Blender site (http://www.blender.org/support/tutorials/) and after that I will try to combine these skills with some engine or straight away with OpenGL. Can u guys recommend me some good C++ game engine? I was thinking about Unity 3D(I know it is not C++).




#5114329 SDL 2.0 setup un Ubuntu

Posted by kaktusas2598 on 04 December 2013 - 09:11 AM

I'm sorry about disturbing your time, I already have  solution. I used Synaptic pachage manager to install SDL2 packages and compiled g++ with parameters -lSDL2 -L /path/to/libs -I /path/includes ;)




#5063672 random numbers

Posted by kaktusas2598 on 21 May 2013 - 07:09 PM

use not Num_Array.push_back(i); but something like Num_Array.push_back(rand());




#5062266 Good articles on Entity Components Systems

Posted by kaktusas2598 on 16 May 2013 - 06:59 AM

This is quite good:
http://piemaster.net/2011/07/entity-component-primer/




#5059155 What should I do next

Posted by kaktusas2598 on 04 May 2013 - 08:19 AM

Why not make simple platformer with level editor? Like Mario or Megaman...




#5051977 I Want Game Programming

Posted by kaktusas2598 on 10 April 2013 - 06:32 PM

Both Python and C# are great starting choises. I'm more familiar with C# and I think it has greater support to windows, but you can really choose what you like. If you go with C#, you can later(after learning language), try XNA game development API, and if you chose python, you can later try pygame(also game development library) as well. Start small, build some simple text games in console, and then you can advance with something in graphical interface. Good luck! :)




#5050697 C++ console games tutorials and thread pointers please

Posted by kaktusas2598 on 06 April 2013 - 05:07 PM

If you want to create dynamic game in console, minding, that you are using Windows, I recommend you to dig into windows.h header on MSDN. There are functions in it for handling cursor position, console color and etc.

 

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx




#5047223 Problems with vector.push_back()

Posted by kaktusas2598 on 27 March 2013 - 08:02 AM

Hello everybody, Yesterday I started to program Black Jack game in console and I have problems with vectpr.push_back(), I use it to add cards from deck to players hand, for what I use CPlayer::PDraw(CDeck d) function, here it is:

void PDraw( CDeck d)
	{	
		cards.push_back(d.getDeck()[cardCounter]);//error, deck deletes somehow after doing one command
		cardCounter++;
	}

The problem is, when I use puch back(), my deck what I pass into function somehow is changed and becomes empty, I think it has to do something with my Copy and Assignment constructors of CDeck class, here is my CDeck class:

//Class representing Deck of Cards
class CDeck
{
public:
	CDeck(){
		pDeck= new SCard[CARD_NUMBER];
		for(int i = 0; i < CARD_NUMBER; i ++)
		{
			//Assign ID to card and its suit and value
			pDeck[i].id = i;
			identifyCard(&pDeck[i]);			
		}
	}
	~CDeck(){
		delete[] pDeck;
	}
	CDeck(const CDeck &d) { operator=(d); }//error here?
	const CDeck &operator=(const CDeck &d) {//still mistake
		for(int i = 0; i < CARD_NUMBER; i++)
		{
			pDeck[i].id = d.pDeck[i].id;
			pDeck[i].type = d.pDeck[i].type;
			pDeck[i].num = d.pDeck[i].num;
			pDeck[i].val = d.pDeck[i].val;
		}
    return d;
	}
	void shuffleDeck()
	{
		//Shuffles Deck, but maybe more suitable with vector and rand()
		std::random_shuffle(pDeck, pDeck + 52);		
	}
	void identifyCard(SCard* c)
	{
		c->type = suits[c->id/13];
		c->val = value[c->id%13];
		c->num = nums[c->id%13];
	}

	SCard* getDeck(){return pDeck;}
private:
	SCard* pDeck;
};

Here is SCard structure:

//Structure representing one card
typedef struct
{
	//Card ID convertible to its value and suit
	int id;
	//Card Value from Sce to King
	string val;
	//Card suit, Hearts etc.
	string type;
	//Cars numerical value with ace being 11 
	int num;
}SCard;

ANd lastly, my CPlayer class:
 

//Class representing main Player
class CPlayer
{
public:
	CPlayer()
	{
		bet = 0;
		balance = START_MONEY;
		counter = 0;
		//party begins
		isPlaying = true;
		//first move is banks
		isActive = false;
	}
	//Player actions funcs
	void PStay()
	{
		isActive = false;
	}
	void PDraw( CDeck d)
	{	
		cards.push_back(d.getDeck()[cardCounter]);//error, deck deletes somehow after doing one command
		cardCounter++;
	}
	void PDouble(CDeck d)
	{
		PDraw(d);
		bet*=2;
	}
	void PMove(CDeck d)
	{
		int choise;
		cout << "Choose move what you like: \n1.Stay.\n2.Draw\n3.Double.\n";
		cin >> choise;
		if(choise == 1) PStay();
		if(choise == 2) PDraw(d);
		if(choise == 3) PDouble(d);
	}
	void PInfo()
	{
		cout << "Balance: " << balance << endl;
		cout << "Bet: " << bet << endl;
		cout << "Cards in your hand:" << endl;
		vector<SCard>::iterator iter;
		for(iter = cards.begin(); iter != cards.end(); ++iter)
		{
			cout << (*iter).val << " of " << (*iter).type << endl;
		}
		cout << "Value: " << PSum() << endl;; 
	}
	void PBet()
	{
		bool isBetMade = false;
		while(!isBetMade)
		{
			cout << "Enter the bet between 10 to "<< balance << ": ";
			cin >> bet;
			if(bet < 10 || bet > balance)
				cout << "\nYou can't bet this sum. Type Again\n";			
			else
				isBetMade = true;
		}
		balance -= bet;
	}
	int PSum()
	{
		int numOfAces = 0; //nuimber of aces in hand 
		vector<SCard>::iterator iter;
		for(iter = cards.begin(); iter != cards.end(); ++iter)
		{
			if((*iter).val == "Ace") numOfAces++;
			counter += (*iter).num;			
			
		}
		if(counter > BLACK_JACK)
		{
			for(iter = cards.begin(); iter != cards.end(); ++iter)
			{
				if((*iter).val == "Ace") 
				counter -= 10;// +1 and -11
				if(counter <= BLACK_JACK)
					break;
			
			}
		}
		return counter;
	}
	
	bool isPlaying;//player currently playing

	bool isActive; // is players move
private:
	int balance;
	int bet;
	//stores current points that player has
	int counter;	
	//stores current cards in hand
	vector<SCard> cards;
};

I regard every possible answer to this problem. When I run program and step to line where I push card into my vector representing cards in player hands it throws unhandled exception (Unhandled exception at 0x779615de in Black Jack.exe: 0xC0000005: Access violation writing location 0x76d833aa.). To be more precise it comes to constructor of CDeck and then breaks.






PARTNERS