Friday, April 18, 2008

A weekly check-in (almost)

And as a complete surprise, I've actually been doing some game-related programming this week :)
It isn't exactly interesting programming, but it's been fun doing it. I've been recreating my event-dispatcher and input manager code around SFML and, due to how easy SFML makes creating thread-safe code, I've even turned it into a threaded system while I was at it.

I've still got a bit left to do with my input-action code (namely, actually re-write it :)) but so far it's been going well. It took me very little time and effort to wrap an SFML event source (i.e. a window) into a class that would translate the event structure into a series of Event-derived classes and dispatch them to registered listeners. Then a little bit more to write listeners that would let you register multiple other listeners (multiple dispatch) to get events around the entire system.

I've almost finished with my input code as well now, with a keyboard and mouse class that can be registered as event listeners and give you input references to check if a button or key has been pressed (request a key input, it gives you back an input object that is bound to the key... a nice amalgam of polling and events I reckon :). The last section that I've just started on is to bind the inputs into named actions, which will allow a config file to load a set of actions and key mappings into the events and check for the actions by name rather than by key. It should be nicely configurable by the time I finish, unless something shiny distracts me sometime in the next week and I abandon it again :)

After that, I'll start working on some graphical stuff, although I am also thinking of some network engine stuff that I want to add to allow for even more ease of use with networking. If I do that next, I'll do a review on the SFML network package.

Other news: Wedding is getting closer and closer, and I have a hamster show to attend this weekend. Lots of fun :P

Wednesday, April 9, 2008

SFML - Getting back on the wagon (A brief review)

It's been a while since I've updated. That's mainly due to a lack of time to do any personal programming as I've been busy at work and organising a wedding (My own :D).

Still, I found myself with some free time yesterday and took the opportunity to try out a new framework mentioned on http://gpwiki.org/forums called SFML (Simple and Fast Multimedia Library). It's an Object Oriented C++ framework designed to speed up development of certain types of applications (games being one of them) and I have to say, first impressions are good.

Coding wise, the library is definitely simple and fast to pick up. It is organised into logical packages (system, graphics, windows, audio, networking, etc.) and can be used with either a package include (#include ) or at a class level (#include ) allowing fine control of dependencies and coupling. Using the items couldn't be simpler either. The classes are typically designed along RAII principles and when they aren't (as is the case with mutexes) then an RAII wrapper is provided (in the previous case, the wrapper is the lock class). The interfaces to the classes are clean and simple to use and if you use a code-completing IDE such as Visual Studio then you also have easy access to the comments when browsing for the correct method (at this point it almost goes without saying that the comments are simple, but not too simple ;)).

Still, it is only a simple library so it must have some things it ignores or doesn't do well surely? Well, it only provides it's interfaces for 2d drawing operations. This doesn't make it useless for 3d though as once you have created a window (a single line of code, can't be much simpler eh? :)) then you have access to OpenGL for all your 3d needs. That's it, you include the headers, link it, open a window and you can use OpenGL. None of this messing around with creating a window with different parameters that is so common with other libraries. That makes it about as simple as possible for 3d development as well as 2d (if you have an engine that uses just OGL and requires a window set up for use, then it should work with SFML with almost no fuss). How about 2d and 3d together? Again, simple as can be, you just create a graphics RenderWindow (used for all SFMLs 2d api drawing) and you can mix and match OGL and SFML.

That last point needs to be taken with a slight pinch of salt though. After a very brief play with the library, I've already noticed that there is a slight speed issue with this. I've yet to track down exactly what is causing it (I'm using boost lexical_cast for an fps meter, so it could be that being called 20 times a second that is the bottleneck) but with a simple rotating cube and aforementioned FPS reading I was only getting 20fps. I wouldn't hold this against the library though. Mixing their 2d API with arbitrary OGL calls would always be a tricky operation. I believe it is made easier by their use of OGL under the hood for 2d API operations (or so I believe) but that introduces a problem of it's own, namely state management. With their 2d drawing, they will need to maintain both their state and your OGL state and switch them at the start and end of each function that relies on it. Even with the best algorithms this is a costly operation. It is recognised by the library creator though and they provide a way to turn off the state management if you use SMFL exclusively (or wish to manage the state yourself, as then you can store and manage state on a more sensible level than 'in my code, I must save your state').

I have yet to explore their sound or networking libraries, but I expect more of the same from them. The sound package is built upon OpenAL, so I would expect a fairly decent wrapper around that judging by the rest of the library. Networking is on the level of class-wrappers for network sockets etc. and so is probably the most low-level API available in the library. I'll comment more on them when I have used them more though.

My first impression is one of good, clean design and a decent implementation. Some possible speed issues that I haven't confirmed yet admittedly but even with that I have no problems recommending that anyone thinking of writing games and multimedia applications in C++ at least look at this library for their initial development period.

Thursday, September 20, 2007

The Usual Progress Report

Which is of course: Nothing to report :(

That is mainly because this week has been work hell. I've been finishing off one project and getting properly stuck into the next, and it was Anitas birthday yesterday. Coupled with not much free time last weekend has ended in a week where about the most I have managed is to uninstall VC++2008 and install VC++2005 in its place, which is a slight improvement except that I now need to recompile my dev libraries (SDL and Glew being the main ones) and problems are occuring from that.

Ah well, another weekend is looming and I should be able to get some free time over this one to at least sort out my libraries. I will attempt to get something on screen for about mid-way through next week (until I post next Thursday with more procrastination and excuses anyway ;))

Wednesday, September 12, 2007

Midweek update

Well, this is mainly because I am currently bored at work, and feel I should do a quick progress update due to the problem that I'm not going to be available over the weekend to do so.

So, my current update progress is: Nothing on screen yet.
The reason? Because I'm being my usual self and spending too long on my input code system. I must have written something similar to this system almost a dozen times now, and each time I get fed up and then lose the code. This time, I'm going to write one extra class (I currently have mouse and keyboard) to handle 'actions', but that will come after I have thought a bit more about how to design the actions. I will write a quick, hard coded wrapper around my current input code to create a window and have something moving around over the next few days, and then you may get a screenshot towards the end of the week of a badly drawn sprite or a simple teapot or something :)

But for now, I should probably attempt to get some work done.

Saturday, September 8, 2007

Race to Saturn - Update and Setup

Well, I'm getting started with games stuff. I have a couple of ideas as to what I would like to develop and I have set my computer up as a fairly comprehensive (to me anyway) development environment. I currently have set up:
VC++ Express 2008 (I may downgrade this to 2005 express at some point. it is still a beta version after all :))
SDL
SDL_Image
SDL_Net
SDL_TTF
FMod
FreeType
GLEW (for opengl extensions, in case I ever want to go into shaders and stuff :))

and just because I'm interested:
C# 2005 express and XNA 1.0 refresh

So I think I am set up for most of my development needs.

As for other stuff, I have put a bit of thought into my roadmap, but it is in no way finalised yet. My current thoughts go:

Set-Up (completed)
Refresh knowledge on SDL and OpenGL (in progress)
Develop first game/demo
Learn sound and networking stuff
Develop second demo
Learn how to use TTF font rendering effectively
Add some menus etc to previous demos
Advanced OpenGL
More impressive demo (graphically anyway ;)
Some physics stuff (possibly look at havok, or possibly develop some demos on my own. Depends on how I feel :))
Start designing/implementing an engine
See how things go from there

Now, I've dabbled in a lot of this stuff before, so I hope that this initial set of things won't take me too long. I'm going to set an initial timescale of 6 months for it though, just so I can feel better if I go faster (and so I don't feel bad if I act like a lazy bum and find myself entangled with work more than this ;))

So, with that, I'm going to sign off for the week and update next sat/sun with any progress I have made towards relearning SDL and OpenGL :)

Friday, September 7, 2007

A Race to Saturn - Initial posting

Well, its been a while since I posted here, although not much has changed. I've gotten settled into my job and have almost ended my probation period. I've helped out a lecturer on a research project and should be doing some more for him soon. And I've entered a competition called 'A Race to Saturn'.

A Race to Saturn is an interesting idea for a long term project/competition. The basic idea is to improve an entrants game development skills by having a weekly progress posting (which will be here for me incidentally, and probably on a Saturday or Sunday) with releases of any small games/tech demos that the entrant has created. The final end goal is to have created a commercial level game and sell 100 copies of it, although this could be some time in the future (I'm guessing a year or two probably :))

My motivation for entering it was mainly to provide myself with motivation for continuing to develop my game development skills. It also gives me a reason to post something here at least once a week (even if its a 'work has been hell, nothing to report' posting which will happen more than once I expect. Just a warning up front ;)). When I do my first competition post I'll provide the entry details I am required to for the competition and will also do a quick roadmap of what I would like to do in this competition and (very) rough projections for how long I think each item will take.

Thats about it till Sunday. Now I'm off to do some work :/

Monday, June 4, 2007

Working man

It finally came.... I've started my job now. I'm now a graduate software engineer developing stuff for mobile phones :) Or at least, I will be once I get a computer at my desk at work :/ They ran into build problems with the machine supposedly for me, and when they got it sorted, it got requisitioned by someone higher up, so I have to wait till tuesday or wednesday for that slightly vital piece of equipment :)

So, my first day was spent reading the notes for the '3 day Symbian OS Essentials course', which is essentially the minimum required knowledge for my job. Hopefully it will make more sense once I have a computer and can do the exercises at various points along the way.

Otherwise, news is pretty much standard. Anita is ill again (or possibly still), so I've been taking care of her as much as I can, and I've finally managed to borrow a copy of Design Patterns and have been reading that for a bit of extra insight :)