03-02-2007, 10:07 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Best lap added in the result screen (r1575)
|
|
03-03-2007, 05:25 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
The race results are held in the gamestate object. The update of race results at end of race happens in VAMOSWORLD::Update(). Here is the code block,
Code: if (race_ended && (state.GetGameState() != STATE_ENDRACE)) //display race results
{
state.SetGameState ( STATE_ENDRACE );
state.ClearRaceResult();
for (unsigned int i=0; i<world>m_cars.size(); i++)
{
state.SetRaceResult(i, timer.GetTotalTime(i), timer.GetBestLap(i));
}
state.SortRaceResult();
}
When you quit the race before all AI cars finish, this block of code might not get called.
|
|
03-04-2007, 06:55 AM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
i moved the stuff nested inside the if statement in the block of code you mentioned above into a function VAMOSWORLD: isplayRaceResults, so that I could call it from Gui: rocessAction. Now however the results seem incorrect, if I leave the race before one or more of the cars finish, one of the car's names is missing, and the ones that are not missing seem on the wrong data...and some of the data seems incorrect (very short total time).
Also, for some reason, sometimes now when I'm racing with opponents, my position will change erratically between all possible values. Sometimes it is correct, other times it jumps around. I'm not sure why this is. It seemed to start after I added support for choosing opponents.
|
|
03-04-2007, 09:36 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Didn't have time to change the code and test it out. So I'll just list down what i've found by scanning through your changes,
1.Missing car name - When you create the AI cars, there is an index variable 'i', which starts from value '1'. I think it should start from value '0' as per my original code.
2. Error in total time - The total time is only incremented when a car finishes one lap, i.e. the total time = total time to finish lap 1 when the car finishes 1st lap. the total time = total time to finish lap 1 + total time to finish lap 2 when the car finishes 2nd lap. If you stop the game before the car finishes lap 2, the accumulated total time will still reflect only the lap 1 time. To properly handle this, i think we need to have a flag to indicate whether a car has finished the whole race. In GAMESTATE::SortRaceResult(), this flag should be checked so that those cars did not finish the race should remain at the bottom. And in the result screen maybe we should display '+1 lap', '+2 lap', etc instead of the time.
3. Position display - Did you happen to notice this on Monza? Currently the position display works correctly if there is only 1 road strip defined for the track. The way the race position works is by tracking the relative distance between the current patch the car is on and the patch marked as 'lap sequence 0'. If the current patch is on a different road strip, there is no way to calculate the relative distance between this patch and the 'lap sequence 0' patch. And the position display becomes erratic. Monza is such a case.
4. One comment on opponent selection - player is allowed to select the opponent car color, but it's ignored in game. Opponent car is still using random color. Either we need to remove the color selection, or add another config variable to hold the opponent color.
|
|
03-04-2007, 02:49 PM,
|
|
thelusiv
Administrator
|
Posts: 2,346
Threads: 223
Joined: Jun 2005
|
|
rookie1 Wrote:1.Missing car name - When you create the AI cars, there is an index variable 'i', which starts from value '1'. I think it should start from value '0' as per my original code. I fixed this, I meant to removed the "i+1" bit below after starting it at 1 instead of 0. Missed it, thanks for catching that.
rookie1 Wrote:2. Error in total time - The total time is only incremented when a car finishes one lap, i.e. the total time = total time to finish lap 1 when the car finishes 1st lap. the total time = total time to finish lap 1 + total time to finish lap 2 when the car finishes 2nd lap. If you stop the game before the car finishes lap 2, the accumulated total time will still reflect only the lap 1 time. To properly handle this, i think we need to have a flag to indicate whether a car has finished the whole race. In GAMESTATE::SortRaceResult(), this flag should be checked so that those cars did not finish the race should remain at the bottom. And in the result screen maybe we should display '+1 lap', '+2 lap', etc instead of the time. I've started adding a lap counter variable to the timer - this will come in handy with displaying each car's number of laps in the timer too, and seeing if a car has finished all laps at the end (and if not displaying # of laps remaining as you say).
rookie1 Wrote:3. Position display - Did you happen to notice this on Monza? Currently the position display works correctly if there is only 1 road strip defined for the track. The way the race position works is by tracking the relative distance between the current patch the car is on and the patch marked as 'lap sequence 0'. If the current patch is on a different road strip, there is no way to calculate the relative distance between this patch and the 'lap sequence 0' patch. And the position display becomes erratic. Monza is such a case. Yes, this was on Monza - I've been using this to test since it has 4 start positions and loads quickly. Do you mean that this track has two different track sequences? How can we fix this? Ditch one of the track sequences for now?
rookie1 Wrote:4. One comment on opponent selection - player is allowed to select the opponent car color, but it's ignored in game. Opponent car is still using random color. Either we need to remove the color selection, or add another config variable to hold the opponent color. Well, I could add a switch for the spinning car widget to turn off the color selector and leave it random. That adds a little surprise to the AI and also if you select several of the same car, you can tell them apart. Most people would probably pick default color AI anyway.
I haven't checked in the changes I mentioned above, I'm going to finish getting the sorting and remaining lap count thing working better first. I'll probably finish it up and check it in tonight.
|
|
03-06-2007, 11:16 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Don't know whether it's related. It seems the player car color selector is also not working in single race mode.
|
|
03-07-2007, 05:05 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
thelusiv Wrote:What do you mean? It seems to work for me. If you quit a single race, change the player car color, then start a race again, the player car does not change color.
thelusiv Wrote:Yes, this was on Monza - I've been using this to test since it has 4 start positions and loads quickly. Do you mean that this track has two different track sequences? How can we fix this? Ditch one of the track sequences for now? There is another bug which causes the position display to jump around on Monza. I've fixed that in r1600. The position display should not be jumping around now.
However, the multiple road strip problem is still there. For example, on Monza, the starting line is on one road strip. The pit lane is another road strip. And when these 2 join, a new road strip is started (where you can see the texture of the track change). To solve this, we may need to re-trace the track.
|
|
03-08-2007, 11:11 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Quote:If you quit a single race, change the player car color, then start a race again, the player car does not change color.
Ok, found the cause. In Single Race menu page, there are 2 spinning car widgets defined. One for player car, one for AI car. Both widgets will create a wheel widget for color selection, although the AI car's color wheel is hidden. And both wheel widget is tied to the setting "game.car_paint". So the AI car's color (which is fixed at 0) will always overwrite player car's color selection. Fixed in r1606.
|
|
|