|
Post by Power Supersport on Apr 6, 2016 17:03:42 GMT
OMG, I really need to see this traffic system because I am very excited about the game...
|
|
|
Post by MonstaWolf on Apr 7, 2016 14:06:11 GMT
Basically, the way the traffic system works is: So far, it only needs one car, but I'm hoping to add a few more so you can have more than one car on the screen at once. Basically what happens is, I have a bunch of waypoints placed around the map, specifically ordered so the car will go to the correct one. It's made up of several looping paths, and the traffic car will stay on the loop it spawned on. As you drive around, the system will detect if you are a certain diatance away. Once you get that far away from it, the traffic car will respawn to the point closest to a skinmesh which is placed in front of the car (and is invisible), as long as the point is a certain distance away from the car (so you don't see it spawn). If the point is to close, the script tries again. It keeps doing this until it finds a point in the criteria (close to the player but not too close). When it spawns, it instantly goes to the next point in the loop, hence making it drive. Each time it spawns, the skinmesh changes to a random traffic car so you don't see the same one around the map. And, it has a failsafe on it, too. If the system notices that the traffic car is too far away (a certain distance), it will activate an EventTimer which resets the car every 2 seconds until it finds a point that is close enough and matches the criteria. It seems to work fluently; authough there is still a little bit of work to do on it, as it bugs out every great once in a while, and, as I said, I need to add a second one so the city doesn't seem like a place of poverty
|
|
|
Post by MonstaWolf on Apr 7, 2016 14:08:31 GMT
I will try to find a way to record it and show you
|
|
|
Post by commended on Apr 9, 2016 9:30:31 GMT
A Burnout style game?? That's a great game. Is the traffic system working well? Yeah, it's working pretty okay. Still working on a better render system, as well as filling up the (huge) city. I know how to make render distance (well distance detail) //LOD system manager for the SkinMesh object. //Usage: //See SkinMesh help file for details on how to make frame //based animation sequences for the skinmesh. //Make reduced-poly versions of the skinmesh model //and save them as animation frames (001_mesh.x, 002_mesh.x etc) //to the SkinMesh's data folder. //Link this script to the camera and to the SkinMesh object. //In the script below make sure that OBJ_0 is the camera and OBJ_3 //is the SkinMesh to LOD-manage. int DistanceThreshold = 20; //maximum lod distance, in meters int LODMeshesCount = 3; //number of LOD meshes void Main() { Vector3 cameraLocation; Vector3 meshLocation; float distance; iObjectLocation(OBJ_22,cameraLocation); iObjectLocation(OBJ_66,meshLocation); distance = iVectorLength(meshLocation - cameraLocation); OUT_66 = iFloatInterpolate(distance,-10,DistanceThreshold,0,LODMeshesCount-1,true); } Just make less detailed models and place them in your skinmesh folder. The rest is pretty self-explanatory. All the information you need is in the script:)
|
|
|
Post by MonstaWolf on Apr 27, 2016 12:26:39 GMT
Thanks! I will definitely check that out.
|
|
|
Post by Famer on May 22, 2016 14:22:19 GMT
I tried to make a city, but I have to add so many CarAI in order to make all the cars run, can you guys help me in any other way, because the vehicles are too slow and are not driving in the specified path. Any help would be appreciated.
Thank You.
|
|
|
Post by MonstaWolf on May 23, 2016 11:54:38 GMT
It takes a while to create a proper traffic system. You can't just have all of the cars spawn in at once, as that would obviously make it lag. You need to make a few cars that give the illusion of a city full of cars. It requires a lot of scripting, as well as paths placed on every road that you want a car to drive on. I'd recommend you spend the time to learn basic scripting. We have a few tutorials up on this site, and are always here to help
|
|
|
Post by Famer on May 23, 2016 15:23:26 GMT
I do not know any bit about angelscripting. But I try to figure out someway without scripting. Can you help me with the script? Any help would be appreciated. Thank you.
|
|