Codebase overview
From OpenSimulator
(Difference between revisions)
(→Codebase overview) |
m (Robot: Cosmetic changes) |
||
Line 2: | Line 2: | ||
{{Quicklinks}} | {{Quicklinks}} | ||
<br /> | <br /> | ||
− | ==Coding restrictions== | + | == Coding restrictions == |
Because OpenSim has to run on both Windows and Mono (usually on Linux or Mac), we are limited to the parts of .net that [http://en.wikipedia.org/wiki/Mono_(software) Mono] supports. | Because OpenSim has to run on both Windows and Mono (usually on Linux or Mac), we are limited to the parts of .net that [http://en.wikipedia.org/wiki/Mono_(software) Mono] supports. | ||
− | ==Codebase overview== | + | == Codebase overview == |
− | (This is probably quite out of date. | + | (This is probably quite out of date. On 2011-08-08, a few edits were made to bring pieces of it up to date, but the editor doesn't have enough of an overview in head to remove all the parts that aren't current. Edits will continue.) |
OpenSim is already a fairly large and intricate project, so patience is required to start understanding it. | OpenSim is already a fairly large and intricate project, so patience is required to start understanding it. | ||
− | At the top level, OpenSim code is broken up into seven sections. | + | At the top level, OpenSim code is broken up into seven sections. There's also a bit more detail on the most significant packages within those sections. |
− | * '''OpenSim'''. | + | * '''OpenSim'''. This contains the classes which launch the OpenSim region server and handle the console |
** Startup | ** Startup | ||
− | *** The Main() for <tt>OpenSim.exe</tt> can be found in the file <tt>OpenSim/Region/Application/Application.cs</tt>. | + | *** The Main() for <tt>OpenSim.exe</tt> can be found in the file <tt>OpenSim/Region/Application/Application.cs</tt>. It does a bunch of configuration checks, but the meat of it is the instantiation of an '''OpenSim''' object, calling its Startup() method (which gets things rolling in separate threads), and then blocking the initial thread by prompting on the main console (using the Prompt() method MainConsole.Instance) |
*** OpenSim.OpenSim.Startup() comes from an ancestor, OpenSim.Framework.Servers.BaseOpenSimServer; it calls StartupSpecific() | *** OpenSim.OpenSim.Startup() comes from an ancestor, OpenSim.Framework.Servers.BaseOpenSimServer; it calls StartupSpecific() | ||
− | *** OpenSim.OpenSim.StartupSpecific() exists. | + | *** OpenSim.OpenSim.StartupSpecific() exists. It creates a console, registers the region console commands, makes a couple of status stream handlers, runs startup commands if any are specified in config, and hooks up its WatchdogTimeoutHandler to Watchdog. It then calls its base class' StartupSpecific(), and each base class calls ''its'' base class' StartupSpecific() (all the way back up to OpenSim.Framework.Servers.BaseOpenSimServer.StartupSpecific()). |
*** ancestor OpenSim.OpenSimBase starts up simulation and estate data services; creates a ModuleLoader (in field <tt>m_moduleLoader</tt>); and loads plugins of type IApplicationPlugin at extension point ("/OpenSim/Startup") (I have to admit to not fully knowing what that means...), and initializes each one of them. | *** ancestor OpenSim.OpenSimBase starts up simulation and estate data services; creates a ModuleLoader (in field <tt>m_moduleLoader</tt>); and loads plugins of type IApplicationPlugin at extension point ("/OpenSim/Startup") (I have to admit to not fully knowing what that means...), and initializes each one of them. | ||
*** ancestor OpenSim.Region.ClientStack.RegionApplicationBase starts up an http server in its StartupSpecific() | *** ancestor OpenSim.Region.ClientStack.RegionApplicationBase starts up an http server in its StartupSpecific() | ||
*** ancestor OpenSim.Framework.Servers.BaseOpenSimServer starts up (something to do with) the console in its StartupSpecific() | *** ancestor OpenSim.Framework.Servers.BaseOpenSimServer starts up (something to do with) the console in its StartupSpecific() | ||
− | *** I have yet to figure out where in all of this the region heartbeat actually gets going.... | + | *** I have yet to figure out where in all of this the region heartbeat actually gets going.... It may actually be inside a Plugin (LoadRegionsPlugin) |
− | * '''OpenSim.ApplicationPlugins'''. | + | * '''OpenSim.ApplicationPlugins'''. Each package is an individual application plugin - an application plugin is a modular piece of code that has an effect on the entire region server. See [[RegionModules]] for more details or one of [http://justincc.wordpress.com/2008/05/08/opensim-tech-basics-my-god-its-full-of-modules/ justincc's blogposts] for a higher level overview (which should really be in this wiki). |
− | * '''OpenSim.Data'''. | + | * '''OpenSim.Data'''. This is all the low level database manipulation stuff. In here, you'll see packages for SQLite, MySQL and MSSQL (which tends to lag), as well as code for [http://www.hibernate.org/ NHibernate] which will hopefully reduce our reliance on manipulation code for specific databases. |
− | * '''OpenSim.Framework'''. | + | * '''OpenSim.Framework'''. General framework code used by the rest of OpenSim which is felt to be not specific to a region. |
− | ** ''OpenSim.Framework.Communications''. | + | ** ''OpenSim.Framework.Communications''. Contains asset and inventory caching code (to cut down on communication with a remote asset or inventory service), and contains CAPS code, a Linden approach to splitting some aspects of the Second Life protocol into independent, secured services. See a [http://mrtopf.de/blog/secondlife/slga-capabilities-explained-technical/ blog post] from Tao for more background on this. |
− | ** ''OpenSim.Framework.Servers''. | + | ** ''OpenSim.Framework.Servers''. Contains generic server code, such as the base OpenSim server and http servers. |
− | ** ''OpenSim.Framework.Stats''. | + | ** ''OpenSim.Framework.Stats''. Collects statistical information on OpenSim operations. |
* '''OpenSim.Server''': these are things that are part of the R.O.B.U.S.T. services, including grid servers, avatar servers, asset servers, inventory servers, and the like. | * '''OpenSim.Server''': these are things that are part of the R.O.B.U.S.T. services, including grid servers, avatar servers, asset servers, inventory servers, and the like. | ||
− | * '''OpenSim.Region'''. | + | * '''OpenSim.Region'''. Contains most of the meaty code that it specifically concerned with region manipulation. |
− | ** ''OpenSim.Region.ClientStack.LindenUDP''. | + | ** ''OpenSim.Region.ClientStack.LindenUDP''. The code necessary for communicating with clients using the Second Life protocol. |
− | ** ''OpenSim.Region.Communications.Local''. | + | ** ''OpenSim.Region.Communications.Local''. Code used for communicating with non-region services (user, asset, grid, etc.) when OpenSim is running in standalone mode. |
− | ** ''OpenSim.Region.Communications.OGS1''. | + | ** ''OpenSim.Region.Communications.OGS1''. Code for communicating with remote UGAI services using the Open Grid Services 1 protocol. |
− | ** ''OpenSim.Region.Environment''. | + | ** ''OpenSim.Region.Environment''. A large package containing both the vast majority of the region modules (categorized under modules) and the central scene manipulation code (under Scenes, appropriately enough). Modules here do everything from handling region chat to loading and saving terrain. |
− | ** ''OpenSim.Region.Modules''. | + | ** ''OpenSim.Region.Modules''. More region module code. Actually, I'm not too sure why these aren't in the OpenSim.Region.Environment package. |
− | ** ''OpenSim.Region.Physics''. | + | ** ''OpenSim.Region.Physics''. General physics framework code and plugins for specific engines (BulletX, ODE, etc). The ODE code is by far the most reliable and stable. |
− | ** ''OpenSim.Region.ScriptEngine''. | + | ** ''OpenSim.Region.ScriptEngine''. Script engine code that powers the scripts run within OpenSim. Currently there are two engines, the classic [[DotNetEngine]] and the relatively new [[XEngine]]. |
− | ** ''[[Overview of How RegionsWork|OpenSim.Region.Framework.Scenes.Scene]]'' is the "heart" of OpenSim functionality. | + | ** ''[[Overview of How RegionsWork|OpenSim.Region.Framework.Scenes.Scene]]'' is the "heart" of OpenSim functionality. It has the "main loop" for a region, in the method <tt>Update()</tt>. |
− | * '''OpenSim.Tests'''. | + | * '''OpenSim.Tests'''. Test code. Really, we don't actually have much of this (yet). |
Revision as of 18:52, 3 March 2012
Coding restrictions
Because OpenSim has to run on both Windows and Mono (usually on Linux or Mac), we are limited to the parts of .net that Mono supports.
Codebase overview
(This is probably quite out of date. On 2011-08-08, a few edits were made to bring pieces of it up to date, but the editor doesn't have enough of an overview in head to remove all the parts that aren't current. Edits will continue.)
OpenSim is already a fairly large and intricate project, so patience is required to start understanding it.
At the top level, OpenSim code is broken up into seven sections. There's also a bit more detail on the most significant packages within those sections.
- OpenSim. This contains the classes which launch the OpenSim region server and handle the console
- Startup
- The Main() for OpenSim.exe can be found in the file OpenSim/Region/Application/Application.cs. It does a bunch of configuration checks, but the meat of it is the instantiation of an OpenSim object, calling its Startup() method (which gets things rolling in separate threads), and then blocking the initial thread by prompting on the main console (using the Prompt() method MainConsole.Instance)
- OpenSim.OpenSim.Startup() comes from an ancestor, OpenSim.Framework.Servers.BaseOpenSimServer; it calls StartupSpecific()
- OpenSim.OpenSim.StartupSpecific() exists. It creates a console, registers the region console commands, makes a couple of status stream handlers, runs startup commands if any are specified in config, and hooks up its WatchdogTimeoutHandler to Watchdog. It then calls its base class' StartupSpecific(), and each base class calls its base class' StartupSpecific() (all the way back up to OpenSim.Framework.Servers.BaseOpenSimServer.StartupSpecific()).
- ancestor OpenSim.OpenSimBase starts up simulation and estate data services; creates a ModuleLoader (in field m_moduleLoader); and loads plugins of type IApplicationPlugin at extension point ("/OpenSim/Startup") (I have to admit to not fully knowing what that means...), and initializes each one of them.
- ancestor OpenSim.Region.ClientStack.RegionApplicationBase starts up an http server in its StartupSpecific()
- ancestor OpenSim.Framework.Servers.BaseOpenSimServer starts up (something to do with) the console in its StartupSpecific()
- I have yet to figure out where in all of this the region heartbeat actually gets going.... It may actually be inside a Plugin (LoadRegionsPlugin)
- Startup
- OpenSim.ApplicationPlugins. Each package is an individual application plugin - an application plugin is a modular piece of code that has an effect on the entire region server. See RegionModules for more details or one of justincc's blogposts for a higher level overview (which should really be in this wiki).
- OpenSim.Data. This is all the low level database manipulation stuff. In here, you'll see packages for SQLite, MySQL and MSSQL (which tends to lag), as well as code for NHibernate which will hopefully reduce our reliance on manipulation code for specific databases.
- OpenSim.Framework. General framework code used by the rest of OpenSim which is felt to be not specific to a region.
- OpenSim.Framework.Communications. Contains asset and inventory caching code (to cut down on communication with a remote asset or inventory service), and contains CAPS code, a Linden approach to splitting some aspects of the Second Life protocol into independent, secured services. See a blog post from Tao for more background on this.
- OpenSim.Framework.Servers. Contains generic server code, such as the base OpenSim server and http servers.
- OpenSim.Framework.Stats. Collects statistical information on OpenSim operations.
- OpenSim.Server: these are things that are part of the R.O.B.U.S.T. services, including grid servers, avatar servers, asset servers, inventory servers, and the like.
- OpenSim.Region. Contains most of the meaty code that it specifically concerned with region manipulation.
- OpenSim.Region.ClientStack.LindenUDP. The code necessary for communicating with clients using the Second Life protocol.
- OpenSim.Region.Communications.Local. Code used for communicating with non-region services (user, asset, grid, etc.) when OpenSim is running in standalone mode.
- OpenSim.Region.Communications.OGS1. Code for communicating with remote UGAI services using the Open Grid Services 1 protocol.
- OpenSim.Region.Environment. A large package containing both the vast majority of the region modules (categorized under modules) and the central scene manipulation code (under Scenes, appropriately enough). Modules here do everything from handling region chat to loading and saving terrain.
- OpenSim.Region.Modules. More region module code. Actually, I'm not too sure why these aren't in the OpenSim.Region.Environment package.
- OpenSim.Region.Physics. General physics framework code and plugins for specific engines (BulletX, ODE, etc). The ODE code is by far the most reliable and stable.
- OpenSim.Region.ScriptEngine. Script engine code that powers the scripts run within OpenSim. Currently there are two engines, the classic DotNetEngine and the relatively new XEngine.
- OpenSim.Region.Framework.Scenes.Scene is the "heart" of OpenSim functionality. It has the "main loop" for a region, in the method Update().
- OpenSim.Tests. Test code. Really, we don't actually have much of this (yet).