Page 4 of 19
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sat Mar 13, 2010 10:14 pm
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;
}
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sun Mar 14, 2010 6:01 pm
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.
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sun Mar 14, 2010 6:17 pm
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).
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sun Mar 14, 2010 6:34 pm
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
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sun Mar 14, 2010 9:40 pm
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
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.
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Sun Mar 14, 2010 11:59 pm
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
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
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 2:38 am
by LeonBlade
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 3:59 am
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
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
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 6:24 am
by GroundUpEngine
Sweet! Nice Work! 5*
I have a suggestion though, add in a collision layer
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 6:29 am
by Live-Dimension
That's pretty awesome, good work on the editor so far!
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 9:51 am
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)
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Mon Mar 15, 2010 7:31 pm
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
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Tue Mar 16, 2010 5:01 pm
by MrDeathNote
I wouldn't be too hard on yourself man your making really good progress keep it up
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Tue Mar 16, 2010 6:20 pm
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
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.
Re: Blade Brothers Engine: Creating my first 2D Game Engine
Posted: Wed Mar 17, 2010 5:38 pm
by davidthefat
You should add some random map generator thing like in RTSs and Diablo