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

Framework == Done????

Yep... it is DONE. I just got done going through and making sure many things get output to a file, especially if there is an error. I've talked about making a GUI portion, and perhaps a bitmap font engine, but for the time being, I just want to be done with the whole thing. I've been getting behind on my homework lately, so I want to put in a big effort on that, and get all caught up on it.


So hopefully I'll start on some type of game, and perhaps finish it, before I go back to school.

Well that's the small update, later...

Audio Manager = done!

Well after a few days, it's finally done. Sorry it took so long, I've been pretty lazy.


So basically here's how it works: There's two abstractions CMusic and CSound (Mix_Music and Mix_Chunk).

Sound holds a channel, and volume, and music just holds volume (other than the actual piece of audio, that is).

You can call methods from them, which in-turn, call methods from the AudioManager. The AudioManager acts as a 'messenger' between SDL_mixer and the two abstractions. It performs checks on the various data of the abstractions, and then calls the appropriate SDL_mixer method.

It works great as of now, but I may add more later.

So now there's one last thing I will definitely get finished, and that is the Debug 'Manager'. I just want it to have functions to print to file and the screen. It will have it's own CText object to use TTF to print to screen. I also want to create some way to bound text to a rectangle, so that I can specify a specific rectangle, and the text will automatically be formatted to fit in the rectangle.

So after that, I'll definitely be having a code cleanup, and I'll implement Debugging code in many places (I have it set up already, I just gotta add the method call).

After that, I will decide to make a bitmap font engine and/or a GUI portion. At the moment, I'm really hesitant for the bitmap font engine, but slightly enthusiastic about the GUI 'module'.

Well I'm going to stop talking now, and hit the sack... Night Guys...

Secret Project Already Gone With The Wind =(

So the 'secret project' was a bot for the game Conquer Online. My friend had it working, and a lot of it worked quite well. I guess they released something that shut it down though, and my friend doesn't want to continue with it. More time for me I guess.


I was gone most of the day, so I didn't get anything done, but I'm starting to debate on whether I should actually make a bmp font engine, I might skip it for now, and make the audio manager, and then come back and make it, who knows.

But I already got a small start on a 'GUI' portion to the framework, but I'm not planning on finishing that until after I finish and sync up everything else.

The next two days are going to be quite hectic for me, so I don't know if I'll be doing anything. I want to get a good start on the homework I have though.

Well that's all for now, Peace, and Merry Christmas !

New Video Series?

Well I actually did get started making those SDL Tutorials. I've made two of them, but one of the two is split into two parts. Today, there was a lot of people bugging me to do different things, and I didn't get any work done on the Framework. I'm leaving soon, so I don't feel comfortable with starting to work on it now. The rest of the week, I'll be pretty busy, so I'm not sure how much work I'll get done, but here's my plan:


By the end of this week, have the audio manager done, with chunk and music abstractions
By Thursday/Friday of NEXT week, have all my text stuff implemented
Then use that last weekend to implement some debugging stuff and tie up loose ends, and make sure everything works fine together.

Then:

*The Game of Life (Estimated Time = 4 Days)
*Entropy(Estimated Time = 3 Days)
*Breakout(Estimated Time = 10 Days)

Then I'm not really sure what I'll do...

New Video

Well I finished kind of cleaning up my code, and made a 10 minute long video... with my own audio commentary =D.


Well I just wanted to announce that. I'm going to change one quick thing in the framework before I go to bed, and tomorrow I'll get started on the Audio Manager.

In the video, I think I said that I may do some SDL tutorials... So I'll see how I feel about that tomorrow, and maybe start making them.

Here's a link: Link

Enjoy.

2 Updates in One Day???

Yeah that's right!


Well I fixed the image loading stuff.

So the problem was that I was getting an Access Violation error... That's what kind of happens when you forget to initialize an object! I overlooked it so easily, because it was late at night when it happened, and I thought I just declared the object, didn't think I declared a pointer to the object.

Anyways, after I fixed that, the program would execute, but the image wouldn't show up. 5 minutes of a quick debug set up later and I find that the Video Mode wasn't set, which didn't make sense to me at that exact moment, considering the video was made. Then I found I accidentally commented out my initializing method.

After uncommenting that, it ran fine.

So next things to do, which I hope to finish tonight:

*Add Direct Pixel Manipulation of Surfaces
*Add Method(s) to select an icon for the window

Tomorrow is going to be a clean up day for my code. I'm going to throw everything into a namespace, and then go through and fix up some places in my code. There's places where things seem done, but they aren't really done.

Basically it's just things where I might have:

bool OnInit(), and then when I call it, I don't do anything if it returns false.

I'll also be going through and commenting a lot of the code.

So Monday, I will start working on the Audio Manager, and hopefully get that done within 2-3 days. Then I'll spend some time 'studying' SDL_TTF and perhaps making my own bitmap font engine.

Then I'll throw together a DebugManager, which will utilize the 'font manager' (not really sure about how I'm going to handle it yet....). Then it will be all done.

After that, the only changes I'll be making are optimizations. When it's done, I'm jumping right back into developing games. Starting with the Game of Life and Entropy, then I'm thinking about making a Tetris game, and a Breakout game, although, I think I might skip Tetris and go straight to Breakout. After that, I'm thinking of making a platformer =p.

Well that's all for now... I should (hopefully) have an update tomorrow. But if I do, I'll make sure it's after I do some cleanup.

So expect a video some time in the coming week showing off the current functionality of the framework.

New Update (Finals are OVER!)

Well Finals are over =D. I got As on all my finals, and have a 4.3 GPA for the semester, so I'm in good shape. Anyways, back to the actual development stuff.


So I made myself a check list of things I want done before I make a video. I've started on it, and have already completed half of it.

Right now, the current issue at hand, is my surface abstraction. I made an example real quick to test image loading/clipping. Everything compiles and links just fine, but when I execute it, I get an Access Violation error whenever it comes to the abstracted surface in the code.

So I have a LoadImage method in my abstracted surface class:

void LoadImage(std::string filename)
{
if(m_pSurface != NULL)
{
delete m_pSurface;
m_pSurface = NULL;
}

SDL_Surface* loadedImage;
SDL_Surface* optimizedImage;

//I don't feel like typing the rest, but basically
//I load the image into loaded image, and if it isn't NULL, then I format the image,
//Then I assign the value of optimizedImage (which is now loaded and formatted)
//To m_pSurface(which is the abstracted surface).


Anyways, right here: if(m_pSurface != NULL), is where it happens... I take that out, and it has an access violation the next time I mention m_pSurface.

I'll find the problem today hopefully. But after that, my checklist is:

*Extend functionality of surface abstraction to allow direct pixel manipulation
*Add support to select an icon for the window
*Place everything in a namespace
*Clean up and comments

so after I do everything, I'm going to go through, and organize things a bit better, and get things ready. I also haven't been consistent with comments, so I'm going to comment it as I'm reorganizing things.

But as it is now, to make anything, all I will have to do is:

Create a derived class from CApplicationManager (or use the basic one I made, which will just be used for simple demos) and then make my own set of states.

Well that's it for now, I'll make another post if I get anything done

Update for the Day

Well today I didn't get a lot done in terms of productivity, but I did test some features with small little demos.


I also added some important methods to the Window Manager class to update the screen, fill the screen with a certain color, and fill a rect.

The demos were just simple things to make sure the new methods worked, and to make sure window managing worked.

I also encountered a fail of the day in one of them...

I wrote up a quick demo using the framework that created a block where the mouse cursor was, and moved where ever the mouse moved (so it acted as a secondary cursor I suppose...). Anyways, when I first ran it, it was just a blank blue screen (I cleared the screen blue), and I kept wondering what the problem was. After about 20 minutes of searching through my event handling code... I found that I had set the block's color to blue, same as the background color.

Well, I checked to make sure all my event handling stuff works:

*Key Presses
*Key Releases
*Mouse Presses
*Mouse Releases
*Mouse Movement
*Focus Loss
*Window Resizing (Including Fullscreen support)

It seems like I'm missing some, but that's just off the top of my head...

But with that, I bid you ado.

Real Quick Update

Just wanted to say that I finally took care of all those errors, and the project now compiles fine, with just a single warning (just a little tidbit about losing data, because I convert from a double to an int) =D. Anyways, the event handling works well.


Tomorrow I have finals the next three days, so I probably won't work too much on the framework.

What I need to do, is study the structure of both SDL_mixer and SDL_ttf, because those are the last two things I want to implement.

After I do that, I'm going to make a much better Debug class, so that you can debug to the screen.

So just off the top of my head for the text stuff, I want to be able to do the following:

*Specify a Rectangle that text keeps itself in (not sure how possible this is... I'm sure there must be a way though)

* Select font, color, and string of text

* Find some way to manage fonts (Maybe not though...)


So that's just a few things that I want... Simplistic, but it's just off the top of my head. I'll be taking a lot of notes on SDL_mixer and SDL_ttf from Focus On SDL, LazyFoo's tutorials, and their respective documents.

Well that's the update. I definitely should finish this over this break that's coming up =D

446 Errors 0.o???

Will after I completed my Event Manager class, and a state machine, I attempted to compile the project, to make sure everything worked right. Well, I come to find out, that there are 446 errors and 30 warnings in the project, I think that's a new record of some sort =D!


Anyways, I've been slowly, but surely, cranking away at the errors and have now reduced it to 20 errors. Problem is, the 20 errors are all from the same thing, and quite frankly, I haven't figured out the problem. my Application Manager doesn't know that my Event Manager exists, and vice versa. Every other class can use both of these fine and vice versa. I've included the header file declaring the class, and checked to make sure the class ended with a semicolon. So I'm going to have to walk through the structure of the Window Manager and the Event Manager and the Application Manager to see how the Window Manager differs....

I'll try to work on that today, but for now, I must leave, school calls =/.

Attempting to Keep Updates...

So I finished my event handling scheme. Works just how I like it. Towards the end, I decided to screw Joystick/Controller support, so I have the methods commented out, so I can easily finish adding support later, should I so choose.


Looking at my framework, there was something that bothered me. To initialize subsystems of the framework, you call an 'OnInit' function, that takes in a number of flags, for each piece you want to initialize. I'm not really enjoying this, and I'm really considering pulling that out, and adding an init function for each subsystem within the app manager. This way, I can have more control over how each piece is created.

The thing I'm disliking more and more though. Is having to use the AppMgr to access anything else. But thinking about that... That's the whole point of the AppMgr, to have a unified 'front' to access everything. I'm just lazy and don't want to type alot... so #define will be a good friend =p.

#define WndwMgr CApplicationManager::Instance()->GetWindowManager()

The joys of #defines...

Anyways... So now that I'm done talking about what I'm doing next, let's talk a little bit about what I just did.

So basically, there were 3 new classes I wrote: Base Game State, Game State Machine, and Event Handler. The Event Handler polls for events, and every time there is an event, the event is dispatched to the AppMgr which determines whether it is an event that the Window Manager or state machine needs, and then dispatches it to the correct manager. The Window manager has functions to handle each type of event, such as resizes and focus loss.

The State Machine utilizes the Base Game State ( duh!). The Base Game State class has virtual functions for mouse/keyboard events. If your Game State will use it, then override the virtual function, if not, no harm done.

Well, that's pretty much the Event Manager...

So after I do some clean up to make sure everything works together so far, I'm going to finish planning out the Audio Manager, which will be the last piece (Besides Threading, Networking, and OpenGL support, but I'm not planning on adding any of those until I get my new computer).

I planned out the Audio Manager once before, but I'll have to modify it a little bit due to recent changes.

Now that I've said the Audio Manager is the last thing, I've realized I don't have text support yet =0.

I'm still contemplating on whether I want a full out text system (ttf/bitmap font support, specialized surface abstraction, and functions made specifically for it)

or just extend support on the abstracted surface I already have...

Either way, I should finish this framework over the break... and hopefully those two games.

Anyways, finals are almost here, if I get an 86 on my history final, I'll have a 4.3 GPA, yay...

Depending on how I feel over the break, I'm thinking about releasing some SDL video tutorials... The only SDL Video tutorial I know of is from some guy with a strange accent (no offense) snasebrase on Youtube, I believe...

Anyways I'm done rambling, it's time for bed, happy devving.

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!