Autoupdate

From VDrift
Jump to: navigation, search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This page describes, at a high level, how the auto-update function works.

Introduction

One major barrier to releasing more often is the huge size of the VDrift releases. These large sizes are due to the large number of cars and tracks that are typically included in a release. If VDrift has auto-update functionality, then releases can be very minimal (one track and one car, for example) and people can download new cars and tracks (and keep their existing ones up to date) through an in-game interface.

The rest of this document talks exclusively about updating cars, but tracks should work similarly.

The auto-update functionality was first proposed in this forum post: http://vdrift.net/Forum/viewtopic.php?p=12999

User Interface

Several GUI pages have been added. From the main menu, the "Cars and Tracks" button takes the user to a page with options to check for updates and manage cars. When the user clicks "Check for Updates", the sourceforge svn browser html is scraped to get the latest revision numbers for the car folders. The car manager UI is populated from code and allows the user to see what updates are available and provides an "Apply Update" button.

Versioning

There are two types of versioning: the versioning for each car folder, and the versioning for the car format.

First, car folder versioning. The data/settings/updates.config file is distributed with each release, and contains the cars that have been included in that release along with their SVN revision numbers. When the game checks for updates, the sourceforge svn browser html is scraped to get the latest revision numbers, and that information ([available_cars] section) along with the current on-disk versions ([cars] section) are stored in an updates.config in the user's folder (~/.vdrift on Linux). The game offers to apply updates when the on-disk versions are less than the available versions.

Next, car format versioning. Sometimes, the format of car files changes in a way that breaks compatibility with old data files. To protect against updating cars to a format that the user's executables won't understand, format versions are stored in the updates.config file in the [formats] section. The version of the car format that the executable release understands is set in the data/settings/updates.config file included in the release (and copied to the user's folder). The game retrieves the latest data/settings/update.config via the sourceforge svn website and checks the format version there to make sure it matches the version number in the local update.config. If the format versions are not equal, updates will refuse to apply.

Updating

When the user clicks "Apply Update", the car format versioning is re-checked per the description above. If the car format versions mismatch, the game refuses to continue. Otherwise, updates are applied by fetching the .tar.gz bundle for a car's folder from sourceforge's http svn browser to a temporary folder (~/.vdrift/tmp on linux). This file then decompressed using libarchive into the settings directory (~/.vdrift on Linux) under a cars subdirectory. The game should look here first when loading car files, and fall back to the global data path. The downloaded file is deleted once the update completes successfully, otherwise it leaves the temporary file around for troubleshooting.