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 »

Here is my timer stuff... let me know what I'm doing wrong if anything:

Code: Select all

void BBEGame::InitializeTimer(void)
{
	timer = SDL_AddTimer(20, GameLoopTimer, this);
}

Uint32 BBEGame::GameLoopTimer(Uint32 interval, void *param)
{
	// Create a user event co call the game loop
	SDL_Event event;
	SDL_UserEvent userevent;
	
	userevent.type = SDL_USEREVENT;
	userevent.code = RUN_GAME_LOOP; //run_game_loop
	userevent.data1 = NULL;
	userevent.data2 = NULL;
	
	event.type = SDL_USEREVENT;
	event.user = userevent;
	
	SDL_PushEvent(&event);
	
	return interval;
}
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 »

The Engine is going to be put on hold until I figure out what the fuck I'm doing wrong...
The events are loading slow as hell and now the Engine randomly quits on it's own...

If someone is willing to help, let me know what you want to see from my code.
There's no place like ~/
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post by dandymcgee »

My guess is that it's not in the code you've posted. At least I see nothing wrong with what you've provided so far (Although I've never used SDL_AddTimer() for anything).
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
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 »

dandymcgee wrote:My guess is that it's not in the code you've posted. At least I see nothing wrong with what you've provided so far (Although I've never used SDL_AddTimer() for anything).
What are some possibilities do you think?
Maybe some memory problems? Or what?
I haven't done much in C++ before so I'm sure I've wrote something wrong :lol:
There's no place like ~/
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

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

Post by dandymcgee »

LeonBlade wrote:
dandymcgee wrote:My guess is that it's not in the code you've posted. At least I see nothing wrong with what you've provided so far (Although I've never used SDL_AddTimer() for anything).
What are some possibilities do you think?
Maybe some memory problems? Or what?
I haven't done much in C++ before so I'm sure I've wrote something wrong :lol:
A memory leak is one possibility, or maybe your timer is slowing something down that you didn't intend it to. Honestly nobody can be sure without studying relevant code.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
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 »

Okay well, what happens is something calls the Cleanup function and I'm not sure what, I'll look into it...
Disregard this, I suck cocks.

I found my problem :nono: I put PollEvent instead of WaitEvent :lol:it was early last time I was messing around with this shit...
Glad to see it's not a memory problem :) and the switch statements were the cause of the sluggish behavior and now everything
is set to finish the editor :)
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 »

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 »

LeonBlade wrote:Okay well, what happens is something calls the Cleanup function and I'm not sure what, I'll look into it...
Disregard this, I suck cocks.

I found my problem :nono: I put PollEvent instead of WaitEvent :lol:it was early last time I was messing around with this shit...
Glad to see it's not a memory problem :) and the switch statements were the cause of the sluggish behavior and now everything
is set to finish the editor :)
Oh man I feel ya gotta love thoese simple little mistakes we make particlaury when were tried. I litteraly spent like an hour debugging trying to find a animation problem only to relize althought I added the animation code in one function I didnt in the other...:/ have thoese moments particluarly when you have to take a break from coding (rl interput oui) and then come back....I just need to learn to read my own comments lol still awsome man glad you got it all fixed up i'll check out your new vid latter today after i'm done uploading my new game vblogs.

Oh and if you want to see me hunting for that and other dumb little things cause i'm an idot (i say it a lot in my vids too lol) my new programing vids will be up this weekend. Keep kicking butt :)
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
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 »

Sweet! Nice Work! 5*
I have a suggestion though, add in a collision layer ;)
Live-Dimension
Chaos Rift Junior
Chaos Rift Junior
Posts: 345
Joined: Tue Jan 12, 2010 7:23 pm
Favorite Gaming Platforms: PC - Windows 7
Programming Language of Choice: c++;haxe
Contact:

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

Post by Live-Dimension »

That's pretty awesome, good work on the editor so far!
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 »

quickshot14 wrote:Oh man I feel ya gotta love thoese simple little mistakes we make particlaury when were tried. I litteraly spent like an hour debugging trying to find a animation problem only to relize althought I added the animation code in one function I didnt in the other...:/ have thoese moments particluarly when you have to take a break from coding (rl interput oui) and then come back....I just need to learn to read my own comments lol still awsome man glad you got it all fixed up i'll check out your new vid latter today after i'm done uploading my new game vblogs.

Oh and if you want to see me hunting for that and other dumb little things cause i'm an idot (i say it a lot in my vids too lol) my new programing vids will be up this weekend. Keep kicking butt :)
I know right? It's such a face-palm when you come to realize it's something SO simple, but in the end it's better something simple then something a lot bigger :)
GroundUpEngine wrote:Sweet! Nice Work! 5*
I have a suggestion though, add in a collision layer ;)
Haha, funny you should mention that I just was thinking about that after I re-watched the video on YouTube ;)
That'll be next after I sort out a few bugs and enhance the actual GUI of the in-game engine.
Live-Dimension wrote:That's pretty awesome, good work on the editor so far!
Thank you :) I'm very happy about this, it's something I've never done before and I feel very accomplished (even though it's not much)
There's no place like ~/
Live-Dimension
Chaos Rift Junior
Chaos Rift Junior
Posts: 345
Joined: Tue Jan 12, 2010 7:23 pm
Favorite Gaming Platforms: PC - Windows 7
Programming Language of Choice: c++;haxe
Contact:

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

Post by Live-Dimension »

My first (and only completed) game is some kind of pac-man clone with a maze element to it. It sucked, but it was cool too. It wasn't much but I was over the moon with it :P I know how you feel ;)
Image
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

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

Post by MrDeathNote »

I wouldn't be too hard on yourself man your making really good progress keep it up :)
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
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 »

This is my mockup-layout for my map editor, let me know what you think.
I'm going to shower right now and when I come back I'll start working on it :)

Image

NOTE: If the image is too large you can try to...
1. Right click and select "View Image Source" or to some equivalent for your browser.
2. Go here instead.
There's no place like ~/
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

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

Post by davidthefat »

You should add some random map generator thing like in RTSs and Diablo
Post Reply