Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Training Tutorials
01-21-2008, 12:06 AM
Post: #1
Training Tutorials
There has been some talk in In order to view links, you must have to reply to this thread. about improving the user's experience by providing tutorials that teach players how to drive the car. This makes sense for a lot of reasons, and VDrift is at a point now where this shouldn't be too difficult to do.

Before this stuff is coded it makes sense to discuss 1) what it should be like, 2) how it should be implemented, 3) what the file structure will be like, and what art requirements there are. Here are my ideas. Feel free to add yours.

1. I think we should use a combination of replays and allowing the player to try it alone. Both methods should include instructions in the form of on-screen text (we can add spoken instructions as well, once we have the available audio). For instance, a replay should play first showing the player what to do, while instructions explain what to do, why, and how to do it. After the player has seen it once, they can try it themselves. The game should evaluate if the player has successfully completed a goal, and report this to the player. After that, there should be a menu with options for what to do next: show them what to do again, let them try it again, go on to the next goal, or exit the tutorial. When a player has completed all the goals in a tutorial they should be told how they did overall, and returned to the tutorials menu.

2. The best way to implement the tutorials is probably to write some kind of generalized Tutorial system. This way we can make lots of different tutorials. I'm imagining that we might have tutorials for drifting, "grip"/road racing, autocross, rally, etc. So naturally each tutorial needs a title and description. Also, there should be a player skill level associated with each tutorial to tell users who they are intended for. Something like beginner, novice, advanced, expert.

Since VDrift already has a replay system it makes sense to reuse this as much as possible for the tutorials. However they will need to be supplemented with on-screen text overlays as well as audio (eventually). So there will need to be a sort of tutorial script file to orchestrate all this. Each tutorial can be made up of separate sections, "lessons" or "goals" or whatever.

Here's what I imagine a sample tutorial config file might look like.
Code:
name = Beginner Drifting Tutorial
level = 0
description = Learn the basics of drifting.
car = TL2
track = DriftTutorial1

[lesson-0]
name = Simple Drifting 1
description = Drift using trail breaking (low speed)
events = 0, 1, 2, 3, 4

[event-0]
# introduce trail braking
instruction = The simplest method to drift is to use a method called trail braking. This method does not usually provide a spectacular drift, but it is pretty easy to do, and works on almost any car.
# allow-user-input defaults to off
allow-user-input = off
delay-time = 500
display-time = 10000
# show corner and empty track
replay-file = simple_drifting_0.vdr
audio-file = simple_drifting_0.ogg

[event-1]
# location
instruction = First, pick a corner that's not too sharp on a flat road, and figure out a reasonable speed to go on this road driving fairly normally.
delay-time = 1000
display-time = 10000
# show car driving normally around corner
replay-file = simple_drifting_1.vdr
audio-file = simple_drifting_1.ogg

[event-2]
# explain trail braking
instruction = Next, once you are familiar with the road and corner, try a new approach. This time, enter the corner slightly faster than usual, turn in late, and brake later and harder (but shorter).
delay-time = 1000
display-time = 10000
# show car trail braking to drift corner
replay-file = simple_drifting_2.vdr
audio-file = simple_drifting_2.ogg

# ... event 3 - countersteering ...

[event-4]
# now you try
instruction = Now you try. Approach this 35 MPH turn, and use trail braking to make the rear end of the car slide. If you can get a drift score of 25 you're probably doing it right.
# start and end point
drift-score-target = 25
audio-file = simple_drifting_4.ogg
allow-user-input = on
ghost-replay-file = simple_drifting_4.vdr

The ghost replay file will need to be one that starts from the same point as the player, starts from a stop, and does a "pretty good" performance on the lesson. We don't want the ghost to be too good, so the user will be able to improve to better than the replay. After the event in the lesson where the user gets to try, another lesson can be defined, with its own set of events. In allow-user-input = on mode, the car starts at a predefined start point facing a certain direction. The lesson ends when the car comes to a stop, leaves the track, or passes the predefined end point.

Using a system defined in a way such as this, it should be possible to auto-generate menus to link together the lessons. The menus needed will probably include:
  • Tutorials - list of tutorials
  • Lessons - list of all lessons in a tutorial in order, quits to Tutorials
  • PauseLesson - restart lesson/previous lesson/next lesson/quit current lesson, quits to Lessons
  • AfterLesson - retry lesson/next lesson/quit lesson/quit tutorial
  • AfterTutorial - show tutorial score, retry tutorial/return to menu, quits to Tutorials
The existing Game State class will need to be modified to include Tutorial modes, so the menu system knows to use the generated tutorial menus, and send commands to the tutorial system that do things like "start tutorial 5 lesson 6".

3. The file structure should be simple, with a data/tutorials folder containing all the available tutorials. Each tutorial will have a config file (tutorial.conf?) something like the example above. Each of the tutorial directories should have separate subdirectories for audio and replay files. There will need to be a way to ensure that a user has the necessary track required for the tutorial, perhaps one way to solve this is to include the track with the tutorial.

So the data required will be a track (though an existing one could be used), a configuration file to define the tutorial, some replays showing what to do, a script of what to tell the user, and voice-over audio files (optional).

Am I interested in coding something like this? Yes. Do I have time? No. I still need to package the last release for Linux first, and besides that I have a ton of work to do on other for-pay projects that I'm working on. However there's no harm in talking about it, in case someone else feels like working on it, or I do eventually have time, the design will already be done.

Besides, there are some issues that should be fixed before this is set up. I can think of at least one - replays created on 64 bit systems do not work on 32 bit systems, and vise-versa. (What about PPC systems?) This issue should be fixed so that the replays created for tutorials will work on any system.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-21-2008, 09:10 PM
Post: #2
 
Modifying the replay system to use the serializer class should make it work across various platforms.
Find all posts by this user
Quote this message in a reply
01-21-2008, 09:38 PM
Post: #3
 
Hmm, OK, well I think that should be a fairly high development priority then. Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
01-24-2008, 02:06 AM
Post: #4
 
I agree.
Find all posts by this user
Quote this message in a reply
01-24-2008, 05:11 PM
Post: #5
 
Anyone else have thoughts on how this should work?
Visit this user's website Find all posts by this user
Quote this message in a reply
01-25-2008, 01:04 AM
Post: #6
 
Recently I've been trying to improve the AI driver. I've ported the racing line algorithm from Remi Coulom's K1999 driver for TORCS. (For those interested, his paper is at In order to view links, you must have to reply to this thread. The algorithm is described in Appendix C. I'm still having trouble to get the car follow the racing line though.)

What I'm thinking is we can display the racing line as a training aid. This should help the newbie drivers somewhat. What do you think?

I've not find an easy way to display the line in-game with the new graphics engine. Any recommendations on how to do this?
Find all posts by this user
Quote this message in a reply
01-25-2008, 10:39 PM
Post: #7
 
I guess it depends how we want to display the line. An idea that springs to mind would be as a partially transparent, fairly thick blue line.

To draw something like that you'll need to create a drawable in the scenegraph, and then generate a vertex array with a bunch of triangles that will represent the line. I can explain specifics if needed.
Find all posts by this user
Quote this message in a reply
01-26-2008, 03:45 AM
Post: #8
 
I committed the racing line code into SVN. Currently for debugging the code writes a file 'k1999.path' which contains the co-ordinates for calculated racing line. To visualize, you can use gnuplot, do a "plot 'k1999.path' using 1:2 with lines, 'k1999.path' using 3:4 with lines, 'k1999.path' using 5:6 with lines", it will show the track and racing line in 2D.

I'll look into Joe's suggestion on how to draw it in-game when I have some time.
Find all posts by this user
Quote this message in a reply
01-26-2008, 04:26 AM
Post: #9
 
Very nice! Here's a screenshot I took of the plot of the racing line on Jarama:
[Image: 8_jarama-racing-line.jpg]
Visit this user's website Find all posts by this user
Quote this message in a reply
01-26-2008, 11:26 AM
Post: #10
 
Wow, looks cool. I'll try to post a detailed explanation of how to use the new graphic engine later tonight.
Find all posts by this user
Quote this message in a reply
01-26-2008, 02:31 PM
Post: #11
 
This is totally off topic, but whatever method is used to plot a line on the road could be easily adapted to put tire skid marks on the road...
Visit this user's website Find all posts by this user
Quote this message in a reply
01-26-2008, 10:06 PM
Post: #12
 
Okay, so the steps are:
1) Create a SCENENODE and DRAWABLE in the scenegraph
2) Set up the drawable
3) Generate the vertex array

You just have to do those once, and then it gets drawn every frame automatically.

When you're done you need to:
4) Tell the scenegraph to delete your SCENENODE

Here's how you do step 1:
Code:
SCENENODE & my_node = game.graphics.GetScene().GetRoot().AddNode();
DRAWABLE & my_drawable = my_node.AddDrawable();

Of course, you'll want to store the SCENENODE and DRAWABLE in some container class as pointers or something so you can access them later.

Step 2:
Code:
TEXTUREINFO tex;
tex.SetName("path/to/texture.png");
my_drawable.SetDiffuseMap(tex);
my_drawable.SetLit(false);
my_drawable.SetPartialTransparency(true);
VERTEXARRAY & my_vertarray = my_drawable.SetToVertexArray();

Step 3:
You need to build up arrays of normals (optional), vertices, faces, and texture coordinates, then do:
Code:
my_vertexarray.SetFaces(facearray,facearraysize);
my_vertexarray.SetVertices(vertexarray,vertexarraysize);
my_vertexarray.SetTexCoordSets(1);
my_vertexarray.SetTexCoords(texcoordarray,texcoordarraysize);

The face array is an array of int values where each 3 consecutive int values are indices into the 3 vertices/texcoords for the face. The vertex array is an array of floats where each 3 consecutive floats represent a vertex. The texcoord array is an array of floats where each 2 consecutive floats represent a texture coordinate. That might not make sense on the first read, so ask me to clarify if needed.

Step 4:
Code:
game.graphics.GetScene().GetRoot().Delete(&my_node);
Find all posts by this user
Quote this message in a reply
01-31-2008, 10:08 PM
Post: #13
 
I'm going on vacation in February and will be without net access. I can only work on it after I return. If anyone feels like to work on it before I'm back, please do so Smile
Find all posts by this user
Quote this message in a reply
02-02-2008, 11:03 PM
Post: #14
 
I might try this out but I'm not sure where to get the elevation at different points in the track. Joe, what's the easiest place to pull this data in from?
Visit this user's website Find all posts by this user
Quote this message in a reply
02-05-2008, 01:44 AM
Post: #15
 
double TRACK::Elevation(VERTEX)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)