STAR TREK 2d20
Page 5 of 8 First ... 34567 ... Last
  1. #41
    According to the rules of every tactical system I've seen, tokens next to each other have a distance of 1 grid unit between each other.

    For auras, since the distance is from center of nearest grid unit encompassed by source token to similar center of grid unit on target token, then the aura effect should still apply. (i.e. If aura is 10 ft., then the target must be "within" 10 ft; not adjacent to 10 ft. That means that any token with 2 grid units (assuming 5 ft. per unit without diagonal multiplier) would be affected.) This is also assuming that auras radiate from the edge of the creature, rather than the center. (which is vague in most game systems)

    I'm looking at the functions right now. And other than what appears to be some sort of rounding bug that I'm investigating on maps with non-integer grids, the calculations are correct.

    Regards,
    JPG

    EDIT: And the rounding issue affects all distance calculations, not just the API version.
    Last edited by Moon Wizard; February 7th, 2021 at 22:38.

  2. #42
    With example pictures with an underlay (i.e. aura) of range 2 grid units.

    JPG
    Attached Images Attached Images

  3. #43
    Quote Originally Posted by Moon Wizard View Post
    The Unity cross-platform engine that we built FGU on uses their own implementation of .Net; and they currently support .Net 2 / .Net v4.x

    Regards,
    JPG
    Since you seemed interested in the idea of moving forward from the old Framework 4.6 version I figured I'd ping this topic again in case it got lost in the shuffle. The following excerpt from the Unity Docs clarifies that .Net Standard 2.0 is presently supported and recommended (in addition to, and distinct from, the legacy .Net Framework 2.0):

    "Stable scripting runtime
    The stable scripting runtime supports two different profiles: .NET Standard 2.0 and .NET 4.x. The name of the .NET Standard 2.0 profile can be a bit misleading because it is not related to the .NET 2.0 and .NET 2.0 Subset profile from the legacy scripting runtime. Instead, Unity’s support for the .NET Standard 2.0 profile matches the profile of the same name published by the .NET Foundation. The .NET 4.x profile in Unity matches the .NET 4 series (.NET 4.5, .NET 4.6, .NET 4.7, and so on) of profiles from the .NET Framework.

    Only use the .NET 4.x profile for compatibility with external libraries, or when you require functionality that is not available in .NET Standard 2.0."
    My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
    My GitHub: https://github.com/MeAndUnique
    Buy me a coffee: https://ko-fi.com/meandunique
    Discord: MeAndUnique#6805

  4. #44
    All I know is that System.Text.Json does not resolve in the Unity project; and throws a compilation error. So, that means that something isn't supported somewhere. Unfortunately, this is low priority; so it's not something I plan on spending a lot of time investigating.

    Regards,
    JPG

  5. #45
    Oh, for sure, not worth hunting down for Json. The engine upgrade itself may be worth it for performance improvements (you have to manually switch to .Net Standard). It does have a small risk of requiring additional changes, depending on what libraries FG currently leverages.
    My Forge creations: https://forge.fantasygrounds.com/crafter/9/view-profile
    My GitHub: https://github.com/MeAndUnique
    Buy me a coffee: https://ko-fi.com/meandunique
    Discord: MeAndUnique#6805

  6. #46
    We use a lot of libraries; probably not worth the risk. Especially since we're deep in vision/lighting updates.

    Regards,
    JPG

  7. #47
    What's wrong with the existing Unity JSON utility? Granted it may not be as feature heavy as system.text.json, but it's at least optimized for Unity.
    aka Laendra

    (Discord: Laendra#9660)
    Ultimate license (FGC/FGU)
    Current Timezone : Central (CDT) (GMT -5)
    OP: 3317036507 / 2369539

    My opinions are my own and represent no entity other than myself

    Extension Support Discord: https://discord.gg/gKgC7nGpZK

    Extensions = risk to your gaming experience. If you haven't tested out the extensions in your campaign before your gaming session, turn them off. If you don't backup your campaigns regularly, you're doing it wrong.


  8. #48
    This is the built-in Unity JSON serializer:
    https://docs.unity3d.com/Manual/JSONSerialization.html

    You must have a serializable class with the exact same structure as the JSON you are trying to load/save. It is not a general purpose serialization library; but designed to load/save specific Unity object data.

    Regards,
    JPG

  9. #49

    Join Date
    Nov 2020
    Location
    Seattle, USA
    Posts
    161
    I'm trying to use the imagecontrol getDistanceBetween and getTokensWithinDistance and I find that if I pass in numeric values they seem to always be calculated as if they were 0, 0. Below are some results with two tokens which, according to the targeting arrow, are 15 feet apart. getDistanceBetween correctly returns 15 if I pass in the tokens, but 0 if I pass in their positions. I'm using FGU and Pathfinder 1e.

    Of course, this is my first foray into working with any sort of positional data in FG, so I may just be doing something wrong.

    local srcToken = CombatManager.getTokenFromCT(srcActor.sCTNode);
    local tgtToken = CombatManager.getTokenFromCT(tgtActor.sCTNode);
    local srcImage = ImageManager.getImageControl(srcToken);

    Debug.chat("srcToken: ", srcToken);
    Debug.chat("tgtToken: ", tgtToken);
    Debug.chat("srcImage: ", srcImage);

    local srcX, srcY = srcToken.getPosition();
    local tgtX, tgtY = tgtToken.getPosition();

    Debug.chat("srcToken to tgtToken: ", srcImage.getDistanceBetween(srcToken, tgtToken));
    Debug.chat("srcX, srcY: ", srcX, srcY);
    Debug.chat("tgtX, tgtY: ", tgtX, tgtY);
    Debug.chat("srcX,Y to tgtX,Y: ", srcImage.getDistanceBetween({srcX, srcY}, {tgtX, tgtY}));

    s'srcToken: ' | tokeninstance = { { container = image.id-00002.image, id = 16, x,y = (275.0, 25.0)} }
    s'tgtToken: ' | tokeninstance = { { container = image.id-00002.image, id = 12, x,y = (100.0, -50.0)} }
    s'srcImage: ' | imagecontrol = { name = s'image', x,y,w,h = 1,37,1068,945 }
    s'srcToken to tgtToken: ' | #15
    s'srcX, srcY: ' | #275 | #25
    s'tgtX, tgtY: ' | #100 | #-50
    s'srcX,Y to tgtX,Y: ' | #0

  10. #50
    If you are passing numerical values, they must be of the form of a Lua table with "x" and "y" indexes pointing to the X,Y values you want to measure to/from.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Log in

Log in