07-27-2007, 03:17 AM,
|
|
mpo
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 65
Threads: 18
Joined: May 2007
|
|
modify AI drivers and track
Hi,i have two questions:
1) i have tried to inspect the code but i don't find where the AI of the computer drivers is implemented.
2) What i have to do if i want to modify a track? i have to use Blender? if yes, what i have to do to import in blender the model of the track?
thanks.
|
|
07-28-2007, 05:53 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
1) It's in src/ai.cpp
2) What kind of modification do you want? Modify the track parameters, or actually modify the track objects? If it's the former, you can use track editor to do that. I don't think you can import the whole track into blender to modify the objects.
|
|
07-31-2007, 05:09 AM,
|
|
mpo
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 65
Threads: 18
Joined: May 2007
|
|
i want to modify the track object but i don't find the track editor, where is it?
Just an other question,i need that the car controlled by the computer run on the contrary in the track, i have tried to modify the function UpdateSteer, now the car run on the contrary but don't follow the street. Probably i haven't understand really well as it comes calculated the next angle of steering, someone say something about it?
thanks a lot.
|
|
07-31-2007, 08:14 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
At the car selection menu, there is an option 'Reverse Track'. If it's on, you will race in the reverse direction of the track. Is that what you want?
|
|
07-31-2007, 08:30 AM,
|
|
mpo
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 65
Threads: 18
Joined: May 2007
|
|
Not exacltly, i need that the other cars (the cars controlled by the computer) run in the opposite sense to mine.
I'm using Vdrift for a project and this is one of the point that i have to do..
|
|
07-31-2007, 01:48 PM,
|
|
mpo
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 65
Threads: 18
Joined: May 2007
|
|
it's a school project, i have interfaced the game with an head mounted display and now i have to modify something to test the ability of the user, one of this thing is modify the ai of the other car, so the user have to avoid the other cars during the game.
I have seen that i have to modify the function "updateSteer" in the file ai.cpp but with the modify that i have done the car turns on the contrary but don't follow the street..
|
|
07-31-2007, 05:04 PM,
|
|
kidrock
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 230
Threads: 17
Joined: Apr 2007
|
|
I see what you are saying. thats a bit out of my ability. any ideas joe? (good luck with your project!)
|
|
07-31-2007, 06:11 PM,
|
|
FFuser
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 147
Threads: 10
Joined: Jul 2005
|
|
mpo Wrote:I have seen that i have to modify the function "updateSteer" in the file ai.cpp but with the modify that i have done the car turns on the contrary but don't follow the street..
Well, I can be wrong, I never programmed the ai.
But I think it works as follows: It has a set of vectors that marks the street. from their it calculates the best route.
So if you reverse the set of vectors the AI is going to follow the opposite direction.
|
|
08-01-2007, 10:13 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
If all you want is to test the functionality, why not just set the 'reverse track' option? AI will drive in the reverse direction. You, as the player, can drive in whatever direction you want.
<edit>Come to think of it, there is actually no change required. Just let AI drive normally, and ask the player to drive in the reverse direction. Wouldn't this achieve the result you want?</edit>
|
|
08-01-2007, 02:17 PM,
|
|
mpo
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 65
Threads: 18
Joined: May 2007
|
|
Not exactly, with this solution the user have to change his direction when start the race, i have to modify the code to avoid it, in this way all will be automatic.
|
|
08-02-2007, 07:58 AM,
|
|
rookie1
Member
![*](images/star.png) ![*](images/star.png) ![*](images/star.png)
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Ok. If that's the case, all you need is to reverse the player's starting orientation.
If you want to do it programmatically, check out function TRACK::ReverseStartingPositions(). This function calculates the reverse starting position and orientation when 'Reverse Track' option is set. Note that this function calculates the reverse for all cars. In your case, you only need to reverse the 1st starting location and orientation in the list, which is what the player car uses.
<edit>Sorry, the reversing of start orientation is done in TRACK::Reverse(). The relevant lines are,
Code: //reverse start positions
for (vector <QUATERNION>::iterator i = startquat.begin(); i != startquat.end(); i++)
{
//*i = i->ReturnConjugate();
i->Rotate(3.141593, 0,1,0);
}
</edit>
|
|
|