Opened 16 years ago

Closed 16 years ago

#82 closed enhancement (fixed)

Enhance position information stored about each car

Reported by: Henrik Heimbuerger Owned by: Henrik Heimbuerger
Priority: critical Milestone: MS1: First release (1.0.0)
Component: track Version: pre-1.0
Keywords: position, step counter Cc:

Description (last modified by Henrik Heimbuerger)

Currently, the position of each car is just stored as a simple int, representing the step counter.

For future extensions (lane changing in particular), it needs to have the following elements:

  • the information which lane the car is on
  • the step counter
  • the information whether the car is currently on a lane change path
  • the information whether the car is on the track in the first place (might have left due to speeding or crashing into another car)

Note that the step counter can change when a car changes from one lane to another, as not all lanes have the same step length.

Part of this ticket is also updating the TrackWidget to support drawing these cases.

Change History (13)

comment:1 Changed 16 years ago by Henrik Heimbuerger

Component: unspecifiedtrack
Description: modified (diff)
Status: newaccepted

comment:2 Changed 16 years ago by Henrik Heimbuerger

Status: acceptedassigned

comment:3 Changed 16 years ago by Henrik Heimbuerger

Also must include:

  • the current round the car is at

comment:4 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [270]):
[Fix for ticket #82, related to ticket #2] Enhanced position information stored about each car.

The position of the car is no longer a simple int, it is now stored in a CarPosition? instance.

What was formerly called a TrackPosition has now been renamed to CarScreenPosition for clarification. It is simply a helper class for passing some drawing information around and shouldn't be used outside the TrackWidget?.

In the context of this change, it was diagnosed that the race bean had never been properly set (e.g. the players were sometimes accessed directly via the players bean and sometimes via the race bean) which caused a rather huge related set of changes:

  • The race bean has been removed.
  • Classes that used the race bean so far are now directly using the players bean or the RaceEngine bean.
  • The validators get the players list as a parameter.
  • The RaceEngine methods startRaceTimer() and stopRaceTimer() have been renamed to startRace() and stopRace() because they have long been doing much more than just starting the timer.
  • The active track is no longer taken for the active editor's TrackWidget but directly from the editor.
  • The !DebugTDA now supports moving the cars more than one lap.

comment:5 Changed 16 years ago by Henrik Heimbuerger

Resolution: fixed
Status: assignedclosed

comment:6 Changed 16 years ago by Henrik Heimbuerger

Resolution: fixed
Status: closedreopened

To do: implement methods to move the car forward properly.

comment:7 Changed 16 years ago by SVN

New commit by frohn (revision [271]):
[Partial fix for ticket #82] Removed an error

comment:8 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [291]):
[Partial fix for ticket #82] Implemented a sample TDA.

comment:9 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [292]):
[Partial fix for ticket #82] Bugfix: CarPosition.moveSteps() didn't actually add the steps to move.

comment:10 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [311]):
[Partial fix for tickets #49 and #82] Intermediate commit for the implementation of lane change support.

The CarPosition no longer stores a global int to specify the car position on the track. Instead, it now stores a TrackSection and an int for the position of the car on the given section.

The tiles.xml now supports two ways of storing the LaneSections of a Lane. The new method is to specify three groups of LaneSections (and specifying the attribute isLaneChange="true" in the <lane> element):

  • sections inside <common/> are always taken (first)
  • sections inside <regular/> are taken after the common ones if no lane change was triggered
  • sections inside <change/> are taken after the common ones if a lane change was triggered

If the isLaneChange attribute is not set, lane sections are accepted right inside the <lane> element as it has been up to now.

The Lane's getLength() method and the Track's getLaneLength() methods have been removed as the length now depends on whether the lane change is triggered. The Lane's getStepPoint() method and the Track's determineScreenPositionFromPosition() have been slightly modified (incomplete).

The method moveSteps() on the CarPosition class has been adapted to the new way of storing lanes, but it doesn't support lane changes yet.

Two example tiles have been added to the debug tileset.

ATTENTION: The lane change support is incomplete, tiles with lane changes are not handled correctly right now and lane changes is *not* possible!

comment:11 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [318]):
[Partial fix for tickets #49 and #82] Implemented support for setting the exit lane of a lane, the lane a car will be on after leaving a tile.

The exit lane can be specified by giving the lane index (0-based) on the exitLane attribute of the <lane> element. This will be considered the regular exit lane. In the case of lane changing tiles, the same attribute can also be specified on the <regular> and <change> elements. The attribute on <regular> will overwrite the attribute on the <lane> element. The attribute on <change> will define the exit lane of the lane change path.
The attributes are entirely optional and the default is always to stay on the same lane.

The demo_crossing track has been enhanced by a crossover tile demostrating this feature.

comment:12 Changed 16 years ago by SVN

New commit by hheimbuerger (revision [319]):
[Partial fix for tickets #49 and #82] Implemented support for setting the exit lane of a lane, the lane a car will be on after leaving a tile. [MISSING PART]

The exit lane can be specified by giving the lane index (0-based) on the exitLane attribute of the <lane> element. This will be considered the regular exit lane. In the case of lane changing tiles, the same attribute can also be specified on the <regular> and <change> elements. The attribute on <regular> will overwrite the attribute on the <lane> element. The attribute on <change> will define the exit lane of the lane change path.
The attributes are entirely optional and the default is always to stay on the same lane.

The demo_crossing track has been enhanced by a crossover tile demostrating this feature.

NOTE: Added image file missing in the last commit.

comment:13 Changed 16 years ago by Henrik Heimbuerger

Resolution: fixed
Status: reopenedclosed

Completed with [359].

Note: See TracTickets for help on using tickets.