Shmup

Updated!

I've been working on an arcade-style shooter using SDL for setup, OpenGL for graphics, Box2D for physics, TinyXML for data, and a custom component database system for object data.

Box2D was exactly what I needed, and has been instrumental in the development of my game project! I don't do anything fancy with rigid bodies or joints, so my project doesn't really show off Box2D's power as a physics engine. However, Box2D has worked out fantastically as a collision detection and resolution system, giving objects "solidity", performing bullet hits, and collecting nearby objects for AI target scans and explosion splash damage. I'm using the revision 155 now, with a few customizations due to using pixel units. The game uses continuous collision detection for fast-moving bullets, and Box2D has definitely made development a lot easier. It runs quite fast even with a remarkably large number of collidable entities roving around.

I don't have a website for it, so I've been hosting files and images on my network-attached storage device at home and posting updates on my livejournal. The images look blurry because I have 8-sample motion blur enabled.

Image
Image

I added a visual profiler a while back showing what portion of a 1/60th second frame each system uses. AI logic (using b2World::Query to find targets) is red, simulation (applying forces) is yellow, physics update (b2World::Step and processing contacts) is green, update (weapons, spawners, links) is blue, rendering (OpenGL commands) is purple, and drawing (OpenGL busy) is grey. Even with almost 500 collidable objects, Box2D consumes only a small fraction of a frame. The eight render passes clearly dominate the frame time. 😀

Image

I've been making playable builds (updated to build 43) and source code (updated to build 43) available. The playable builds unfortunately require the Visual C++ 2008 Redistributable Package, but that only needs to be installed once.

I recommend running full screen for the best effect, using either -fullscreen 1 or pressing ALT+Enter. At some point I'll add a configuration file so this won't be necessary.

To change screen resolution:
-resolution <width> <height>
Pretty cool! I actually downloaded it and gave it a quick play. Looks and runs great on my system at 1280x1024 (I set the resolution). I'm looking forward to checkout out the progress on this.

My C++ is a little rusty since I've been doing nothing but ActionScript3 for a while, but couldn't you use constants for all the hex values that have comments after them? Also it would be nice if Esc exited because I had to alt-tab out. It would also be cool if there were at least some placeholder sounds in there. I'm not sure how much of a hit that would have on performance, but it could be important for profiling purposes.
Glad you like it. If you've played a lot of classic arcade games, many of the enemies should seem... familiar.

I have a utility program that generates hash values from strings using the same FNV-1a algorithm as the game itself. I just select some text, press a key combination, a commented numeric hash prints in the Visual C++ output window, and I copy and paste it into code. It's pretty easy. 🙂

You can exit with the Windows-standard Alt+F4, by the way. It'll eventually have some sort of shell, but for now I use ALT+F4 or the close button on the window.

Sound is fairly high on the list of things that need doing, though I want to make sure the sounds aren't annoying. I need to spend some quality time with MAME and rip some sounds from the same games I got the enemies.
Cool! Let me know (PM) when the game is done and I'll post a link.
It's an ongoing project, so it won't really be "done" any time soon. It's fun enough as it is, even though there's no score, no lives, no objectives, and no structure--just a player-controlled ship and an endless stream of enemies. 😀
I finally added sound to the game, and that really helps make it feel like a game even though it lacks higher-level concepts like score, lives, objectives, or missions. It's certainly fun to play with for a few minutes, though. 😀

Win32 build here
Source code here
Another new build, this time featuring score, turrets mounted on enemy Carriers, a newer version of Box2D (SVN revision 88), an input binding for the Xbox 360 controller, and a few other tweaks.

Image

Win32 build here
Source code here

I'm starting to come to the conclusion that it needs some balancing. I tried to mix the high-speed pacing of classic arcade games with some of the enemy ship and shot density of "manic" shooters, and the result is extreme difficulty. Reducing enemy ship and shot speeds might help so the player at least has a chance to react.
I figure it's about time to post a newer version, as I've made a lot of additions and improvements since build 32: more evasive AI, variables in draw lists, Defender/Stargate-inspired player bullets and "smart bomb", improved sound mixer, aiming crosshair, single-frame step (Shift+Pause), Warrior ship from Sinistar, better Aimer target leading, lots of level tweaks, performance optimization, input recording and playback, and the latest version of Box2D.

Image

Image

Image

Win32 build here
Source code here
I'm reluctant to bump my own topic, but I've been busy lately making functional improvements to the game engine. I've cleaned up a lot of messy code and applied significant optimizations to some of the top functions.

In addition, every command-line argument except simrate now functions as a console command (open with `). You can now change resolution, multisampling, primitive smoothing, vertical sync, camera view size, sound channels, and sound volume, as well as load input bindings and level data, record and play back input. The readme.txt file contains details on these.

I also started hosting the images, builds, and source on the WWW share on my NAS instead of the FTP share. I only used that because it was the easiest way to send files home when I was out of town, and didn't really plan ahead for any sort of popularity. The WWW share seems a lot faster and more reliable even connecting locally. It's also read-only. 🙂

There's also a few level changes in there for good measure.

Vapor Mines now explode into shrapnel:
Image

Everything else explodes nicely, of course:
Image

The player ship's has a new warp-in effect, though that's hard to show in a still image:
Image

Win32 build here
Source code here
This continues to improve. Looks great!

Bill

Original thread: https://box2d.org/forum/viewtopic.php?t=301