190 likes | 269 Views
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.
E N D
Three Forces Acting on a Boid Cohesion Alignment Separation
V’i Vi A P’i Pi One Time Step of a Boid At time t+t At time t
Simulation 1010100 1111001 0010101 0111101 1001...... Renderer Data Model Software Client
Data-Push Client A Client B
Data-Sharing Client A Client B
Data-Coupled Client A Client B
Simulation 1010100 1111001 0010101 0111101 1001...... 1010100 1111001 0010101 0111101 1001...... Renderer Data Model Network Router Router Software Software Router Router Modem Modem Client Client
Boids Implementation Screen (Renderer Output) Data model Simulation Local Flock Router Remote Flock Network Router Internet Router Router
Create socket local port X _socket = DatagramSocket(); 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(); Read packet _packet = _socket.read() Write packet to remote address and port _socket .write(_packet) Write packet to remote address and port _socket .write(_packet) Read packet _packet = _socket.read() Close _socket Close _socket
Wait for incoming connection requests _connectionSocket = _listenSocket.accept(); Connect to remote address and port _clientSocket = _Socket(); Create socket to listen to requests on local port X _listenSocket = ServerSocket(); Setup streams _connectionSocket Setup streams _connectionSocket Read messages on _connectionSocket Write messages on _clientSocket Write messages on _connectionSocket Read messages on _clientSocket Close _connectionSocket Close _clientSocket
X X Boidi Boidi t wall clock time t+tNetwork wall clock time ClientA ClientB
X X Boidj Boidi Boidi Boidi t t+tNetwork wall clock time wall clock time t t+tNetwork ClientA ClientB
X Boidj Boidi t wall clock time tNetwork ClientA X Boidj Boidi t wall clock time tNetwork ClientB
ClientA ClientB ClientA ClientB b) At time t+tNetwork a) At time t ClientA ClientB c) At time t+2.tNetwork