Page 2 of 11

Re: My first game: A Zombie RPG

Posted: Sun Jun 13, 2010 12:09 am
by EdBoon
eatcomics wrote:Dude this looks great! I absolutely can't wait to see more :D Keep up the awesomeness

*sub'd

BTW I FUCKING LOVE THE OFFSPRING!!!
carry on
are you watching the right videos?? lol

anyway what i meant by i hear the girls of atlanta calling me actually meant a morning of uncertainty and solitude haha. blackouts, worthless!!!

XianForce wrote:So your using pixel perfect collisions? I'm curious as to how good that is, in terms of effective vs efficient. I know it works well, but I would imagine that as you add more and more elements to check again, it will very quickly become unrealistic as a collision system.

But then again, I've never extensively used pixel-perfect, so let me know how it works out =D!
hmm not familiar with that, i just wrote it myself quick ... actually its pretty ugly.... But I agree, I can see that it will quickly be VERY inefficient once there is more than 2 retarded looking zombies in the mix

Code: Select all

int iLikeToHaveCollision( BITMAP* bmp1 , BITMAP* bmp2 , Player & rOne, Enemy & rEnemy, int w1, int h1, int w2, int h2)
{
	
	//check to see if they are even close enough to intersect
	if ( rOne.GetItsX() > rEnemy.GetHisX() - w1 && rOne.GetItsX() - w2 < rEnemy.GetHisX() 
		&& rOne.GetItsY() > rEnemy.GetHisY() -h1 && rOne.GetItsY() - h2 < rEnemy.GetHisY())
	{
	// take difference in locations to make origin 0,0 for reference
	int xOffset = 0;
	int yOffset = 0;
	if (rOne.GetItsX() > rEnemy.GetHisX())
		xOffset = rOne.GetItsX() - rEnemy.GetHisX();
	else
		xOffset = -rOne.GetItsX() + rEnemy.GetHisX();
	if(rOne.GetItsY() > rEnemy.GetHisY())
		yOffset = rOne.GetItsY() - rEnemy.GetHisY();
	else
		yOffset = -rOne.GetItsY() + rEnemy.GetHisY();


	int **bmp1Array;
	int **bmp2Array;
	
	bmp1Array = new int*[w1];
	bmp2Array = new int*[w2];
	
	for (int i = 0; i < h1; ++i)
		bmp1Array[i] = new int[h1];
	for (int i = 0; i < h2; ++i)
		bmp2Array[i] = new int[h2];


	 // De-Allocate memory to prevent memory leak



	for(int j = 0 ; j < h1; j++)
	{
		for(int i = 0 ; i < w1; i++)
		{
			if (getr(getpixel(bmp1,i,j)) != 255 && 
			getg(getpixel(bmp1,i,j)) != 0 && 
			getb(getpixel(bmp1,i,j)) != 255)
			{
				bmp1Array[i][j] = 1;
			}
			else
				bmp1Array[i][j] = 0;
		}

	}
	for(int j = 0 ; j < h2; j++)
	{
		for(int i = 0 ; i < w2; i++)
		{
			if (getr(getpixel(bmp2,i,j)) != 255 && 
			getg(getpixel(bmp2,i,j)) != 0 && 
			getb(getpixel(bmp2,i,j)) != 255)
			{
				bmp2Array[i][j] = 1;
			}
			else
				bmp2Array[i][j] = 0;
		}

	}

	for(int j = 0 ; j < h1; j++)
	{
		for(int i = 0 ; i < w1; i++)
		{
			if (bmp1Array[i][j])
			{
				if( i <= w1 - xOffset && j <= h1 - yOffset && bmp2Array[i + xOffset-1][j + yOffset-1])
				{
					
					// De-Allocate memory to prevent memory leak
					for (int i = 0; i < h1; ++i)
						delete [] bmp1Array[i];

					delete [] bmp1Array;

					for (int i = 0; i < h2; ++i)
						delete [] bmp2Array[i];

					delete [] bmp2Array;
					return 1;
				
				}

			}
				
	
		}
	}
	for(int j = 0 ; j < h2; j++)
	{
		for(int i = 0 ; i < w2; i++)
		{
			if (bmp1Array[i][j])
			{
				if( i <= w2 - xOffset && j <= h2 - yOffset && bmp2Array[i + xOffset-1][j + yOffset-1])
				{
					
					// De-Allocate memory to prevent memory leak
					for (int i = 0; i < h1; ++i)
						delete [] bmp1Array[i];

					delete [] bmp1Array;

					for (int i = 0; i < h2; ++i)
						delete [] bmp2Array[i];

					delete [] bmp2Array;
					return 1;
				
				}

			}
				
	
		}
	}
	// De-Allocate memory to prevent memory leak
	for (int i = 0; i < h1; ++i)
		delete [] bmp1Array[i];
	delete [] bmp1Array;
	for (int i = 0; i < h2; ++i)
		delete [] bmp2Array[i];
	delete [] bmp2Array;
	}
	return 0;


}
//wait, delete how many times?

im actually kind of excited about the story line i have going now,, ahhhhhh!!!! maybe that will jump to phase 1 and 2 ;)

Re: My first game: A Zombie RPG

Posted: Sun Jun 13, 2010 12:16 am
by EdBoon
oops on the double post

Re: My first game: A Zombie RPG

Posted: Sun Jun 13, 2010 5:30 am
by K-Bal
Argh, use code tags ;)

Re: My first game: A Zombie RPG

Posted: Sun Jun 13, 2010 10:25 am
by XianForce
Well, if you find pixel-perfect is too inefficient, the very first part of your code can act as collision detection, I think. It looks like a simple bounding box collision detection.

Re: My first game: A Zombie RPG

Posted: Sun Jun 13, 2010 3:06 pm
by eatcomics
EdBoon wrote: are you watching the right videos?? lol

anyway what i meant by i hear the girls of atlanta calling me actually meant a morning of uncertainty and solitude haha. blackouts, worthless!!!
Yeah... and uh I knew what you meant about the girls :D

Re: My first game: A Zombie RPG

Posted: Mon Jun 14, 2010 7:31 pm
by EdBoon
I was away most of the weekend so didn't get to do anything but I did a bit today after work. Just a little of the intro story line. At some point I will work on decent(for my ability) sprite sheets unless I find someone but for now i'm just throwing in images. Added a function to show dialog text on screen, will clean up cosmetics a little later.


The video is a bit hard to see unless in 720p.


<object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/m9IXUJNYupw&hl ... ram><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/m9IXUJNYupw&hl ... 6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object>[/youtube]

I'll probably throw up a video a week now, any suggestions let me know, thanks!

Re: My first game: A Zombie RPG

Posted: Mon Jun 14, 2010 8:26 pm
by short
lol creative day 6

Re: My first game: A Zombie RPG

Posted: Mon Jun 14, 2010 9:16 pm
by epicasian
hahahaha the short name of the virus was great!

Re: My first game: A Zombie RPG

Posted: Tue Jun 15, 2010 5:54 am
by K-Bal
Nice Update :lol:

Re: My first game: A Zombie RPG

Posted: Tue Jun 15, 2010 11:58 am
by Milch
Lol at the virus name :D
Looks good so far, sub'd.

Re: My first game: A Zombie RPG

Posted: Tue Jun 15, 2010 3:48 pm
by GroundUpEngine
Rofl, nice one :lol:

Re: My first game: A Zombie RPG

Posted: Wed Jun 16, 2010 7:44 pm
by eatcomics
"We call it JFAIL for short" LOL

Awesome update man :D

Re: My first game: A Zombie RPG

Posted: Thu Jun 17, 2010 9:42 pm
by EdBoon
I know I said only weekly videos now but I felt like sharing. I changed a little bit since the last video, I revised a lot of the functions to work better, like collision, distance, etc. I decided to use Mappy to make things easier. I'm not ready to write a tile program just yet :D I can't take credit for the character sprites either, it was out of a book (the CD of course) called Game Programming All In One(It's actually a decent book for Allegro) since I'm a rook at the game side of programming. You can tell I messed with some of the sprite frames until I remembered how terrible my artistic side is. I Am still working on the story line on paper, but want to get all the functions and everything working and not specific to the game so I can use the engine again. You can see he gets faster through the level, i increased his speed to test out how much it should increase per level gained or if you have to use your skill point to increase speed.

I am currently trying to figure out an algorithm to make the enemies move more like zombies. It's obvious I'm just using a seek function to follow the x and y coordinates of the player once I get into range of them, but it seems too easy to shoot them, they line up for you pretty much. Hmmm.... I'm sure i'll come up with something...

Also I'm messing around with another enemy similar to a licker from Resident Evil but more like the one from the movie, it will move sideways to you instead of directly towards you, crawling on walls, getting closer each time it 'dives' sideways. That will probably be this weekend.

More of the Jejunum virus coming soon!

The map will be different but it will hold the same style. Any ideas/suggestions/comments/criticism/etc... all very welcome :bow:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/_KRJanGqAk4&hl ... ram><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/_KRJanGqAk4&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>[/youtube]

Re: My first game: A Zombie RPG

Posted: Thu Jun 17, 2010 9:56 pm
by dandymcgee
That looks really good.

Re: My first game: A Zombie RPG

Posted: Fri Jun 18, 2010 11:51 pm
by EdBoon
another update...

so I got multiple enemies working and their seek and collision detection with the main character, collision with themselves is there, just not working completely right.. I also did some other stuff..

blah, tired, going to bed :P



<object width="873" height="525"><param name="movie" value="http://www.youtube.com/v/2UjT2XEo2dg&hl ... ram><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2UjT2XEo2dg&hl ... 6&border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="873" height="525"></embed></object>[/youtube]