User Tag List

Results 1 to 6 of 6

Thread: Line of sight implementation possibilities

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Dec 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Line of sight implementation possibilities

    Hello there!

    So recently I have been checking out the line of sight implementation.
    I managed to get it working while using an active object that acts as LoS.

    The way I did that was by using "on each one of Enemy, loop name X" function but here is my question, is there a way to implement it in an easier way?
    For example could I just use abs() without iterating over each enemy all the time? ( to save up potential memory used for that even though it is probably minimal ).
    I'm asking that because without iterating over each enemy every frame I end up with all enemies shooting together when I get in LoS of one of them.

    Too long didn't read version: Is there an easier/more readable way to implement Line of Sight for enemies without having to iterate over all of them in such a complex way :P

    I am including my project file ( or the link to it because it takes 2.5mb with 1mb allowed :< ) which hopefully will help people understand what I am trying to change. ( the shooting function is in behaviour of enemy object )

    https://drive.google.com/open?id=1CJ...RP_GAYksYYpMbe


    Edit add: Maybe using qualifiers would be a better way to go?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    briefly checked out the attachment,
    if you just need to check wether the ship is in the same line (roughly same Y) as the enemy,
    then indeed checking Y's would be enough

    i.e.

    Y(enemy) >= Y(player) -5
    Y(enemy) <= Y(player) +5
    >>> (enemy) shoot

    line of sights are generally used when you need to determine occlusion (if there's something between the player and the enemy or if the sight is "clear")
    and when there's chance for non strictly orthogonal positions (enemy can travel all around player)

    but not sure what you need it for exactly?

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Dec 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried the method you mentioned but with using abs().

    I put something like abs(Y(enemy) - Y(player)) <= 5 so its similar to what you mentioned but in easier for me to "read" format.
    The problem with that is:
    -when used in event editor or as behaviour it makes all enemy shoots if the condition is fulfilled ( it seems like the condition is being checked for the first or last enemy created so you could say that it ignores the other instances for some reason )

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Yeah, that's why I didn't suggest the abs() solution

    unfortunately you can't directly check "compare two general values" conditions on specific instances (unless: see below),
    you can only use conditions you find in the object's own menu to perform "instanced" comparisons (performed taking into account each single object)
    so the code I was suggesting above should do the trick because directly uses "compare Y position" condition, which is "scoping"


    OR you can launch a "foreach" loop and use abs()

    i.e.

    always
    >>> run loop on each one of "enemy"

    on each one of "enemy"
    >>> do the abs() comparison

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Dec 2014
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh god the solution is so simple yet I overcomplicated it as always xd

    Thanks for showing me the easier way to do it, foreach would work as well but I feel like just the Y coordinate check is better personally.
    I have so many hours in CF 2.5 and I had no idea how to tell the difference between which events could be called per instance and which couldn't but now I see that only the events I can get from the "event list" for active object will work like that.

    Such a simple thing yet it caused so many problems xd

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    No worries, we've all gone through that

Similar Threads

  1. Line of sight
    By DemonD in forum Fusion 2.5
    Replies: 10
    Last Post: 24th July 2014, 11:49 AM
  2. Best line of sight AI?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 8th June 2013, 04:23 PM
  3. Line of Sight
    By Uzalu in forum Extension Development
    Replies: 1
    Last Post: 5th December 2009, 10:52 PM
  4. Line of sight
    By Beginier in forum File Archive
    Replies: 4
    Last Post: 24th June 2009, 05:40 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
  •