CS525 Project 2 Page
For this project we need to simulate what happens to a large number of people in the Mall area as the Washington DC area is visited by flying saucers using OpenCL and OpenGL. I start from Nvidia OpenCL SDK's simpleGL code, and my card is Nvidia 9700 mgs.
Following is a overall looks:
Following is a overall looks:
Demo Video
Source File
Rules
In this project:
Big black dot: flying saucers
Yellow dots: normal alive people
Red dots: died people
Green dots: flying missiles
1. In the beginning, normal people just hanging around, they cannot cross water and run into buildings.
2. Saucers show up! They will try to fly over normal people and absorb normal people, torture them then throw them away, and these people died, and cannot move anymore.
3. Police show up! They can launch 100 missles each time to attack one ufo.
4. If ufo get all the 100 missiles it become full red which means this ufo died and cannot move also.
5. After all ufo dies, normal people continue hanging around..
Upper pic shows missles is attacking ufos, and following pic shows the final view of the simulation(all ufos died).
Big black dot: flying saucers
Yellow dots: normal alive people
Red dots: died people
Green dots: flying missiles
1. In the beginning, normal people just hanging around, they cannot cross water and run into buildings.
2. Saucers show up! They will try to fly over normal people and absorb normal people, torture them then throw them away, and these people died, and cannot move anymore.
3. Police show up! They can launch 100 missles each time to attack one ufo.
4. If ufo get all the 100 missiles it become full red which means this ufo died and cannot move also.
5. After all ufo dies, normal people continue hanging around..
Upper pic shows missles is attacking ufos, and following pic shows the final view of the simulation(all ufos died).
Maps
Basically I first got ref map from Openstreetmap.com and modified the svg to black and white, which means that walkable and non-walkable. Then get normal map from googlemap, and convert these two maps to RAW file using PhotoShop.
so over it is:
OSM to SVG
SVG to BMP
BMP to RAW
resolution is 1500X800
There are four map of two cities in my simulation: settle view and street view of Beijing and Washington.
so over it is:
OSM to SVG
SVG to BMP
BMP to RAW
resolution is 1500X800
There are four map of two cities in my simulation: settle view and street view of Beijing and Washington.
Simulating
Ok this was the most painful part .....
I start off I used Processing to create boids. Processing is easy is fun and most important Debugable.
I used started off by porting existing boid code from :http://processing.org/learning/topics/flocking.html modified.
In my flocking mode, there are three condition which are seperate, alignment, and collision. Normally each boid try to keep a distance form each other, and match the average speed and position of the boids around it.
There are total 5 kernel in cl file, people, ufo, and three series of missles.
I first initial data as a GL buffer and create a CL buffer from this GL buffer, each time I run the kernel, I unmap the CL buffer so the data can be shared between each kernel, like people can know the position of ufos.
I start off I used Processing to create boids. Processing is easy is fun and most important Debugable.
I used started off by porting existing boid code from :http://processing.org/learning/topics/flocking.html modified.
In my flocking mode, there are three condition which are seperate, alignment, and collision. Normally each boid try to keep a distance form each other, and match the average speed and position of the boids around it.
There are total 5 kernel in cl file, people, ufo, and three series of missles.
I first initial data as a GL buffer and create a CL buffer from this GL buffer, each time I run the kernel, I unmap the CL buffer so the data can be shared between each kernel, like people can know the position of ufos.
Controls
Pause Simulation: Space-Bar
Map change:1/2/3/4
Zoom In/Out: z/x
Launch missles: x/c/v
Map change:1/2/3/4
Zoom In/Out: z/x
Launch missles: x/c/v
Data size
3000 normal people and 300 missiles and 3 ufos. Simulation runs about 40 fps.
Reference
http://processing.org/learning/topics/flocking.html Nice tool to easily modify flocking behavior
http://www.vergenet.net/~conrad/boids/pseudocode.html Teach you everything about flocking
http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/ OpenCL 1.0 reference man page
http://www.vergenet.net/~conrad/boids/pseudocode.html Teach you everything about flocking
http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/ OpenCL 1.0 reference man page
Something else
For this project, I dont have any basic ideas of opengl and opencl, so it's really cost much time to get it really started, and also for VS2008, opencl's library is kind of weird that always have LNK2005 err, so I start using simpleGL example from Nvidia's opencl SDK, it's really helpful to start from that.
Also opengl's reference man page is really helpful especially when there are error happying, ther will give you a very detailed explanation of the error.
Ok that's it, after a lot of non-sleep nights, I need to sleep now, haha.
Also opengl's reference man page is really helpful especially when there are error happying, ther will give you a very detailed explanation of the error.
Ok that's it, after a lot of non-sleep nights, I need to sleep now, haha.