OpenSimulator Internals/Reading the Code
Appearance
OpenSimulator Internals/Reading the Code
[edit]Overview
[edit]OpenSim is a .NET application. When reading the source, many calls are .NET runtime built-ins, not OpenSim code. Do not chase these into the framework -- they do what they say.
What to Skip
[edit]These namespaces are .NET runtime or third-party libraries. Treat them as black boxes.
| Namespace / Library | Notes |
|---|---|
| System.Reflection (Assembly, MethodBase) | Runtime introspection -- finding the current executable, loading plugins dynamically |
| System.IO (Path, File, FileInfo, StreamReader) | File and path operations |
| System.Net (ServicePointManager, HttpWebRequest) | HTTP connection management |
| System.Security.Cryptography.X509Certificates | SSL certificate handling |
| System.Threading (Thread, Monitor) | Threading primitives |
| System.Environment | Process exit, environment variables |
| System.Console | Console output before the OpenSim console is initialised |
| log4net | Apache logging framework -- not Microsoft, not OpenSim |
| Nini | .ini file parser, third-party library |
What to Follow
[edit]These namespaces are OpenSim code.
| Namespace | Notes |
|---|---|
| OpenSim.Framework | Core data structures and interfaces |
| OpenSim.Framework.Console | OpenSim console infrastructure |
| OpenSim.Framework.Monitoring | Stats and monitoring |
| OpenSim.Framework.Servers | Server base classes |
| OpenSim.Framework.Servers.HttpServer | HTTP server and handler infrastructure |
| OpenSim.Server.Base | ServerUtils, plugin loading |
| OpenSim.Server.Handlers | ROBUST HTTP endpoint handlers |
| OpenSim.Services | Service implementations |
| OpenSim.Region.CoreModules | Simulator-side modules and connectors |
ROBUST Startup Map
[edit]Execution entry point for ROBUST.exe:
OpenSimServer.cs
-- entry point
-- reads command line, loads connectors, starts HTTP server loop
|
HttpServerBase.cs
-- HTTP server setup
-- reads [Network] config (port, SSL)
-- starts HttpServer listener
|
ServicesServerBase.cs
-- config loading (.ini file chain)
-- loads connector plugins from [ServiceList]
-- main run loop
-- clean shutdown handling
Key points:
- Config is loaded as a chain: defaults → Robust.ini → any included files. Later files override earlier ones.
- Connectors are loaded from [ServiceList] in Robust.ini. Each connector registers its HTTP handlers on startup.
- The HTTP server is started before connectors are loaded -- handlers are registered into a running server.
- SuppressConsoleCommands = true in [GridService] prevents duplicate console command registration when GridService is loaded both by ROBUST and by a simulator in the same process (standalone mode).
OpenSim.exe Startup Map
[edit]Execution entry point for OpenSim.exe (simulator):
OpenSim.cs
-- entry point
-- loads region modules, initialises scene
|
OpenSimBase.cs
-- reads OpenSim.ini
-- loads estate, region, and physics configuration
-- starts HTTP server for simulator port (default 9000)
|
Scene.cs
-- per-region object: avatars, objects, physics, scripting
-- holds references to all service connectors via Scene.AssetService, Scene.GridService, etc.
Key points:
- Each region runs as a Scene instance. A single OpenSim.exe can host multiple regions.
- Service connectors are loaded as region modules -- they attach to the scene and provide the service interface.
- In standalone mode, service implementations run in-process inside OpenSim.exe. In grid mode, connectors make HTTP calls to ROBUST.