- rookie1 - 03-02-2007
Best lap added in the result screen (r1575)
- thelusiv - 03-02-2007
I tried it out, and the best lap column looks good, but it still doesn't show any partial results - even if i finish the game and quit before the AI finishes, it doesn't seem to show my finished time or any best lap times. I'll look at it more tonight.
- rookie1 - 03-03-2007
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.
- thelusiv - 03-04-2007
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.
- rookie1 - 03-04-2007
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.
- thelusiv - 03-04-2007
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.
- thelusiv - 03-05-2007
The number of laps is now displayed under time for unfinished cars, SVN r1586. I also fixed the sorting. You were right, I needed a finished flag to get it to work right.
- thelusiv - 03-06-2007
I have removed the car color selector from the opponent car chooser on the Single Race menu in SVN r1592.
- rookie1 - 03-06-2007
Don't know whether it's related. It seems the player car color selector is also not working in single race mode.
- thelusiv - 03-06-2007
What do you mean? It seems to work for me.
- rookie1 - 03-07-2007
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.
- rookie1 - 03-08-2007
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.
- thelusiv - 03-08-2007
Good catch, I thought that might happen...forgot about that bit that sets up the setting on the wheel widget.
|