Sunday, April 15, 2007

Virtual Reality Architecture

One way to craft architecture for virtual reality system is to rely on basic server client architecture where server is running an environment simulation and clients are user interfaces to the simulation.

Essentially client consists of user interface framework (3D rendering engine, 3D sound engine, windows, panels, and widgets), virtual reality model (scene graph and media caches), session management (state machine and session data pool), command interface (commanding avatar), state synchronizer (synchronizing server virtual reality model) and network engine. One of the key design challenges for client is that the user should experience smoothly evolving and plausible virtual reality despite of network and server lag. Even writing stand alone 3D games with smooth game play is not easy. Consequently clients are often written with C++ (no garbage collection lag) and have only one executing thread (no unpredictable short thread stalls). Exceptions to this rule are long lasting and unpredictable operations like hard drive access and network transmission which should be executed in a dedicated thread. Another good design principle for real time applications is “keep it simple (s)” and if possible reserve required data structures at initialization phase (no memory leaks at runtime). If one considers client purely as a user interface it is possible to concentrate on rendering engine, UI-framework and network engine without creating overtly complex system.

Virtual reality server has quite a few roles to fulfill: physics engine, rule engine, artificial intelligence, virtual reality object model, model persistency, simulation control, server management and network connectivity. Network connectivity can be further divided to network engine, command processor, state synchronizer, session management, media sharing and IAM (identity and access management). Many of these roles are clearly separated and it is tempting to divide them to several separate server applications. However complexity tends to cause problems. Heterogeneous distribution is harder to administrate and is more prone to failures than homogenous server cluster with load balancing. One good way to do heterogeneous distribution is to divide real time and non real time functionality to separate servers. Another way is to distinguish between high trust and medium trust services thus separating key services to trusted parties and leaving the bulk computing load to less secure servers. These rules suggest a threefold server division: virtual reality server (bulk computing), identity server(s) (high trust and virtual reality integration services) and file server(s).

Virtual reality server is a near real time simulation application running the virtual environment simulation. The core components are virtual reality object model (simulation state), physics engine (provides elementary physics), rule engine (scripted object interaction and object internal functionality), artificial intelligence (scripted AI-functionality) and simulation control (coordinates simulation execution and rule execution stack). Virtual reality server could be implemented with C++ (high performance) or .NET/Java (higher level language providing cleaner code base). The most common way of load balancing between virtual reality servers is spatial division (each server simulates separate volume).

Identity servers are important building block for global virtual reality where avatars and other objects can traverse between servers. They can be compared to DNS network in architectural sense. Identity servers govern both user and machine identities. They may also govern object identities which are in transit from server to server. Identity information in this context consists of identification, authentication, role, category, statistics and location information. Identity servers need not be virtual reality specific solutions but existing identity governing standards and systems can be utilized.

File servers are version aware file repositories providing all shared files for the virtual reality system: client binaries, server binaries and media files. Existing versioned file sharing frameworks can be utilized without additional requirements.

System components like clients and servers should be relatively easy to develop and integrate. Such global open virtual reality network requires that all system components converse with each other utilizing well defined protocols.

No comments: