Term Project – Final Report CSCE 4543 Course title – Spring 2009

Pie Menu Functionality in Second Life Viewer

Andres Baez

Abstract

This project was intended to extend the functionality in the pie menu used in the Second Life (SL) viewer. The project added simple functionality to the self pie menu and land pie menu.

1. Problem

The pie menu in the SL viewer presents a few generic choices that users can choose from. This project looked into how to add more personalized menus that would accommodate more uses. This implies a set of grammars (or linked menu items) that would have each different functionality depending on the grammar context.

The pie menu team was composed by Deric Sutton and Andres Baez. Given the complex nature of the code dealt with and its requirements, we decided it would be more beneficial to work at the same time on the same problems; this way we would be able to gain time and maximize the results in the least amount of time possible as in this way we looked to maximize our resources and put our efforts together.

2. Objective

The objective of the pie menu team was to be able to add dedicated grammars to the existing pie menus to enhance their functionality. This functionality would be meant to automate or facilitate any tasks within the SL world.

My subproject was to be able to add grammars into the different menus and have them accomplish a simple task. More particularly, the task we chose for the menus to accomplish was to navigate new options within a given pie menu and have one of the menu options open a simple empty test window.

3. Related Work

During the research phase of the project, we found a couple of projects dedicated to create an open source version of the SL viewer. Among these projects, the most important one is the Meerkat viewer (http://www.meerkatviewer.org/), which intends to create a fully GPL compliant viewer that would facilitate many tasks that the Linden Labs’ viewer cannot accomplish. Particularly, the meerkat viewer tried to ease creation and addition of plugins as well as facilitate development of the viewer’s functionality.

The main online source the pie menu team used was the http://wiki.secondlife.com/wiki/Main_Page website. The Linden Labs’ SL viewer is open source and has readily available code, tutorials and developer resources. For this reason, we decided to use this viewer. Our goal was to add functionality to the pie menu, and since we were already familiar with the Linden Labs’ viewer, it made sense to use it for development.

4. Architecture

4.1 Design

The viewer itself is a very complex project. The very first big task we dealt with was to get it to compile as it has a great deal of dependencies. The viewer is entirely coded in C++.

First of all, Linden Labs’ main development tool is Microsoft’s Visual Studio 2005 pro. Any other tools are not fully compatible with all dependencies, which makes compilation very troublesome as it is necessary to find work-arounds in many instances as we originally found out when trying to use the express edition of Visual Studio C++ 2008. Once we got hold of VS2005, the online guide on how to compile the SL viewer went with no further problems. The setup to compile the viewer has a long list of requirements and requires more or less 1 to 2 GB of space (including all libraries and software dependencies). The viewer itself, after compilation, is about 350MB. The Second Life viewer project requires a few programs and third party libraries and dll’s. To list some of these dependencies: Cygwin, Python, Directx 9.0 SDK, The Windows platform SDK, CMAKE…

Once we managed to meet all dependencies and got the viewer compiled, we proceeded to start reading code in order to find out how the pie menu works. We quickly found out that most user interface (UI) aspects of the viewer are actually handled within XML files that describe the properties of graphical interfaces. To our surprise, communication with the SL server is limited to complex tasks such as rendering prims and database related tasks. In a way, we can think of the viewer as the tool to merely graphically interface with the SL world. This discovery was very important for our project as it meant that we would not have to deal with the server side to be able to accomplish our goal.

The development of our addition to the viewer’s code did not start right away. This was due to the fact that the viewer has hundreds of .XML and .cpp source code files. It took long hours for us to just understand enough of the code to know which parts were linked and decide which files we would need to add or modify.

The SL viewer provides several pie menus. There is one for each constant generic resources present in the Second Life world. The constant resources are: Land, Objects, Avatars, Self (one’s own avatar)… The existence of several pie menus is intended to provide different menu functionality to each of such resources. For example, the pie menu for oneself would show the option to change the avatar’s appearance and the pie menu for the land would show an option to edit the terrain.

To accomplish our goal, we decided to add functionality to the Self pie menu and the Land pie menu. All pie menus follow the same main constructs and XML guidelines. The functionality of each pie menu item is accomplished by a function call as demonstrated in the code below extracted from the self pie menu XML file (menu_pie_self.XML):

<menu_item_call enabled=”true” label=” Pie Self Test…” name=” Pie Self Test…”

<on_click function=”ShowFloater” userdata=”Pie Self Test” />

</menu_item_call>

The function calls for “ShowFloater”, which is a generic function that takes for parameters userdata; in this case “Pie Self Test”.

The function ShowFloater (which is contained within llviewerwindow.cpp) checks the parameter passed and executes the actions listed for “Pie Self Test”, which is to set the pie self test floater menu to visible. This menu is setup in the floater_pie_sefl_test.XML file.

Each XML file controls the contents of each floater (window), its contents and can also contain further function calls.

The design for the land pie menu is basically the same as for the self pie menu, except that the additions are to be made into the menu_pie_land.XML file, which describes the graphical UI for the land pie menu.

4.2 Testing

For our purposes, we decided to use the source code for the most recent version of the viewer available at the time (ver. 1.22.11). We were also using the 0.6.3 version of the Opensim server as the open source version of the Second Life world provides far more flexibility than the Linden Labs’ servers. The latter has caveats concerning licensing about non-standard viewer additions which we did not want to deal with as it was not related to our project and would have slowed us down greatly.

Testing was very difficult due to compilation time. Some of the additions we made to the viewer were pretty simple, but in our machine (Windows XP SP3, Intel 2 cores, 2.5GB ram), compilation of the viewer takes over 40 minutes. This was a major drawback in that we weren’t able to test and make adjustments on the fly. We would have to plan to make the best job we could when coding so that would we not waste time in case the code wouldn’t even compile and we would not even find out for almost an hour of compilation errors each time.

To be able to run the viewer standalone, without the need of using VS2005, a few directories need to be copied around. More specifically, the main directory /linden/indra/buil-VC80/newview/relwithdebinfo is the only one that is needed. To be able to run the viewer from within this directory, it is necessary to copy the following directories that can be found in /linden/indra/newview/

·  app_settings

·  character

·  fonts

·  res

·  skins

For some unknown reason to us, when we would use the binary version of the 1.22.11 viewer, it would work fine; although, when we would use the compiled version of the 1.22.11 viewer, it would freeze almost instantly after connecting to the server in slower machines that did not have a dedicated graphics card. It didn’t seem that it is a compilation problem, but rather some discrepancy in configuration files that manage the video memory. Given that we were able to test in a faster machine, which did have a dedicated graphics card, we did not give this problem much importance.

5. Results

The pie menu team has accomplished the main goal of being able to add grammars into the pie menus. We have determined which parts of the viewer code take place to handle the pie menus. The project was also successful in being able to make these added menu items be able to open windows, which constitutes a big step in getting pie menu items to accomplish specialized tasks. Below is a screen shot of one of the pie menu items we added into the viewer and the result of clicking on it which creates a floating window.

6. Conclusions

6.1 Summary

The pie menu is a fairly simple concept to understand and not very hard to modify. The really hard part is to understand how all the parts in the viewer fit in together to form a whole. Also, even though adding menu items are not very hard to add, for items to do something useful, much more complicated modification to the client and possibly the server are needed.

Most of the UI in the viewer is handled with XML files, which facilitates greatly modification of visual aspects of the pie menus.

6.2 Impact

The pie menus are fairly simple to modify. The complexity of the project relies on how to get the new added menus and options to accomplish specific tasks. The team has made the first step into accomplishing this goal by understanding how all parts fit together in the viewer source code and by being able to add menus to the pies and getting them to do something simple.

Also, this project can serve as an important basis on how to go about the initial setup with opensim/sl viewer, as it can be very complex and full of dependencies and initial setup requirements. The references gives precise information on how to accomplish these tasks.

The pie menu project has revealed important aspects on how tasks are separated between the client and the server side. All UI tasks are entirely handled with XML files from within the viewer. The server is there to listen to requests and execute tasks that are non UI related; even though the viewer will show graphically what the server did when a request was done.

6.3 Future Work

The next task would be to add actual functionality inside the floater windows from each pie menu option added. This has to be accomplished by adding function calls inside the floater configuration XML file. If more complex functionality is desired, such as prim creation or any database manipulation, modifications to the server side (adding ports, functions, etc…) would most likely also needed. This would of course further tie the viewer with the open source version of the Second Life server.

References

[1] Second Life source code and compilation instructions, http://wiki.secondlife.com/wiki/Get_source_and_compile

[2] Open simulator download page, http://opensimulator.org/wiki/Download

[3] Configuring Opensim, http://opensimuser.wordpress.com/2008/06/15/opensim-install-and-configuration-tutorial/

Appendix A - Main project directory

The attachment contains the main project directory: relwithdebinfo/ and a link to the executable that has been preconfigured to run with Opensim. (The Opensim server application is required to start before running the viewer.) If the Opensim server is not available, the relwithdebinfo/second_life-bin.exe can be used to connect to the Linden Labs’ server; although, we have not tested this scenario and cannot guarantee that it will work.

For more information on how to get the source code or compile the viewer, or how to obtain Opensim, please refer to the references.

Comments

What did you learn in this course?

In the past, I had never coded in C++, so this project definitely helped me to learn the language. Also, because of the complexity and constraints attached to the project, I learned a lot about managing time, quality of code and how complex projects are composed.

I also learned a lot about XML, how they are organized and what they can be used for.

What did you like about the class?

The class is excellent in that it gives a lot of freedom on how to approach the problem and the variety of projects.

What should be improved?

Maybe setting more specific goals for each project and some text book to learn more in technical depth about the subject of the class and not only just theoretical.

The projects in Second Life have much potential, but one semester is not enough to go into enough depth to be significant. Instead of spawning more and more possible projects, more progress in fewer projects would give more complete and better results.