Blade Brothers Engine: Creating my first 2D Game Engine

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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.
There's no place like ~/
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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.
There's no place like ~/
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post by LeonBlade »

Sorry for the lack of quality at first, it's still processing ;)

http://www.youtube.com/watch?v=j7pFkLQs7Pw
There's no place like ~/
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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!
There's no place like ~/
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

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

Post 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.
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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.
There's no place like ~/
quickshot14
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 31
Joined: Thu Mar 11, 2010 2:51 am
Current Project: VB.NET Direct X Game Engine (Working Title)
Favorite Gaming Platforms: PC
Programming Language of Choice: VB.NET (for now)
Location: Nebreska, USA
Contact:

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

Post 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!
Amatuer Game Design/Programmer & College Student (Kaplan University: Associate of Applied Sceince in Information Technology: Application Devleopment)
Know Programming Languages & Considered Levels Of Programming in them: Basic(DOS) - 10%, VB(Legacy) - 15%, VB.NET - 55%, C/C++ - 1%, C# - 1%, LUA - 25%, Java - 0%, COBOL - 0%
________________________________________________
Current Game Development/Programming Projects:
VB.NET Direct X Game Engine (Working Title) - (Lanugage: VB.NET | Released Type/Status: Open Soruce / Unreleased)
________________________________________________
Quicks14Blog (My Gaming Related Blog Page) - My Youtube Channel Page
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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 :)
There's no place like ~/
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

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

Post by eatcomics »

Great! Can't wait to see it in the engine! I just love seeing other people's game dev videos :lol:
Image
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

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

Post by GroundUpEngine »

aha same! I wanna see these maps in action :)
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post by LeonBlade »


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

I'm pretty excited for this.
It's not much, but it's something :)
There's no place like ~/
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

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

Post by eatcomics »

pretty sick
Image
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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:
There's no place like ~/
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

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

Post 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();
	}
}
User avatar
LeonBlade
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1314
Joined: Thu Jan 22, 2009 12:22 am
Current Project: Trying to make my first engine in C++ using OGL
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: Blossvale, NY

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

Post 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 :(
There's no place like ~/
Post Reply