I've (almost) finished my first "real" game using SFML (http://sfml-dev.org/ ), which is a really nice library. In the game, you control a car driving on a road. Your goal is to get as many points as possible, which is achieved by surviving for as long as possible (by avoiding the oncoming cars), and picking up extra points on the road. There's also three different power-ups, which will each give you a special ability that lasts for 10 seconds.
I'm pretty satisfied with the game, but of course, there's always room for improvements. I would really appreciate any feedback and suggestions regarding the game. :)
Quite nicely done. I like the sprites. Did you make them yourself?
For aesthetics, you need some pseudo gui to make text not appear as misplaced (especially the "You crashed!" message. A rectangle behind it would make it much nicer.)
For pragmatics, you need to limit frames (don't remember exactly, but I think there is a function for that), so that you don't use 100% cpu.
For future improvements, you could make the cars turn like real cars (so that pressing arrows actually changes direction and not just shift slightly). Also, you could create more interesting enemies, moving in various patterns.
Thanks. Yes, I did make all the sprites myself. I used the vector graphics program Inkscape, which I think is pretty good to make game art with. About the frame limit, I've now enabled vsync (which prevents the game to run at a higher framerate than the monitor can display). All I had to add was App.UseVerticalSync(true);, where App is a sf::RenderWindow instance.
About the "You crashed!" text, I totally agree with you. I'll be sure to some kind of rectangle behind it. Talking about enemies moving in more "interesting patterns", I think a car moving in zig zag would be kind of cool. Or?
IMO, the cars moving like real cars (change angle etc.) would not fit the game very well. The game is trying to be more cartoonish and surreal than real, and is not trying to imitate real life (as you can probably see). I also think it would have been slightly more difficult to control the cars. But thank you very much for some great feedback!
@TheMassiveChipmunk: Thanks, I thought power-ups was a cool idea too. About the source code, I'd rather upload it when the game is fully complete.
@hamsterman: Vsync checks the refresh rate of the monitor, and sets the frame rate limit to the maximum the monitor can display. In most cases, it will be equivalent to App.SetFramerateLimit(60), but vsync makes sure that the game will also run fine on monitors with a very low or very high refresh rate. I therefore think it's better to enable vsync than setting the same constant fixed frame rate for all computers.
@ OP: The problem with the VSync approach is that you are making your Frame Rate dependent on the monitor when it's the computer doing all of the work for a game like this. The function SetFramerateLimit is a better approach to not pegging the CPU core at 100%.
I noticed by the reaction time that you are using the while(App.GetEvent(Event)) approach. The const pointer to "GetInput(...)" method gives you much better reaction times. This is just something to keep in mind for your next project since I don't really expect you to tare down your whole project and rebuild it to make this one change.
EDIT: Sorry I forgot to mention that this is some great work. I kind of want a rocket launcher, after all what game can't be made better with a rocket launcher?
@Computergeek01: About the frame rate, does it really matter if you use vsync or SetFramerateLimit when all game movement and logic is frame independant? And I am actually using GetInput for movement. :P I like the idea about rocket launchers. I'll see if I can implement that.
@ OP: It's about how often the screen is refreashed, you can open task manager and see for yourself what kind of a difference it makes. You may not be able to notice it but on a machine like the one I'm using now I can clearley see one of the CPU cores pegged at full usage with your app which is something that I've seen with SFML when I don't use SetFramerateLimit(...). chrisname has a valid option too, I've seen that's the way that a few SDL tutorials handle this same situation.
Oh, and if you're using GetInput() make sure to take timing into account (see http://sfml-dev.org/tutorials/1.6/window-time.php) or things will move at different speeds depending on your hardware (i.e., a car might be faster on my computer than on yours).