AI for deployment of sprites in racing game
I'm making a top down 2D scrolling shooter/racer game. You start from the bottom and work your way to the top. The objective is to beat the clock and avoid traffic. You can shoot enemies, but must (at all costs) avoid innocent by standers. The player is placed in the center of the screen and is unable to move up or down (just right and left) and the camera always keeps the player in the center (unless the player reaches the fart left or right walls) while the terrain moves underneath. Basically the player moves up the map and enemies/by-standers can come from the top or bottom. I've written a level editor for the engine that I've created (which I plan on using for many more games to come). In this level editor the artist/level designer can create paths for sprites to follow. A path is simply an ordered list of x,y coordinates in the world. Also in the editor you can define friction to tiles (yes, it's a tile based level editor) on the map. Friction can be used for a number of things, it's basically up to the programmer (ie: slow the player down here, don't allow the player to enter here, etc. etc.). Ok, with that being said. here's my question. I'd like to know if anyone out there has some good ideas for the deployment of traffic. I'm creating all of the levels with 4 lanes: 2 north and 2 south, a fast and slow lane in each direction. I was thinking about just placing the enemies at the top (or bottom if coming from below) of the screen where the camera's edge intersects the path, and associating the sprite with that path. The problem with this is that I'd like there to be varying speeds of traffic, so the sprites would have to be smart enough to pass eachother, or move out of the way of faster sprites behind it. Another option was making the sprites stay inside of the road using the friction tiles (ie: make the sprite try to stay inside of the road where no friction is). If anyone has an ideas/experience, please share :)
Quote:
Original post by brian_krux
Ok, with that being said. here's my question. I'd like to know if anyone out there has some good ideas for the deployment of traffic. I'm creating all of the levels with 4 lanes: 2 north and 2 south, a fast and slow lane in each direction. I was thinking about just placing the enemies at the top (or bottom if coming from below) of the screen where the camera's edge intersects the path, and associating the sprite with that path. The problem with this is that I'd like there to be varying speeds of traffic, so the sprites would have to be smart enough to pass eachother, or move out of the way of faster sprites behind it. Another option was making the sprites stay inside of the road using the friction tiles (ie: make the sprite try to stay inside of the road where no friction is).
If every car has a current lane and a current and desired speed, at every tick it can accelerate or brake or maintain speed if it wouldn't cause a collision with the cars ahead and behind and it can change lane in either direction if there is enough room.
Among permissible moves, the car can execute a lane change to pass a car ahead (if slower than the desired speed), to let a close car behind pass (assuming it wants to pass), or at random.
Acceleration or deceleration could be limited by the desire to maintain a minimum distance from the cars ahead and behind; cars could be more or less willing to exceed their target speed to keep pace with other cars.
Omae Wa Mou Shindeiru
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement