90 likes | 216 Views
This tutorial guides you through creating a path-finding object in Second Life (SL) that successfully navigates toward a destination while avoiding obstacles. You'll learn to mark positions on a designated piece of "open" land, prepare obstacles, and establish communication protocols. The server acts as the central hub for simulation activities, calculating the shortest path while considering obstacles, and relaying necessary information to the agent. Relevant server code will also be provided for implementation in Visual Studio 2005.
E N D
CS590VC – Tutorial 12 Simulating a Path Finder in SL
Preparing the ground • We create an object that will find its way to destination by avoiding obstacles • We mark 9 positions on a piece of “open” land • We then note down the 3-D co-ordinates of these 9 positions.
Preparing the obstacles • Create 9 flat pieces and place them at the 9 positions that you have marked • Create a controller that sends warning signals to these 9 flat pieces • Paste the script “controller_script.txt” behind the controller • Paste the script “pos_script.txt” behind each of the 9 pieces
The agent-server communication • The server is the center for all simulation activities. • The server receives a request signal from the object (agent) which asks for the next best position to take in order to reach the destination. The current position of the object has to be given. • The server then randomly selects a position and blocks it (sometimes it may not wish to do so as well) • The server then calculates the shortest path to the destination eliminating the blocked node and all the paths going through it. • The next position to be taken along that calculated shortest path is given back to the object (agent)
The controller-server communication • The server is asked for blockage information periodically by the controller. • If there is a blockage then the controller uses a designated channel to broadcast the blocked position. • The 9 pieces listens to this broadcast and acts accordingly.
Server code (from blackboard) • The server is a web service having two web methods: “path_server” and “block_info” • The “path_server” is the method that is invoked by the object (agent) and is responsible for finding out the shortest path according to blockage information and the current position of the block • The “block_info” is the method that is invoked by the controller for blockage information. • Paste the code “path_server.cs” in the Visual Studio 2005 editor while creating the project.
The architecture Over HTTP Server Web Service (on .Net Platform) LSL Client1 (Agent) Web Method 1 Web Method 2 Over HTTP LSL Client2 (Controller) Over dedicated SL channel LSL Client2.1 (Position) LSL Client2.1 (Position) LSL Client2.1 (Position) LSL Client2.1 (Position)
Reference • http://www.youtube.com/watch?v=iZHYfpMkyyw&feature=related • http://wiki.secondlife.com/wiki/Pathfinder