Welcome!

Hey, I'm Skylar, a kid aspiring to become a competent programmer. This blog is here to detail my dabbles in development.

My dream is to one day become a professional programmer and do some game development in my spare time.

Thanks for visiting my blog, and I hope you'll come back!

Pages

What's Up with the Inconsistent Updates 0.o???

Well I apologize for the lack of updates. School work tends to take over my life, whether I choose to do it or not 0.o. But anyways, I think my last post should be completely disregarded... As I started using that 'template' I found it was real dirty, and had a lot of bugs =/. So I've been working on a new framework... One that is so much better. As I'm typing this, it seems I've said this a lot, but I'm making sure everything works and everything is clean as I go along. I've spent a lot of time planning it out, and studying various methods to get things to work. But anyways, I guess I'll share a little bit to how it works/will work.

So far I have written 3 classes to abstract SDL_Surfaces, SDL_Colors, and SDL_Rects. I have also written a point class, Timer Class, and derived a class from the Timer Class to act as a timer specifically to manage the frame rate of the game. Aside from those 6 classes, I have 3 other classes that are 'managers'. I have set up a hierarchy in which the Application Manager holds everything, and everything is accessed through it. So far I have the Application Manager, a Window Manager, and a 'Debug' Manager (Exists only in Debug Build). As of now the Debug manager is very simplistic, and isn't my main focus. But anyways back to how this all works.

The Application Manager is a singleton, and abstracts the game loop, so in my main function, all I need is:

int main(int argc, char* argv[])
{
AppMgr->OnInit();
return AppMgr->OnLoop();
}

This greatly simplifies what goes in the main function. But the Window Function has 5 pieces of data: Screen Width, Screen Height, Screen Bits Per Pixel, the Title of the Window, and an SDL_Surface* which is the screen itself. The Window Manager has a constructor to initialize everything, Rendering functions - I have a few overloaded versions of it, so you can specify a lot, or very little, and an 'OnEvent' function. I don't have Events coded in well yet, but that is my task for tonight. I have grouped all the event types into two categories: Input or Window.

So the Event Manager will have an SDL_Event, and will check for an event, on an input event, the event manager will dispatch it, along with information specific to that type of event, to the current state of the Application Manager (which also need to be coded...). If it's an event that affects the window (SDL_ACTIVEEVENT, SDL_VIDEORESIZE, or SDL_VIDEOEXPOSE), I will dispatch the event information to the window to handle accordingly.

This is where my last framework failed, and why I need something as the Application Manager to hold everything.

Using SDL_PollEvent() pushes the event out of the queue, and stuffs your event structure with the information regarding that event. My problem, was that I would do:

while(SDL_PollEvent(&event))
{
if(event.type == SDL_QUIT)
{
SetState(Quit);
}
}

This was a horrible way to handle it, because I had this going on in a global state, yet any event handling was done in the current state (I derived my state manager class from Programming Game AI by Example. Has a Global State, Current State, and Previous State). So anything that was controlled via events, wouldn't function.

Through this, I have one thing controlling everything and taking care of it. Then in the current state, it will pass the event information to any entity that may need it.

Each manager contained within the AppMgr, also has a pointer (named parent) back to it's application. The idea is that none of the minor managers should exist without the parent AppMgr. As of now I don't have anything to restrict creating any of those objects, but I'm not sure how necessary it is as of right now.

But anyways, here's what I have left: Game States, Game State Machine, SDL_mixer functionality (unless this is already OO, which I hear it is), then add some stuff to my Surface abstraction for text loading via SDL_TTF and perhaps a bitmap font engine.

After this, I want to make 2 games to 'test' the functionality of this framework.

The first one is John Conway's The Game of Life. The idea looks quite simple, so I think it'd be a great thing to wrap up quickly.

The other one has no name, it was just something I sort of thought of. I don't want to waste time explaining it right now, because it isn't very important.



So that's what is going on at the moment, but for any of you that are interested, here's what's happened in between my last post and this one.

As I started to work on my new framework, I found two people that wanted to attempt a group project, so I said I'd join in. We decided to use SDL, with OpenGL rendering. I come to find out that my crappy integrated chipset graphics (boo hoo =( ), apparantly doesn't support OpenGL, so every OpenGL app I attempt to run will crash =/.

Well, I have been saving up for a new computer, but it's going quite slowly, but Christmas, and my birthday are right around the corner, and I'm estimating the computer will cost about $600 including OS. I'm building the computer so I can get a better price. Going with Quad Core AMD, and a mediocre ATI GPU, and Windows 7. So I'm guessing around February/March, I'll have a new computer and can extend the framework to work with OpenGL, and then, if the other guys still want to, we can work on a group project.

But, I say this is good, considering none of us are too 'fluent' in OpenGL, and one of the guys needs to learn C++, SDL, and OpenGL... He knows C, and has been programming with PAlib for a long time, so it may take him a while to get familiar with this stuff, but I'm quite sure he has talent.

Anyways that's all that has really been happening. Finals next week, so I've been studying a lot, trying to cram as much information as I can. I have 5 /6 of my finals will be really easy for me: Chemistry, Math Analysis, Spanish 3, English, and Music History... my US history class is the only Final I'm worried about. I have a habit of not remembering anything important when it comes to history.

But after Finals, I have (2 weeks?) off, and I hope to get a lot done during that time. One goal I'm hoping to accomplish is to grab a headset and make a video or two. I'm hoping I can finish the framework and the two games I want to make within that time, so I can make a video on it, and put some commentary in it... I don't know about you, but I'm much more intrigued into Videos relating to Game Development when I can hear the person's voice.

Well that's the end of this long post... I gotta get to coding that Event Manager!

0 Response to "What's Up with the Inconsistent Updates 0.o???"

Post a Comment