Up:Tutorial?
The aim of this tutorial is to explain how to create a service provider for SIGVerse using Microsoft Visual Studio.
We will create a simple service provider as example to send messages to a specified entity of the SIGVerse virtual world from the client side to the server side.
Microsoft Visual Studio 2008 will be used as a development tool.
We first need to download SIGVerse libraries, to do so, go to the service libraries web page and download the appropriate version.
Now let's create a new project on MVS 2008.
Go to: File -> New Project , then select Empty Project, enter the project name "MyService" and press Ok.
Right click on Source Files -> Add -> New Item -> C++ File (.cpp), then enter "MyService.cpp" in the Name field.
Now let's create our example.
Copy/past the following code to MyService.cpp file:
MyService.cpp
Replace the hostname and port number with your server arguments.
Extract the libraries in MyService project directory.
Go to the MVS, Right click on the project, and go to properties.
In the server side, we have to create the controller and the world file.
controller.cpp
worl.xml
In the server side, compile and run the the controller:
$ cd path-to-the-controller $ make $ sigserver.sh -w ./world.xml
In the server side you will see the following message:
$ [MSG] man_000(0.0.0.0) Hello
To register the plugin in SIGViewer, you have to follow these steps:
1- Rename the MyService.exe in debug directory to MyService.sig.
2- Run SIGVIewer, go to Services -> Add, then click on Add button.
3- Select the path to the MyService.sig file and press OK.
4- To run the service, go to Services -> Start -> MyService.sig.