Title: Networked Virtual Environments Design and Implementation Chapter 6 Systems Design
1Networked Virtual EnvironmentsDesign and
Implementation Chapter 6 Systems Design
2Overview
- One Thread vs. Multiple Threads
- Important Sub-Systems
- Real-Time Rendering Polygon Culling and
Level-of-Detail Processing - Real-Time Collision Detection and Response
- Computational Resource Management
- Conclusion
- References
3Introduction
- Fundamental software architecture issues in the
development of networked virtual environments. - Thread allocation and management within virtual
environments. - Real-time Rendering
- Real-time Collision Detection and Response
- Computational Resource Management
4Single Threaded Applications
- Event loop consists of eight stages
- Initializations
- Read Local Input Devices
- Compute State Changes from Local Inputs
- Read From Network
- Compute State Changes from Network Reads
- Computational Modeling
- Post State Changes to the Network
- Generate a New Display
5Event Loop
- Initialization stage happens only once.
- 100 millisecond cycle time is the maximum amount
of time delay before loosing smoothness.
6Single Threaded Applications
- Read From Local Input Devices
- Introduces a tremendous potential for delay for
slow connections (e.g. serial port 9,600 to
38,4000 baud). - The Net-VE application program must query the
input device for data, going through the port to
the device controller. The controller queries
the device for data and receives its response.
The data is sent back through the serial port to
the workstation. The program processes the
information and then moves on to the next event
block.
7Single Threaded Applications
- Compute State Changes From Inputs
- Determines any changes in the virtual world state
and updates the corresponding state table values. - Examples are updating the local user position
based on input device movement, updating the
viewpoint position based on head tracker
movement, etc.
8Single Threaded Applications
- Read Network
- Queries the network to retrieve any data that may
be waiting from other Net-VE hosts in a no-wait
fashion. - This is often slow due to network bandwidth and
large data copy operations.
9Single Threaded Applications
- Compute State Changes from Net Reads
- Processes network packets or protocol data units
(PDUs) and recorded in the local state tables (if
necessary). - Examples are updates to networked player
positions and configurations.
10Single Threaded Applications
- Computational Modeling
- Can be very time-intensive, or might not exist at
all in smaller Net-VEs. - This block handles computing of physical models,
collision detection and response, or other
computationally expensive operations.
11Single Threaded Applications
- Post State Changes to the Network
- Formats data to send back out to the network.
- The type of data could include changes to player
positions (for games) whose state is maintained
on your local machine. - This is slow, once again, due to network
bandwidth and large data copy operations.
12Single Threaded Applications
- Generate New Display
- Depends upon the complexity of the picture to be
displayed, and how much of the work the CPU must
handle versus a CPU/Graphics Hardware combination.
13Single Threaded Problems
- If the event loop takes more than 100
milliseconds to complete, then the following can
occur - Sluggish displays that do not respond well to
control inputs. - Slow or jerky graphics.
- Sickness and headaches in people using viewing
devices such as goggles.
14Single Threaded Solutions
- Decrease the computational requirements by
decreasing the world complexity (number of
entities, simpler graphics, etc.). - Use better hardware (faster CPU, graphics
hardware). - Recommendation is to use multiple-threads so that
a single bottleneck does not starve the entire
event cycle such as in single threaded
applications.
15Multiple Threaded Applications
- Multiple threaded applications only work well if
the threads are properly balanced, meaning that
the process partitioning takes full advantage of
available processor cycles and memory. - Can be difficult to properly balance the
processor load.
16Multiple Threaded Applications
- Multiple input devices can be read from in
parallel. - Slower input devices will not delay other input
devices from sending data. - The speed of the event cycle through a particular
thread does not depend on threads in other
subsystems.
17Multiple Threaded Applications
- Shared memory that connects the subsystems is the
key to developing multiple threaded applications. - The shared memory area is where each subsystem
can write its results of computations. - It is important to protect shared memory in order
to enforce proper protocols between subsystems.
18Important Subsystems
- Real-Time Rendering
- Polygon Culling
- Level-of-Detail Processing
- Real-Time Collision Detection and Response
- Collision Detection Solutions
19Real-Time Rendering
- Example Nintendo 64
- Displays 100,000 polygons per second.
- At 30 frames/second, that is 3,333 polygons per
frame. - Example SGI Reality Engine Monster
- 80 million polygons per second.
- 2.6 million polygons per frame.
20Real-Time Rendering
- Polygon Culling
- Throw away polygons that dont need to be
rendered. - Must determine which polygons to discard faster
than sending all polygons down the graphics
pipeline. - Use of a bounding volume tree can discard a large
amount of polygons that dont need to be rendered.
21Real-Time Rendering
- Levels of Detail
- Different views of objects should exist for
different distances from the users viewpoint. - Close objects should be in greater detail than
objects that are farther away. - Objects farther away cover less pixels on the
screen than close objects. - Often times, these objects are non-real-time, and
must be computed beforehand.
22Real-Time Rendering
- Collision Detection and Response
- Once a collision has been detected, a message
must be sent to other hosts on the Net-VE
indicating the action taken. - Similar to polygon culling, bounding volumes can
be used to throw away large sets of polygons to
test collisions against.
23Real-Time Rendering
- Collision Detection Solutions
- Remove physics routines if not necessary.
- Remove precise collision locations if not
necessary (e.g. running into a wall). - Bounding volume overlapping schemes
- Scheduling schemes based on current velocity and
acceleration.
24Computational Resource Mgt.
- The ideal setup would contain a separate
processor for each thread (not always practical) - It is important to monitor each threads CPU time
to eliminate starvation to other threads. - Use of a thread scheduler can switch between
threads after a set amount of time.
25Conclusion
- System Design of virtual environments requires a
balance between computational and performance
requirements.
26References
- Singhal, Sandeep and Michael Zyda. Networked
Virtual Environments. Addison-Wesley 1999. - UNC collision detection software on the Web
http//www.cs.unc.edu/geom/collision_code.html - Multithreading in Java on the Web
http//www.javacats.com/US/articles/MultiThreading
.html