Cast Hard Shadows for a Dungeon Crawl

I just kind of use Blender for fun, so I’m not very experienced with it. Here’s what I’m looking for:

I had an idea to make a top down Dungeon Crawler, and want the walls of the dungeon to cast shadows on the opposite side the player is on, completely covering, and making unclickable the terrain, loot, mobs, etc. Now I know that blender has its own lights, which can be blocked off by the walls themselves, but I was thinking of trying to create quadrilateral plains with two corners on the walls edges, and the other two far away enough to cover the whole camera view, and the sides would be parented to bones which turn to be perpendicular to the player. Since the plain wold be above everything, it would effectively make it invisible, and unclickable. Blender shadows, might not be able to fit that bill.

Which would be the best route to take? Creating a trapezoid for every wall segment would liekly take alot of processing power, even if i could code to remove them unless they’re within a specified distance of the player. Would it be easier to make objects unclickable by creating some sort of check if they have an unobstructed line to the player?

Or, is there some other approach?

Sorry, If I’m confusing, I often word things strangely.

Can you use python? There are ways of making a dungeon crawler using a grid based system (see my sig) but it’s not easy.
If you’re not using grid based movement a good and simple way to make areas and monsters only visible when the player has a line of sight is to use ray casting. Cast a ray to each monster in range of the player, if it hits a a wall before hitting the monster set the monster visibility to False, else set it to True. You’ll need to know a bit about python to get it to work. I can point you in the right direction to the scripts if you’re interested in that approach. If you’re interested in coding a dungeon crawler there are a lot of resources out there if you know where to look but t’s not easy using logic bricks alone.

Something like this? (If the environment is black)

Things could fade in and out, as well as have logic only active while visable.


Well, I haven’t used code in probably a decade, and I don’t know the first thing about python.

Plus I was kind of hoping to cover lit areas from torches if it’s out of sight, but maybe that’s too zealous of me. Forgot to include that. Example:

@BluePrintRandom Sorry, I’m such a newbie to Blender that I have no idea what’s going on in your blend file. I just fool around in blender at a very basic level.

I think you should definitely start brushing up on Python. Both your lighting system as well as a dungeon crawler type of game would greatly benefit from Python scripting.

EDIT: Okay, I think I got it. It’s kind of a complex system, since it’s not just darkening / obscuring areas, but also making them unavailable to click in.

There’s a few ways this could go; spawning black planes that are stretched might work alright, since there’s only so many walls and shadows on screen at any given time, and you can use one plane for multiple cells.

You might also be able to go with a single plane over the scene subdivided thoroughly for a face over each roomcell, and use vertex colors darkening certain faces and lightening others. You would loop over each face to darken or lighten its vertices depending on if the player’s there, if he’s been there already, etc.

Of course, these approaches would basically only work if the view is completely overhead and has no perspective. Otherwise, you would have a more complicated approach on your hands.

An easy method to do this would be to

  1. Rely on Blender’s lighting system to light the scene,

  2. Use a spot light with a wide radius over the player to imitate a point light,

  3. Use invisible walls to cast shadows (a new feature for materials in a recent build of Blender) so that the spot light can be considerably above the player’s head, and

  4. Use raycasts from the mouse to the player to determine if there’s a straight line from the clicked point to the player (or if the area’s already been explored).

If you want to do kind of a fog of war type of thing, it’s more complex, and would probably do well to have one of the above methods (vertex color with planes or a lot of cubes in a single mesh, perhaps).