Showing posts with label Project. Show all posts
Showing posts with label Project. Show all posts

Sunday, 5 April 2009

Netlogo to 3DMax: Pseudocode



As mentioned in an earlier post that I will be posting a pseudocode for a Netlogo to 3DMax implementation.
This pseudocode is mainly for the Netlogo traffic simulation, but I will try and make it as general as possible in order to use in other models.

Netlogo:
For each tick:
1. Output to file - x coordinate, turtle id, y coordinate

Please note, that when the data is exported into a text file, it will have other test such as 'turtle id:', all text needs to be deleted, and should leave you with 3 numbers. An example for 3 turtles (1 tick) can be seen below:



This creates a file that has the turtle id and locations for each tick. Now, our next step is to import it into 3DMax, but this time each tick represents a frame. I did this by creating a script that would store the data in an array for each frame.


3DMax:
1. Initialise an object (eg, box), for each turtle in the output file
2. Read in netlogo output file, and store xy coordinates for each object per tick in an array. (I stored the array in a 2D form [object id][xy coordinates])
3. Initialise positions of each object for first frame
4. While not end of array
5. Advance frame, and update object position corresponding to the object id in the array
6. Keep repeating step 5 till end of file is reached.
7. Render final animation

Same process for traffic lights, where each traffic light is a turtle in netlogo.

Saturday, 7 March 2009

Introduction

As this is my first post, let me detail a little about me, and about this blog.
I am currently studying for a PhD in Crowd Simulation in the Centre of Advanced Spatial Analysis, University College London (UCL). I did an MSc in Vision, Imaging & Virtual Environments (VIVE) at UCL last year. I am in my 1st year of the PhD, and will be regularly updating this blog to include posts related to my work, work related to this area, and applications that I come across in the field.
My main aim for the PhD will be to create a real time scalable crowd simulation, therefore, allowing users to look at, for example, crowds in the city of london at varying scales, in real time.
This will be achieved using different architectures depending on the scale. The architectures I will be exploring will include disciplines in social science and computer science.
The work will carried out on the Graphical Processing Unit (GPU), concentrating on general purpose programming, i.e., GPGPU.
The reason I have chosen to use general purpose programming on the GPU, is because, there has been active research in this area over the last few years with the wide deployment of GPUs. The parallel processing of GPUs also gives us a distinct advantage to populate larger amounts of the city with agents, or a larger number of agents in a smaller area.

ShareThis