Tabletop Simulator

Tabletop Simulator

Not enough ratings
Scripting Example - Recursive Tile Traversal (Part 1)
   
Award
Favorite
Favorited
Unfavorite
Assets: Scripting
File Size
Posted
Updated
149.419 KB
3 Dec, 2016 @ 12:12am
27 Jan, 2017 @ 2:48am
4 Change Notes ( view )

Subscribe to download
Scripting Example - Recursive Tile Traversal (Part 1)

Description
I made this tutorial to illustrate how to use recursion to find objects that are adjacent to each other. This can be useful for tile laying games.

I used similar methods in my mod, Carcassonne:

http://steamproxy.net/sharedfiles/filedetails/?id=779900330
5 Comments
Averis 4 Feb, 2020 @ 9:04pm 
Oi Sancho!
I have a interested project idea if you could read the following.

What if you had a "ring". This Ring is the "viewport" of the "World"... Now , stick with me here.
What if you could program where that ring has a "position" it knows, and that it can scroll around via moving objects in a relative location to the edge of the ring's theoretical "position".

What it actually is doing is a math trick, where it has objects saved in a relative matrix and is calling those objects and placing them within the relative zero of the ring.

What it results in is a "scrolling map". A map that you can scroll and if then paired with a minimap 'which is merely a image' you could theoretically have the foundations for making a huge world map for roleplay games.

Is this seemingly Viable in your opinion?
Sancho  [author] 15 Feb, 2017 @ 11:33pm 
This is meant as a tutorial on how to do recursive scripting. If you don't have any interest in scripting there's no reason to subscribe to this.
cG. KCIV 15 Feb, 2017 @ 7:36pm 
So what does this mod do?
Sancho  [author] 27 Jan, 2017 @ 2:53am 
To those interested, I've uploaded a new version to correct a major issue. The findXDeepNeighbors function was not working correctly because it was doing a depth-first search and marking those tiles as read. This blocked the path of subsequent calls and so not all of the neighbors at that depth were found. The new solution doesn't use recursion. Sorry about that!

I also added another example of how to find the shortest path between two tiles. These tiles are highlighted green and red.
Tragic 3 Dec, 2016 @ 1:51am 
thanks.,... i'll look at this as soon as I get a chance!