chapter 2: one on one (101)

19
Networked Graphics Building Networked Virtual Environments and Networked Games Chapter 2: One on one (101)

Upload: rossa

Post on 22-Jan-2016

22 views

Category:

Documents


0 download

DESCRIPTION

Chapter 2: One on one (101). BOIDS. Three Forces Acting on a Boid. Cohesion. Alignment. Separation. V’ i. V i. A. P’ i. P i. One Time Step of a Boid. At time t+  t. At time t. Simulation. 1010100 1111001 0010101 0111101 1001. Renderer. Data Model. Software. Client. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Chapter 2: One on one (101)

Networked GraphicsBuilding Networked Virtual Environments and Networked GamesChapter 2: One on one (101)

Page 2: Chapter 2: One on one (101)

BOIDS

Page 3: Chapter 2: One on one (101)

Three Forces Acting on a Boid

Cohesion Alignment Separation

Page 4: Chapter 2: One on one (101)

Pi

Vi

A

P’i

V’i

At time t At time t+t

One Time Step of a Boid

Page 5: Chapter 2: One on one (101)

Data Model

Simulation

Renderer

10101001111001001010101111011001......

Software

Client

Page 6: Chapter 2: One on one (101)

DISTRIBUTED BOIDS: CONCEPTS

Page 7: Chapter 2: One on one (101)

Data-Push

Client BClient A

Page 8: Chapter 2: One on one (101)

Client A Client B

Data-Sharing

Page 9: Chapter 2: One on one (101)

Client BClient A

Data-Coupled

Page 10: Chapter 2: One on one (101)

DISTRIBUTED BOIDS: IMPLEMENTATION

Page 11: Chapter 2: One on one (101)

Data Model

Simulation

NetworkRenderer

10101001111001001010101111011001......

10101001111001001010101111011001......

Software

ModemClient

Router

RouterRouter

Router

Software

ModemClient

Page 12: Chapter 2: One on one (101)

Boids Implementation

Data model

Local Flock

Remote Flock

Screen (Renderer Output)

Network

Internet

Router

RouterRouter

Router

Simulation

Page 13: Chapter 2: One on one (101)

Create socket local port X_socket =

DatagramSocket();

Read packet_packet =

_socket.read()

Write packet to remote address and port

_socket .write(_packet)

Close_socket

Write packet to remote address and port

_socket .write(_packet)

Read packet_packet =

_socket.read()

Close_socket

Create socket local port X_socket =

DatagramSocket();

Create Datagram Packet to receive and send

_packet = DatagramPacket();

Create Datagram Packet to receive and send

_packet = DatagramPacket();

Page 14: Chapter 2: One on one (101)

Create socket to listen to requests on local port X

_listenSocket = ServerSocket();

Wait for incoming connection requests

_connectionSocket = _listenSocket.accept();

Read messages on_connectionSocket

Write messages on _connectionSocket

Close_connectionSocket

Connect to remote address and port_clientSocket =

_Socket();

Write messages on_clientSocket

Read messages on _clientSocket

Close_clientSocket

Setup streams_connectionSocket

Setup streams_connectionSocket

Page 15: Chapter 2: One on one (101)

REFLECTION

Page 16: Chapter 2: One on one (101)

X

ClientA

t

X

ClientB

t+tNetwork

Boidi Boidi

wall clock time wall clock time

Page 17: Chapter 2: One on one (101)

X

wall clock time

ClientA

t

X

wall clock time

ClientB

t+tNetwork

Boidi Boidi

t+tNetworkt

Boidj Boidi

Page 18: Chapter 2: One on one (101)

t

X

wall clock timeClientA

t

X

wall clock time

ClientB

tNetwork

Boidj

Boidi

tNetwork

Boidj

Boidi

Page 19: Chapter 2: One on one (101)

a) At time t b) At time t+tNetwork

c) At time t+2.tNetwork

ClientA ClientB ClientA ClientB

ClientA ClientB