Totally forgot to post yesterday, ah well. I made a lot of progress, but the only thing I specifically remember doing was adding the first sound effect – and I only remembered that because when it played this morning I scared the bejezus out of myself 🙂
Today I finally managed to get the field-of-view ‘shadows’ working. I’m quite pleased with the results, though the interaction with objects in the rooms could be nicer. As is often the way I went through several really complex methods that sorta worked before finding a nice, if brute-force-y ~50 line method that did the job perfectly.
The floor texture is modulated/blended with a series of light textures (radial gradient fading from opaque in the centre to transparent at the edges), one placed on the player, and one in each room (if the light is turned on). The field-of-view is generated by casting a bunch of rays out from the player in a circle, building a triangle fan from the results, and using it to mask the floor.
The objects in the rooms unfortunately can’t be rendered using the same method as they cause the floor texture to show through them, so for now I just make them visible (without blending) if any of the rays go through their tile.
We’ve nearly got the level generation integrated, it still needs a couple of fixes but once those are done I’m sure I’ll discover a boatload of issues that just don’t happen to appear on my simplistic test level!
Only other things after that are:
- allow the player to hide inside objects
- add audio cues to the environment (creaky floorboards etc., to give you some idea of where the beastie is, especially while you’re hiding in a cupboard!)
- add a few more sound effects
- add a lot more furniture tiles
- implement final text
Right now, that doesn’t seem too bad.. though perhaps I’ll change my mind when the new levels start destroying everything!