User Tag List

Results 1 to 10 of 10

Thread: Polygon-based Shadowcaster

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Polygon-based Shadowcaster

    A simple (only 4 events) polygon-based shadowcasting engine, for realistic lighting / line of sight.

    Objects which cast shadows must have the qualifier "Shapes".
    Also, their first alterable string must contain a list of vertexes which defines the object's shape. Each vertex is separated by semicolons, and X and Y coordinates are separated by commas (x1,y1;x2,y2;,x3,y3...).

    eg. "0,0;32,0;32,32;0,32" would represent a 32x32 square.

    Note that coordinates are relative to the object's hotspot.

    MyShadows.mfa

    MyShadows.jpg

  2. #2
    Clicker Fusion 2.5 DeveloperiOS Export ModuleSWF Export Module
    XStar's Avatar
    Join Date
    Feb 2012
    Location
    Winchester, VA
    Posts
    1,165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is really cool!

    Thanks for the example!

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Re-written at the request of "Johnny", to use the String Tokenizer extension, which ought to make it Flash compatible (though I have no idea about performance).
    Also tweaked it a little - the previous version was drawing shadows about twice as long as they needed to be, which may have made it slower than it should have been.

    MyShadowsST.mfa

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jun 2007
    Posts
    480
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thx

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you swapped String Parser for String Tokenizer, you'll only have better results. Parser is quite bloated due to all the extra features it has. Tokenizer is nice and lightweight.

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I was using Quick Token (more lightweight and less buggy). I seriously doubt it makes any real difference to performance anyway - what I meant was that the example might be slow in Flash (whichever extension is used). There's still plenty of room for optimization though...

  7. #7
    Clicker Fusion 2.5 DeveloperSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,739
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Hi,

    This is a very nice example but I'm afraid it won't work in Flash because Surface's Flash port is pretty barebones. Also, there is some kind of bug with graphical extensions in Flash that makes them leave the screen as soon as you start scrolling (I'm not the only developer who has noticed this)... Unfortunately I don't have that much free time to fix stuff like this right now.

  8. #8
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Not to worry (I don't even have the Flash exporter, so it doesn't affect me).

    I am having another problem with the surface object though - I'm finding it impossible to blit just a small area of one surface object onto another. I've tried setting the source & destination positions and sizes (on both objects), but whatever I do, it always copies the entire image

  9. #9
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think there's an action/property that tells it to use the specified size rather than the whole image, but it's been a while since I checked.

  10. #10
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,305
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Thanks - I think that was part of the problem. I did eventually get it working, basically just through trial and error (it's a lot simpler with the overlay extension).
    Anyway, I've ended up writing a custom pixel shader to achieve the effect I wanted instead (which was to create a 1-pixel gap between individual tiles in a tileset image).

Similar Threads

  1. Box2D polygon problems...
    By Ethan in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 9th April 2011, 04:03 AM
  2. Box2D Polygon Not Clockwise?
    By Jacob in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 19th October 2010, 07:31 AM
  3. Stats Polygon
    By dj_tommy_k in forum File Archive
    Replies: 1
    Last Post: 19th March 2009, 08:21 PM
  4. Overlay polygon plotting example
    By Tiles in forum File Archive
    Replies: 0
    Last Post: 7th April 2008, 10:18 AM
  5. polygon collision
    By Bruto in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 3rd December 2007, 11:57 AM

Posting Permissions

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