Code

  • Code for Chapter 2

    Here is the first version (01) of the code for chapter 2. It should work with all recent J2SE runtimes and SDKs. The code project was set up with Netbeans, though you don’t need this in order to rebuild the code. There is a detailed HowTo document in the ZIP file.

  • Code for Chapter 4

    This is the first version (01) of the code for chapter 4. It contains all the examples from Chapter 4, including all the peer-to-peer and client-server variants and the multicast example. The code is laid out in the same way as the code in Chapter 2, so please examine that code first of all. The code should work in all recent versions of J2SE.

  • Code for Chapter 7

    This is the code for Chapter 7. It comprises two parts: HawkNL code (Version 01) for sending DIS packets, and an X3D example scene (Version 01) that shows the results.

    HawkNL

    HawkNL is a cross-platform abstraction for networking functionality. We used version 1.68 in our example. The code project is build for Visual Studio 2005, though HawkNL supports earlier Microsoft compilers, so the example should work fine if you want to convert. The code is also cross-platform, though we use VC++ for our own code. Please contact the authors if you have problems using it on other platforms.

    To compile and run the code you need two files from HawkSoft:

    You should unzip these, and the boids-HawkNK_XX.zip in the same directory, so that it has the following contents:

    • boids-HawkNL
    • HawkNL1.68
    • HawkNL168bin

    You can then compile the example solution in boids-HawkNL and run the executable. It uses multicast, so there is no connection set up, and this part of the code can be left running.

    X3D

    The X3D code is a simple example for X3D. Not every X3D browser supports the DIS functionality. We have checked the code in Xj3D, but any browser supporting the X3D Immersive Profile, should work. The ZIP file also contains the source for the other X3D mini examples in Chapter 7.

    Because it also contains some functionality for working directly with DIS we recommend opening the files in X3D Edit. We used X3D version 3.2. The file to load is BoidDISReceiverFlock.x3d.

    Note that in some builds of X3D Edit 3.2 running on Windows XP (at least), there seems to 
    be a problem loading the scene file. It indicates that it can't inline prototypes. If when you
    load the scene you don't see any checkboard ground plane, this is likely what happened. A
    quick fix is to move all the files in the zip file to the directory
    \x3deditor32
  • Code for Chapter 8

    This the first version (01) of the code for Chapter 8. The code uses RakNet. To compile it, you will need RakNet 3.72; the code is known not to work with beta versions of RakNet 4.0 (i.e. the current version at the time of writing). We will update the code when 4.0 is released.

    RakNet is cross platform, though our example is demonstrated in Microsoft Visual Studio 2005. The authors have used RakNet on a variety of platforms (Linux, iPhone, …) so the example should be highly portable.

    To set up the compilation, the BoidReplicas and RakNet distribution should unzipped in to one directory:

    • BoidReplicas
    • RakNet

    You will need to compile RakNet. Open RakNet_VS2005.sln, and build the target LibStatic . You can then open the solution in BoidsReplicas, and build one of two projects, one with GLUT enabled, one not.

  • Code for Chapter 9

    This is the simple example from Chapter 9 of using RPC (version 01).