User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 12 of 12

Thread: How would you mask a light source?

  1. #11
    Clicker Fusion 2.5 Developer

    Join Date
    Feb 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How would one use the pathfinding extension to do this? I've thought about it, but can't quite wrap my head around the concept. Let's say I want to do the circle of light thing like in the images I posted, would I have to find a path to each of the tiles surrounding the player? I imagine this would be a very expensive operation to do each time the player moves.

  2. #12
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Yes, it is an expensive operation, but so are the alternatives. Calculating a field of view is never going to be computationally cheap - and it's all relative...
    Realistically, Andos' shadow-casting example is far too slow to use in an actual game - but maybe in a tile-based game, where each tile becomes 1 pixel in a surface object, it could be fast enough. Certainly, if you only have one light-source, shadow-casting can be very efficient (I have a couple of examples at www.sketchy.co.nf ).

    It does depend a little on what *exactly* you're trying to do. Lets say you have a lamppost (light-source), a player with a flashlight (also a light-source), and a monster (not a light-source) - plus various obstacles scattered about. Logically, for the monster to be visible to the player, you would need a clear line of sight from the monster to the player, plus if the player is too far away for his flashlight to illuminate the monster, there would need to be a clear line of sight from the monster to a lamppost which is close enough to the monster to illuminate it. You're probably going to be using the pathfinding extension to figure all that out anyway, so why not do both at the same time?

    In a tile-based game, you can probably get away with doing it any way you like - you only update the field of view when the player moves from one square to the next (unlike in other games where you'd have to do it every frame), so even if there is a small amount of lag, it's not going to be very noticeable.

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Collision Mask Help?
    By Eliyahu in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 3rd April 2011, 07:24 PM
  2. Light?
    By Gunnar in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 24th January 2011, 09:08 AM
  3. Light Gun?
    By Cookie in forum Extension Development
    Replies: 20
    Last Post: 31st October 2006, 05:40 PM
  4. Bug: Collision mask
    By Sphax in forum File Archive
    Replies: 0
    Last Post: 11th August 2006, 01:48 PM
  5. Light Source
    By 00J in forum File Archive
    Replies: 27
    Last Post: 4th July 2006, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •