This code implements a framework that will allow you to get started with a multi-agent simulation in WebGL.
- Download the code. You can either clone/fork the repository or download the code as a zip file.
- Typically JavaScript is sent from a server and no JavaScript files are stored on your "local" computer. This makes it a little more challenging to run javaScript code, especially if other JavaScript files are accessed. Some web browser will deny access to files on your local machine (for good reason). There are two ways to get around this. You can install a webserver on your computer, this is not very difficult, installing something like WAMP or LAMP works well. If you don't want to install a webserver on your computer you will have to disable the security precautions of your web browser to allow the running of local scripts
- This can be done on Linux with chrome using the command
- google-chrome --allow-file-access-from-files
- less easy in firefox
- This guide is also good
- This one covers how to do this for Chrome
- Select and open the file examples/vehicle.html file to start the example.
- You result should look similar to this video.
Implement the methods at the bottom of A4.js that will allow the flocking simulation to function properly.