Ideas to block roads?

Started by
15 comments, last by GFV 10 years, 6 months ago
In a racing game, some hint that you shouldn't go that way, like a crowd of fans, police and temporary roadblocks, a TV van is a fair enough warning before fading to black and ending the race in miserable failure as soon as you enter the forbidden zone. This approach requires level data for what can be seen, but actual trespassing is rigorously prevented.

Omae Wa Mou Shindeiru

Advertisement

Out of curiosity, do you have any AI in the world? I'm just curious as to how they'll react to barricades.

Well, it isn’t exactly a racing game in the sense that you’re during pure races, it’s more open world driving around (with races too of course) but only in vehicles.

So the idea about fans and TV vans wouldn’t really work.

Yes, there is AI traffic and the solution should be simple:

— If the roads are blocked, with any of the above mentioned methods, then the AI simply won’t go there. It will act as if there was no road at all there and it won’t turn into that corner

— If we use the half-transparent barrier idea, with the 5 seconds limit, then the AI could drive there and eventually disappear after another corner

The player wouldn’t get to see that obviously because his car would be reset.

Like ShadowFlar3 said, 5 seconds is a lot at racing speeds, but I’d like to have plenty of traffic, therefore you won’t be able to drive that fast (I don’t want it to be a “Drive-300-km/h-in-the-city” sort of game), but obviously first we have to check if it’s possible at all to have the amount of traffic we wish, chances are it can’t be handled. sad.png

Then again, even if a player would cross the transparent wall at highest speed, it’s not too much of a problem for the extra map. The map is done by another company that we hired and it would only cost us a little more.

Also, we could apply both methods: blocked road plus transparent barrier. We could make it so the road blocks can be destroyed (concrete barriers, police cars, whatever) but as a result the player would heavily damage his car and eventually even flip. At the same time he would have crossed the transparent barrier, meaning he wouldn’t have come far because his flipped / crashed vehicle will be reset in 5 seconds.

Well, it isn’t exactly a racing game in the sense that you’re during pure races, it’s more open world driving around (with races too of course) but only in vehicles.

So the idea about fans and TV vans wouldn’t really work.

Yes, there is AI traffic and the solution should be simple:

— If the roads are blocked, with any of the above mentioned methods, then the AI simply won’t go there. It will act as if there was no road at all there and it won’t turn into that corner

— If we use the half-transparent barrier idea, with the 5 seconds limit, then the AI could drive there and eventually disappear after another corner

The player wouldn’t get to see that obviously because his car would be reset.

Like ShadowFlar3 said, 5 seconds is a lot at racing speeds, but I’d like to have plenty of traffic, therefore you won’t be able to drive that fast (I don’t want it to be a “Drive-300-km/h-in-the-city” sort of game), but obviously first we have to check if it’s possible at all to have the amount of traffic we wish, chances are it can’t be handled. sad.png

Then again, even if a player would cross the transparent wall at highest speed, it’s not too much of a problem for the extra map. The map is done by another company that we hired and it would only cost us a little more.

Also, we could apply both methods: blocked road plus transparent barrier. We could make it so the road blocks can be destroyed (concrete barriers, police cars, whatever) but as a result the player would heavily damage his car and eventually even flip. At the same time he would have crossed the transparent barrier, meaning he wouldn’t have come far because his flipped / crashed vehicle will be reset in 5 seconds.

Sounds very ambitious which is good. And I'm sure you've already got your traffic system nailed, but here's some advice on this. The amount of traffic you desire will need to be managed both on the technical and design side of things if you want to avoid problems with flow and general AI logic. Things like bottlenecks, pile ups and traffics jams can cause major problems for a racing game. You may find that there's no traffic near you but if you look somewhere in the world there's a massive pile up of cars because the flow isn't right.

Things to consider when designing a traffic system are:

1. How many cars can be on the screen?

2. What happens when you reach your AI limit?

3. What path/spline will the vehicles be using?

4. Will the AI cross lanes?

5. Will the AI make U-turns?

6. Will you use traffic lights to control the flow of traffic?

7. What happens when an AI is forced onto the other side of the road by a player?

8. What happens if the player is stationary in front of traffic? Do you spawn more, does the traffic try to avoid the player?

9. How will the AI know the general direction of travel?

10. How much spacing will there be between AI cars?

11. What happens to an AI car which isn't on the screen anymore?

This list goes on and on for open world racing/driving games but it does get easier with trial and error. You can also take a look at traffic systems in games like Driver, GTA, Need for Speed and Burnout to see how they handle it. I know in Driver games that the AI will always turn right, which creates a looping cycle of right turns. Do players see this? Do they even care? It was a simple solution to a problem that could cause massive headaches for a designer & engineer.

Another solution which could help with the traffic system is infinite ribbons. Building a road network like a freeway which loops around the city and always has the same amount of lanes is a brilliant way to keep traffic consistent and flowing.

Those are some very good questions Herbert smile.png Most of these are sadly still opened, we didn’t even start yet with the traffic.

I think one question you forgot is how many polygons car will have, currently that’s my biggest fear. I want the game to be beautiful too of course and details are important to us all smile.png

The thing about cars turning only right in Driver games — I don’t think that’s completely right. I think it was only this way in the latest Driver game, and yep I noticed it ;) Did I mind it? Not too much, but after some time, every time when you start the game, you know which car will be where, which does make it look very scripted (well, it IS scripted after all).

Also thanks for mentioning the highway loop idea. In fact we do have such a thing. Not a highway but it’s a big main street which makes a circle around the district the game is set it.


I’ll answer your questions because it also helps me visualise the whole thing for myself smile.png

1. How many cars can be on the screen?

As many as possible I hope! We also want to put lots of parked cars, something you don’t see in many games, and I feel it’s going to be problematic. I’d also like to make traffic jams if possible. (for example for certain modes, etc.)

2. What happens when you reach your AI limit?

Cars would suddenly disappear to make space for other cars? laugh.png

3. What path/spline will the vehicles be using?

Every lane would be one path, I’d also like to make extra paths for, say if you drive with a police car, so civilian cars make some space and jump onto the other path. This path would be a bit more right into right lanes and a bit more left into left lanes. But we have to see how exactly we would do this, or if someone else would do this, I have no idea about how it works right now to be honest. Maybe it’s possible to just set an off-set to the default lane path when a police car is behind the civilian car in question, in that case it wouldn’t need to make an extra path at all. Probably that’s how it works?

4. Will the AI cross lanes?

I don’t think so, it would be cool but probably too complex to make, and I would like to keep the game really simple.

5. Will the AI make U-turns?

Same as above I guess!

6. Will you use traffic lights to control the flow of traffic?

Yes of course!

7. What happens when an AI is forced onto the other side of the road by a player?

It should brake of course, to not crash into oncoming traffic!

8. What happens if the player is stationary in front of traffic? Do you spawn more, does the traffic try to avoid the player?

Well, that’s one problem I’ve been thinking of already for a while. There are several solutions. One would be that the traffic avoids the player, another one would be that traffic would stop behind the player and start to honk. The first solution is probably more complex to make, the second one poses another problem which I’ve experienced in early Driver games. Let’s say you stop at a red light, as if you were driving completely normally… the cars come and stop behind you, and suddenly start honking. Why? You aren’t doing anything wrong. So how exactly would you solve this problem? We’d have to make special “fields” near traffic lights in which civilian cars would enter and then if the light is red they wouldn’t honk, if it’s green they would. I don’t think this will work… Probably at the start we’ll just make them stop behind the player’s car without honking at all.

9. How will the AI know the general direction of travel?

They’re going to have fixed paths?

10. How much spacing will there be between AI cars?

Normal space which you should keep between two cars when driving at 50 km/h in real life, except at red lights (or if the player stops in front of the traffic), they should come closer in that case!

11. What happens to an AI car which isn't on the screen anymore?

Good question. Is it possible to make them disappear and reappear very quickly? For example if the car is behind me. I see the car. I look back to the front. Car disappears. I look at the back, car reappears again. Is there such a system? Or would it take too long and the car wouldn’t show up in the first half second or so when I look back? I need to check how we can “spare” as many polygons on the screen (and in the whole scene) as possible, actually that’s someone else’s work but I still need to check this myself.

Do you have experience with making AI traffic? None of us does actually, it’s a complete new field. We’re far from doing the traffic system now but one day we’ll have to attack it I guess wink.png

Trial and error will certainly help you when you get this up and running. As long as you've got your rules down before hand it will make it easier to tweak in future.

I really recommend you have a read of this article on gamasutra:

http://www.gamasutra.com/view/feature/3106/ai_madness_using_ai_to_bring_.php

Some of it should be relevant to what you're trying to create.

Thanks, I’ve read it and it will definitely help us in the future smile.png I appreciate for sharing!

This topic is closed to new replies.

Advertisement