Difference between revisions of "Viewer Architecture"

From Second Life Wiki
Jump to navigation Jump to search
(Replacing Movie System with LLMedia)
m (update inventory link)
Line 31: Line 31:
** [[Texture cache]] - used for reading and writing texture data to the local disk cache  
** [[Texture cache]] - used for reading and writing texture data to the local disk cache  
** [[Image Pipeline]] - fetches textures from the servers and decodes them
** [[Image Pipeline]] - fetches textures from the servers and decodes them
* [[Inventory]] - server-side storage of assets for each user
* [[Inventory OS|Inventory]] - server-side storage of assets for each user
* [[L$ System]]
* [[L$ System]]
* [[LLMedia API]] - arbitrary media on object surfaces
* [[LLMedia API]] - arbitrary media on object surfaces

Revision as of 15:01, 6 August 2008

The Second Life client (also known as the "viewer") is a complex piece of software. It can be visualized as a streaming media client like RealPlayer, a game engine like Quake 3, or a web browser.

First you'll need to learn some terminology like "agent", "sim", and "region" in the glossary.

Learn by Example

Major Systems

Threads

The viewer is a single process with a few threads:

  • Main thread -- The input/output main program function (including rendering).
  • VFS thread -- Thread responsible for reading/writing to the local virtual file system.
  • LFS thread -- Thread responsible for some reading/writing to the local native file system.
  • Image thread -- Thread responsible for requesting and decoding image data
  • Error Thread -- Thread responsible for catching exceptions, calling the (currently unused?) error handler, and retiring
  • Worker Threads -- Threads designed to do cpu intensive background tasks
    • These threads may be paused during rendering so as not to reduce performance (design in-progress)

Program Flow

  1. Initialize - newview/viewer.cpp :: main()
  2. Loop - newview/viewer.cpp :: main_loop()
    • Gathers keyboard and mouse input
    • Pumps the TCP i/o
    • idle()
    • Render the frame
    • let filesystem and worker threads process
  3. Shutdown

One way to see what goes on in the main loop is to bring up the debug menus (Ctrl-Alt-D) then Client->Consoles->Fast Timers (or Ctrl-Shift-9) and expand the entries in the caption.

see also: AW Groupies protocol and login documentation links

Startup and initalisation

(updated for 1.20.14 code)

The main() function for the viewer exists in either llappviewerlinux.cpp, llappviewerwin32.cpp or llappviewermac.cpp depending on your platform. This creates the instance of LLAppViewerLinux, LLAppViewerWin32 or LLAppViewerMac which all are derrived from LlAppViewer. The initial platform dependent code sets up the various error handlers to handle a viewer exception (crash condition). The reset of the platform dependent appviewer classes are related to crash handlers.

The initialization then occurs in LLAppViewer::init() this is the real low level setup and class creation and does things including :-

  • Sets up application directory locations
  • Sets up logging
  • loads configuration
  • sets up Curl
  • Creates worker threads
  • Creates the LLUI system
  • loads saved/default settings
  • initalises the cache system
  • sets up the viewer window
  • Checks the CPU type and features
  • checks memory and graphics card
  • Initalises joystick

Then the LLAppViewer::mainloop() is started

Sources of Input

User Guides

See also