How far can you make it? Battle through randomly generated lands and 1000 randomly generated dungeons. Slay monsters, gather resources, and craft new an powerful weapons. All to see just how far you can go. Die in dungeon 999? Start over from one. This is a war of perseverance.

Report article RSS Feed Shadow and Light Part II

The completion of the discussion about the shadow and lighting in the dungeon. Includes a video of the shadows in action.

Posted by TheCherryMama on Sep 28th, 2013

At the end of part I we had the shadows moving with the player, and more or less conforming to the space and shape of the walls, but as the player moved toward the end of the screen, the shadows would completely disappear.



The problem turned out to be with how I was determining the area to select from.  I was using the basic code in the existing pick area method of the composite sprite, and tweaking until I got the correct values.  The basic algorithm is:

1. Convert the AABB of the current scene render state to an OOBB

2. Calculate the inverse of that OOBB using the batch transform of the composite sprite object that is the shadow map.

3. Convert that inverse OOBB to an AABB.

4. Perform a query area on the composite sprite using the AABB, that does NOT target the OOBB of the individual sprites.

The last part, not targeting the OOBB of the individual sprites, was the key to getting the pick are to always return the proper objects based on the position of the player, which the map tracks as the player moves.

Here is a video that shows the shadowing in action.  This video includes the dynamic light radius that is in the game also.  In the video, the light radius is the minimum and would represent going into a dungeon with no torch or other light means.  Equipping a torch gives you a larger view radius and you can use certain objects to change the light color.  this can have an effect, positive or negative, on certain monsters.

We have added video on our blog, or on You Tube

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
1000 Dungeons
Platforms
Windows, Mac, Linux
Engine
Torque 2D
Contact
Send Message
Official Page
Bloodytongue.com
Release Date
TBD
Game Watch
Track this game
News
Browse
News
Views
77 (1 today)
Report Abuse
Report article
Related Games
1000 Dungeons
1000 Dungeons Indie Single Player Roguelike
Related Engines
Torque 2D
Torque 2D Commercial Released Dec 31, 2004
Related Groups
Bloody Tongue Games
Bloody Tongue Games Developer with 2 members