C++ 2D Shooter project (Htbaa's Worklog)

Build on C++ with SDL and KrasEngine! RSS Feed

It's KrasEngine!

For the last 4 years or so I've only been programming web applications and web services. Plus some additional database converters. Mostly in Perl, and for my work in PHP.

Anyhow, last year I bough a C++ book with over 720 pages and I've read the all. I started some test projects using SDL and I even started a project with Vitto. Which of course, as usual, ended up dead. That's how we do things :-).

A few months ago it started to itch again and so it was that I decided to try some new stuff. After running some test cases I created the KrasEngine library. Which was going to make my life a little easier. Shortly after I finished the basic structure and program flow I combined it with SDL and put in my earlier written functions that allow me to load almost any kind of image with SDL_image (doing the right conversions), rotate and zoom an image, and image flipping.

After some fine tuning, and more testing :-) I patched all the memory leaks and other weird instant death bugs.

But shortly after I had finished the basis I quit. Why? Well, my biggest problems are still and have always been the graphics. Until recently I decided to use the images that DIV Games Studio 2 offers me (hell, I payed too much for a bugged out product so I might as well use some stuff from it :-)).

After installing it with WINE and then using DOSBOX to emulate DOS and start up DIV 2 (which is surprisingly fast, at least on my machine). I nicked the images from one of the examples and had them all in 1 nice sheet.

So after 2 days (maybe 3, I have bad memory) of work I expanded my test project and KrasEngine. KrasEngine got some functions added for collision detection.

With the graphics from DIV I've got a bit farther. Right now I have my scrolling background (yay!), basic GUI (nothing more than images staying at their position), a player with nice controls, enemies, animation, bullets and 3 different explosions.



So, what is the master plan? I'm planning on using all the graphics from the original DIV game. But the game won't be a port or remake. Just a "new" game with the same graphics.

If I'm finishing this game (and I will try to, although it's hard since most of my time is getting swallowed by work which is also a programming job) it's going to contain the following features:

* A couple of levels. Although with the current graphics I guess it'll get boring pretty fast.
* 5 different enemies with different attack patterns
* Special weapons and power-ups
* At least 1 boss fight. Probably more but the boss will be the same, his attack patterns will differ.
* Online leaderboard. High scores will be viewed on- and offline

Online co-op would be cool too. But currently that's not going to happen :-). Maybe when the game is finished and I have some free time left. I've never done anything like that before so it'll be a hard ride.

Anyway, for those of you who like to know here's some technical information.

* KrasEngine is written in C++
* SDL is used for the multimedia part
* The game itself is written in C++ and uses KrasEngine and SDL
* Development environment is a Ubuntu 7.10 workstation with a Intel Core 2 Duo 2,2ghz with 2gb's of ram and a 256mb nVidia 8400 GS graphical card.
* The game doesn't have a fixed frame rate. Instead, it uses frame rate independent movement. So the games runs as fast as on 60fps as it will as 230fps. Meaning that objects will always move the right amount of pixels.
* Resolution is 640x480, just like the DIV game. Upscaling graphics is ugly and when run in a window it's still nice.

When I get my laptop back I'll be compiling it for Windows XP (will test it later on Windows Vista). By then I can test how efficient the game engine is and if it'll run nicely on other machines.

The only thing I'm concerned about is the method I'm using to check for collisions between objects. But that's something for the forums :-).
(Posted on December, 27th 2007, 19:35)

Comments


Eckolin said:
You can add variation through colour cycling :P
(Posted on December, 27th 2007, 21:13)


Htbaa said:
Just found out about SDL_SoftStrech(). It allows me to resize any surface. Which can be cool to support more resolutions. 640x480 could be changed to 320x240 or 800x600 or 1024*768. Downside is when you're upscaling, it doesn't get any prettier. Oh well, still a very cool feature :-).
(Posted on December, 31st 2007, 13:40)

Post New Comment

You must log in or register to post comments.

Copyright © 2005 Booleansoup.com
Questions? Comments? Bug reports? Contact us!