Hello!
I am back in action, so i must start with a complicate question eheh!

I started reading some tutorials about FoV (field of vision) in 2D tilemap, and i was asking myself if it would be possible to set up something like that in Makinom.
I think there are all the tool in the framework, but i think some help pointing me in the right direction. What i woudl like to achieve is:
- the player move by 1 tile
- the map is updated with new position
- all adiacent tiles (let's see a 5-tile radius are lightened)
- if there are obstacles, like monsters/objects/walls, the tile behind aren't showed
(- facultative: have a different visibility of discovered tiles but out of LoS)

Let me link some images for a better understanding:
image
image


I tried some Asset Store Assets that achieve this, but the biggest problem would be the integration with Ork, so i was asking myself if it would be possible to set up such a system without 3d-parties...

Thanks in advance, have a nice day!
Kaem
  • You'd have to implement a field of view algorythm, e.g. going through the level around the player using variable loops (like in the 2D Roguelike level creation) and probably raycast nodes to check for obstacles.

    If you already have a 3rd party asset that does that, it might be easiest just calling that functionality with Function nodes or writing your own schematic for that.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for the tips! Unluckily these Assets use Fov in their system, so it is quite difficult for me to rip it off. :-)

    I was thinking about sending raycast at 360 degrees, see if the ray hits something solid, and change material for every tile hit. So my biggest problems are:
    1) Shooting rays for 360 degrees, is there a way to do it with one step only?
    2) Record all tiles between the player and the obstacle, or max distance if reached... Concering this is it possible to store each object hit till a specif one, like every walkable tiles till the obstacle?

    Thanks a lot Gil!
  • There are's the shapecast node for that, e.g. casting a sphere.
    Another solution would be raycasts from above on all tiles around the player - similar to how it's done in the Match3 tutorial for finding matches, where each tile checks it's neighbours (and blocked don't check further).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Oh i will have a look and see if i can carve out something good! Thanks! :-)
  • edited March 2016
    Okey, it is quite complicated... :D
    I was thinking about shooting from each tile (to the player) inside a range and see if that collides with an obstacles. But i cannot set up raycast properly: how can i set the direction / lenght of the ray from the tile to the player and check if inside there is a solid object? I am losing myself with all these parameters. ^^
    Also, i didn't understand shapecast. Can i store somehow all tiles not hit inside the area (blocked by obstacles that are nearer to the player)?

    Oh, almost forgetting... How can i set a variable as a distance between two objects (usually player and machine object)? I cannot get it.

    Sorry GiL but i would like to understand how to apply FoV to 2D tiled environment. :)
    Post edited by Kaemalux on
  • edited March 2016
    https://www.assetstore.unity3d.com/en/#!/content/25933

    Maybe try using this asset as a means of using Field of Vision/Line of Sight? Seems to come highly recommended and I've been tempted to give it a go a few times. I haven't tried it before, but I'm guessing that it that it'd be possible to hook into it from Makinom/ORK.
    Post edited by Kirb on
    Tactics RPG Grid Battle System for ORK
    ---------------------------------------
    Personal Twitter: https://twitter.com/AMO_Crate
    I make RFI! https://twitter.com/NootboxGames
  • Thanks Kirb! Actually i already have that Asset, pitifully the grid effects about light and shadows is not achievable (yet?)... I hope to find an Ork solution, i am not able to script my own system by coding... :-)
  • edited March 2016
    There are a lot of different FoV algorythms out there that you'd just have to set up using Makinom.
    E.g. this article gives a good understanding for the available methods (they generally have a lot of great articles :D).

    I'm currently lacking the time to do a tutorial on this :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks! I know you are really busy, no need for tutorial, if you can just answer when you log into the forum it is perfect. :-)

    I thought about shadowcasting, so i was wondering if there is a way to calculate in Makinom an opposite direction between an object and the player...
    If i can do that i think i will be able to shoot a ray in that direction and change all tiles found.. But i cannot understand which schematic step can store me a direction (line between player and object), is it possible? Thanks a lot. :-)
  • Isn't the opposite direction just switching the object and player in the calculation? :)
    You can calculate the direction by subtracting the origin's position from the target's position. I.e. changing store the target's position as a Vector3 variable and sub the origin's position from it.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I noticed, in Unity, there is a linecast that can be shot between two points. I think it could be a good solution to shot a linecast between the tile and the player and see if there is something "solid" in the path... Is that achievable with Makinom?

    About direction, sorry but these vectors are making me crazy. :D
    So, if i subtract vector 3 player position from object position i get the direction of the ray? Where should i use that in the raycast settings? I don't know yet if i am using shadowcast approach, i think it would perform better if i found all solid objects in the range and cast from them rays to hide all tiles behind.

    Thanks a lot for the help. :)
  • edited March 2016
    Yes, that's possible in Makinom - just use a Raycast node and use the Value Position raycast origin. Now you can just use Vector3 values (e.g. position of a game object) to define the start and end of the raycast (e.g. from player to tile).
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.