Page 3 of 19

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Thu Feb 04, 2010 8:14 pm
by LeonBlade
Sorry I haven't done much, I've been sick lately and haven't had the energy to start work again.
I will soon.

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Mon Feb 08, 2010 12:49 pm
by LeonBlade
Alright now I'm working on my BBEMap class which will load in a .map file which currently is just this:

Code: Select all

0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
However, later on I'll be doing some sort of map file structure in a language like YAML as K-Bal suggested.

Currently now I'm just trying to get back in the flow of coding that I was in a week ago or so.
I plan on currently just reading in a line and then exploding the line with the blank space character as the delimiter and then getting the correct tile from the tilesheet and adding that sprite to a SDL_Surface called map and then when I render it I'll just render the entire surface to the screen.

I'll keep you updated within the next hour or so.
Right now I'm going to get something else to eat maybe and something to drink.

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sun Feb 21, 2010 11:20 pm
by LeonBlade
Sorry for the lack of quality at first, it's still processing ;)

http://www.youtube.com/watch?v=j7pFkLQs7Pw

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Thu Mar 11, 2010 5:22 pm
by LeonBlade
Hey everyone!
Sorry I haven't updated much in a while, been kinda busy ;)

So here is my documentation on my map file format (I figured doing it in binary is 10 times easier).
Click here to download it and check it out!
Let me know what you think, what I should chance etc.

Click here and you can download the test map.
In a few minutes I'll write some C++ to parse the map file (just some command line stuff).

So check back in a little bit, and again let me know what you think!

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 5:57 pm
by Falco Girgis
Oh shit, that's XCode. I had no idea you were a Mac user, dude.

Great video, btw. I subbed, 5 starred, and favorited.

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 6:12 pm
by LeonBlade
GyroVorbis wrote:Oh shit, that's XCode. I had no idea you were a Mac user, dude.

Great video, btw. I subbed, 5 starred, and favorited.
Haha, yep ;)
And thanks, I hope to be making some new videos soon once I work out the map stuff.

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 8:12 pm
by quickshot14
Very cool stuff i didnt get to quite watch all of it i'll probley do that latter tonight, was funny thou cause when I heard you talking it almost sounded how I sound just deeper....lol odd anywayz subed keep up the great work!

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 9:18 pm
by LeonBlade

http://www.youtube.com/watch?v=hzXEqPJHCJY

Thanks again for those that helped out, I'll be posting very soon once I get actual tiles down :)

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 10:12 pm
by eatcomics
Great! Can't wait to see it in the engine! I just love seeing other people's game dev videos :lol:

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Fri Mar 12, 2010 10:52 pm
by GroundUpEngine
aha same! I wanna see these maps in action :)

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sat Mar 13, 2010 5:39 pm
by LeonBlade

http://www.youtube.com/watch?v=tOldic2brhw

I'm pretty excited for this.
It's not much, but it's something :)

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sat Mar 13, 2010 6:30 pm
by eatcomics
pretty sick

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sat Mar 13, 2010 7:29 pm
by LeonBlade
Oh god... I'm running into some problems.
The Events are slow as SHIT and nothing is instant.

Here is what my event look like:

Code: Select all

void BBEGame::EventLoop(void)
{
	SDL_Event event;
	
	// Game loop
	while ( SDL_PollEvent(&event) ) 
	{
		switch (event.type) 
		{
			// When you want to handle user events
			case SDL_USEREVENT:
				HandleUserEvents(&event);
				break;
				
			// When you want to respond to user input
			case SDL_KEYUP:
				HandleKeyDown(&event);
				break;
				
			// When SDL is quit
			case SDL_QUIT:
				done = true;
				break;
				
			case SDL_MOUSEMOTION:
				//HandleMouseMove(&event);
				break;
				
			case SDL_MOUSEBUTTONDOWN:
				HandleMouseDown(&event);
				break;
				
			case SDL_MOUSEBUTTONUP:
				HandleMouseUp(&event);
				break;
				
			default:
				break;
		}
	}
}
Here is my mouse move:

Code: Select all

void BBEGame::HandleMouseMove(SDL_Event *event)
{
	//SDL_GetMouseState(&mouseX, &mouseY);
	
	mouseX = event->motion.x;
	mouseY = event->motion.y;
	
	int rx = (mouseX % 32);
	int ry = (mouseY % 32);
	
	BBEPoint ps;
	ps.x = mouseX - rx;
	ps.y = mouseY - ry;
	
	myCursor.Move(ps, false); 
}
If I put that in the GameLoop it runs relatively smooth, however doing it like this is SLOW and very unresponsive.
Does anyone have a possible explanation as to why this is happening :cry:

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sat Mar 13, 2010 8:04 pm
by GroundUpEngine
Dun use case statement they slow as hell for Input stuff, use if statements instead ->

Code: Select all

SDL_Event event;

void handle()
{
    if( event.type == SDL_QUIT )
    {
        quit = true;
    }

   //same for mouse stuff
}

..
while( quit == false )
{
	if( SDL_PollEvent( &event ) )
	{
		handle();
	}
}

Re: Blade Brothers Engine: Creating my first 2D Game Engine

Posted: Sat Mar 13, 2010 9:48 pm
by LeonBlade

Code: Select all

// Event-related functions
void BBEGame::EventLoop(void)
{
	SDL_Event event;
	
	// Game loop
	while ( SDL_PollEvent(&event) ) 
	{
		
		if (event.type == SDL_USEREVENT) {
			HandleUserEvents(&event);
		}		
		if (event.type == SDL_KEYUP) {
			HandleKeyDown(&event);
		}
		if (event.type == SDL_QUIT) {
			done = true;
		}
		if (event.type == SDL_MOUSEMOTION) {
			HandleMouseMove(&event);
		}
		if (event.type == SDL_MOUSEBUTTONDOWN) {
			HandleMouseDown(&event);
		}
		if (event.type == SDL_MOUSEBUTTONUP) {
			HandleMouseUp(&event);
		}
	}
}
Is still slow :(