Archive

Posts Tagged ‘Ludum Dare’

More BSP Fun

November 6, 2012 Leave a comment

I finished up a quick little game for xbox live indie games (more about that later), and for my next game I’m interested in using my bsp libraries. I’ve used them in the last 2 or 3 Ludum Dare competitions and each time added a tiny bit of functionality, but in the past week or so I’ve been giving them a good tuning.

The first thing I’ve done is make an addon for Quake Army Knife that uses the flags and entities that I use, and gotten rid of all of my Quake and Valve map format code.  It is tremendously cleaner now, having pruned at least 1000 lines of code, and I was able to get rid of some of the hacky stuff on my build gui.

The valve format code was aging and full of hacks (like I used their smoothing groups to pass game specific flags in), but the quake stuff wasn’t very good either.  The quake 3 flags were sort of half working, and there was still a ton of flag setting via checking texture names, which has bitten me several times with obscure bugs.

Using QuArK and having control over my flags and map format has made setting alpha transparency levels and stuff like cellshading possible without hacks.  Some interesting combinations of flags also let you do stuff like a solid object which doesn’t block light.  The basic addon is set up with 16 User flags that are easy to change to something game specific if you want special contents (like most games have water or lava etc).

Once that was working I started working on properly supporting brush models.  These are things like doors and moving platforms.  The legacy genesis build code extracted them and built bsps for them, but I had never really used them and didn’t draw them.

Getting them rendering complicated the map grinder somewhat, and I had to get the baked lighting to behave with transforming the ray into the model’s frame of reference, but everything is drawing almost perfectly.  The one thing I am not doing is alpha surface splitting for moving alphas.  If two large alpha surfaces come into contact, they won’t sort properly.  But as programmers are fond of saying “don’t do that”.

I’ve also made models self shadow properly, but this will look a bit strange if the model is moving.  Best to use flat shading on moving stuff.

The existing box based collision routines already work with models, all I had to do was test vs models in the raycast and return the shortest impact.  My initial tests were sans proper origined models though, so I still have that to do (have to keep track of inverted matrices for every model matrix).

Once the basic collision stuff is using origined models, the tricky stuff begins.  Like making a moving bmodel push an object, or letting an object ride on a platform, or what to do if an object is smashed into a wall by a moving bmodel.  Quake has a bunch of pre-determined behaviors that can be set per model for this.  I’m not sure what I’ll end up doing.

For December Ludum Dare I plan to use small 4×4 solid textures for everything.  This makes it quick to get up and going, and if used with cellshading it looks pretty good.  I got 97th out of 1400 on the visuals for LD24 using the cellshading / lightmap stuff.

Categories: Uncategorized Tags: , , ,