One on one (101)
暂无分享,去创建一个
This chapter presents some practical examples of how to do some basic networking. The basic interfaces and techniques to make two or more computers collaborate are really quite simple. The process of how to send data across the network using an application programming interface (API) based on the Berkley Sockets, which is the foundation for simple networked virtual environments, is discussed. Throughout the chapter, a common example, of simulating a flock of boids is used. The term “boid” was coined to refer to a single simulated animal in the animations of flocking behavior. Boid-like simulations are now very commonly used in computer games to populate large crowds and flocks. A simple boids implementation is made available in both C++ and Java programming language. Three simple ways of distributing boids between two machines are identified in the chapter. Each host is responsible for simulating the behavior of only one flock, which is called the local flock. Communication between the two clients is effected by the network component, which sends and receives data over the Internet using a network protocol. In the case of the boids implementation, there is need for a protocol so that when one host sends the state of its flock of boids over the network, the other host is able to understand what it receives.
[1] Craig W. Reynolds. Flocks, herds, and schools: a distributed behavioral model , 1987, SIGGRAPH.