WIP Beta released Pacenote director & extended co-driver

Discussion in 'Scenarios' started by lellolillili, Dec 30, 2021.

  1. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Released on the repo, see https://www.beamng.com/resources/pacenotedirector.21824/

    Configuration
    See repo link.


    TUTORIAL: Make your own Time Trials with pacenotes
    scroll down to section "Recce" if you just want to know how to change a couple of pacenotes and go on with your life

    Create a new Time Trial with pacenotes
    Creating a rally with pacenotes is effectively the same as creating a Time Trial with many waypoints. If you don't know how to create a Time Trial, you may want to look that up first (I will briefly explain that here though). In this guide, we'll name our new rally "myRally".

    Preparing
    Unpack the mod and find out where your local BeamNG folder is. In what follows, it is Local/BeamNG.drive/. Note that I use slashes instead of backslashes.

    Getting started by cloning an existing rally
    We'll copy one of the mods' rallies from the mod's folder to our local level folder. Go to

    Local/BeamNG.drive/0.26/mods/unpacked/pacenoteDirector/levels/italy.

    copy any one of the lua files (we'll use Castelletto.lua in this example), paste it to

    Local/BeamNG.drive/0.26/levels/italy,

    and rename the file you just pasted to myRally.lua. You'll need to create the folder if it doesn't exist already. This is the file that tells the game to load up the mod every time you play one of the rallies.

    Go to the mod's italy/quickrace folder

    Local/BeamNG.drive/0.26/mods/unpacked/pacenoteDirector/levels/italy/quickrace,

    copy the following files
    1. Castelletto.json
    2. Castelletto_forward.prefab
    3. Castelletto.prefab
    and paste them into

    Local/BeamNG.drive/0.26/levels/italy/quickrace. Rename the files you just pasted to
    1. myRally.json
    2. myRally_forward.prefab
    3. myRally.prefab
    1. has Stage info and waypoint order, 2. has waypoints and start/finish stage stuff, and 3. has barriers, stage clutter, and all that. You can use stage clutter to change a map quite a lot. You can add bridges, big stones, and other fun stuff to create new paths or block old ones. Use your imagination.

    You may also add a thumbnail, myRally.jpg.

    Open up myRally.json with a text editor and change the track name, description, etc.

    Launch the map editor
    Launch the game and start the Time Trial you just created. Don't worry if your car starts falling from the sky. It's just a waypoint name mismatch that you will fix soon.

    Launch the F11 menu. Open the scene tree and look for the prefab. You'll find it after scrolling all the way down, in the MissionGroup group. It will be named myRally, and have a little package icon. Right-click, unpack it, and expand it so you can see the list of waypoints. The first thing you'll notice is that there are a lot of waypoints. This is because they serve multiple purposes, which I explain now.

    upload_2022-3-2_21-32-31.png

    Waypoints
    1. Waypoints carry pacenotes describing features of the road such as corners, crests, and dips. They are placed at the features (e.g., at corner entry, at the beginning of a crest, or on a dip). I can't stress this enough: the whole point of this workflow is that you put a waypoint at a corner, and describe it in the pacenote field. The pacenote director will handle the timing.

    upload_2022-3-2_21-29-29.png

    2. Waypoints define the stage. Distances between any two points are calculated with respect to the rough outline of the track that is defined by the waypoints. The better the waypoints follow the road, the more accurate these distances will be. Examples of distances that are used by the mod are a) the distance between two pacenotes, b) the distance between your car and the next pacenote, c) total track length, d) distance traveled so far. There are more, but you get the idea: if there aren't enough waypoints, these distances will be inaccurate and the pacenote director will behave badly.

    3. Waypoints act as a (very unsophisticated) track-cutting prevention system. Since you have to pass through every single waypoint to finish the track, skipping one will mess up your lap. For this reason, you should be generous and use large radius waypoints (significantly larger than the road width). More sophisticated systems such as time penalties and wrong way detection are a bit overkill for now, given the stage of the mod.

    In your usual rally, many waypoints will be blank. An empty waypoint either does not have the pacenote dynamic field at all or has its value set to pacenote="empty".

    upload_2022-3-2_21-29-51.png

    Creating your own rally
    Remove all the pacenotes from your prefab on the scene tree except the spawn point, start, finish, and the very first waypoint (shift+click to select multiple waypoints from the scene tree). These are usually named something_start, something_finish, and something_wp1. It's highly recommended that you rename the waypoints to something unique, for reasons that are beyond the scope of this tutorial. in this case, you can use my_rally_wp1, or myRallywp1 (anything al long as it ends in '1').

    You need to change the spawn point name, in this case to myRally_standing_spawn. The part before _standing_spawn must always match the json filename (from myRally.json), otherwise, your car will spawn at the wrong place. Don't get too worried about names, you can always rename everything at the end by opening your prefab file with a text editor and doing find-replace. Just always be careful with the name of the standing spawn.

    Your starting point now should be a prefab names myRally, with the following objects inside

    myRally_standing_spawn
    myRally_start
    myRally_wp1
    myRally_finish

    Make sure the dynamic field in the first waypoint is set to "empty" (not crucial, but convenient, as you'll find out.) Copy the first pacenote, myRally_wp1. Here's your basic workflow, for the most part: Paste the waypoint (the pasted waypoint will be conveniently renamed to myRally_wp2), and navigate with the free camera to where you want to put the next waypoint (e.g., at a corner's entry), hit the shortcut for "move object to camera", and edit the pacenote dynamic field if you need to. Paste the next node, and do the same.

    The last waypoint must be myRally_finish, and the first one must be myRally_start. Place them accordingly. myRally_standing_spawn is where your car will spawn, and should be in the middle of myRally_standing_spawn. Place it and rotate it so that your car will not spawn upside down.

    Protip: re-map "move object to camera" to "V" from Options>Editor (or some other shortcut that's convenient to hit right after CTRL-V, because you're gonna be doing a lot of that).

    The list of available calls is in the file AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenoteDirector/scripts/pacenotes/pacenotes.json.

    Note: you have to press enter after writing the note in the field!

    Note: blank nodes can be either pacenote="empty", or not have the pacenote field altogether.

    Pacenotes and markers
    The co-driver will always say the distance to the next pacenote after the call. For example, a few calls in a row will sound something like

    "3 left 40", "6 right 100", "tightens bad 50", "line 300", etc.

    Distances are calculated automatically. For medium and long corners, as well as hairpins, it's recommended that you add a "marker waypoint" to specify where the corner ends. Marker behavior is best explained with diagrams. This is done by adding the dynamic field marker to the waypoint. This is how markers work:

    (P) = waypoint with pacenote
    (P) = waypoint with pacenote
    (M) = waypoint with marker
    (PM) = waypoint with pacenote AND marker


    Code:
    case 1: No marker between 2 pacenotes
    If the corner is very short or you're just describing a feature of the road with no relevant length (rock, kink...), just say the dist from the next corner or feature.
    ( P ) ----- ( ) ---- ( ) ----- ( ) ----- ( P )
    
    case 2: one marker between 2 pacenotes.
    If the corner is > 30 meters, you should mark the end of the corner. The only marker is interpreted as the end of the corner you just called.
    ( P ) ----- ( M ) ---- ( ) ----- ( ) ------ ( P )
    
    You make a waypoint act as a marker by adding a dynamic field named "marker" to the waypoint. The content doesn't matter, but it'll be 0 by default. Also, note that putting a marker field on a non-empty pacenote does nothing. If this is confusing to you, look for a waypoint with a marker dynamic field in the examples. I'm sure it'll make sense once you see it in action.

    upload_2022-3-2_21-31-49.png

    If two pacenotes are closer than some cutoff distance, the co-driver will not say the distance, but it will add a link word at the beginning of the next call. The cutoff is specified in the settings/rallyconfig.ini configuration file. The cutoff and the link word can be configured. If you set the link word to "and", and the cutoff to 40, the utterance "3 left 40", "6 right 100" will become "3 left", "and 6 right 100". Look at the config file for the defaults and recommendations.

    As far as saving the prefab, packing, unpacking and exporting it, saving it as a mod, etc, you can just treat it as a normal prefab. Once you're done, either save or pack the prefab. Packing is recommended, but there's no problem with just hitting save if you know what you're doing.

    Finishing up

    Pack the prefab. With a text editor, open

    Local/BeamNG.drive/0.26/levels/italy
    /quickrace

    You'll see a list of waypoints. This list must match the waypoint you have defined in your prefab.

    Note that quick edits to pacenotes can be done directly with a text editor on the prefab file. No need to relaunch the game and open the map editor. Note, however, that if you mess something up, it'll be very hard to troubleshoot. When in doubt, backup first.

    Common errors and tips
    Waypoints in the prefab file and the json file must match. The spawn point must be named correctly, json and prefab must have the same number of waypoints, and their names must match.

    If you make a mistake and create a dynamic field whose name has whitespace in it, the game will throw an "expected X, got nil" type of error, without telling you which pacenote is the cause of the issue. You're going to have to go through the text prefab file and check every single pacenote.

    If you unpack all the prefabs for a map at the same time, you can quickly see which routes you've already used for a rally. This is useful when you want your rallys to cover the entirety of a map with no overlap.

    Create a Time Trial (quickRace) with pacenotes
    Suppose you want to do a new Time Trial with pacenotes for gridmap_v2.

    1. Copy paste the folder structure for a Time Trial and all its files. These are

    BeamNG.drive/0.24/levels/gridmap_v2/quickrace/testRally.json
    BeamNG.drive/0.24/levels/gridmap_v2/quickrace/testRally.prefab
    BeamNG.drive/0.24/levels/gridmap_v2/quickrace/testRally_forward.prefab
    BeamNG.drive/0.24/levels/gridmap_v2/testRally.lua


    2. Launch a Time Trial, open map editor, unpack the prefab, and edit waypoints and their pacenotes.

    3. Pack the prefab. This should save the new prefab on top of the new one. Packed prefabs are relatively readable, so you can do quick edits to it with a text editor if needed (e.g., a quick edit to a pacenote).

    4. Update the race order in testRally.json.

    Random notes about saving pacenotes and prefabs
    Suppose the Time Trial is published as a mod. If my mods' level folder is set up as follows
    Code:
    BeamNG.drive/mods/unpacked/rally/levels/gridmap_v2
                                         ├── rally.prefab
                                         └── scenarios
                                             ├── rally.json
                                             └── rally_thumb.jpg
    
    then, upon saving the level from the F11 menu, the following file is created in my local level folder:

    BeamNG.drive/0.24/levels/gridmap_v2/main/MissionGroup/rally_unpacked/items.level.json,


    which is essentially a raw prefab. It shows up in the scene tree as rally_unpacked, and as far as I can tell overrides the prefab provided by the mod. If I pack it, a local prefab is created in the map's folder

    BeamNG.drive/0.24/levels/gridmap_v2/rally.prefab

    and the mission group subfolder disappears.

    Doing recce (a.k.a changing the pacenotes you don't like)
    Once the pacenotes are done, the fun just begins, because I want players to be able to tweak and personalize the notes, by allowing them to do their own recce.

    upload_2022-3-2_21-30-12.png

    Copy all the prefabs that end in _forward.prefab into your local beamng folder, recreating the correct structure.

    Waypoint information is displayed in the console (~). Pause the game whenever you find a pacenote you want to change. Find the exact waypoint name in the console (it has all the necessary information), open prefab with a text editor, CTRL-F to the waypoint, and change the pacenote. See pic. The list of available calls is in the file AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenoteDirector/scripts/pacenotes/pacenotes.json.

    You can also change the pacenotes by opening the F11 menu and unpacking the prefab. Don't forget to repack it.


    How the mod works
    I'm using the Pacenotes Core mod to utter the calls, and the game's built-in waypoint-based race logic to handle the scenario. In practice, you are playing a normal Time Trial, but with pacenotes. The pacenote director can also run on top of scenarios. It works as long as the prefab has waypoints, and waypoints have pacenotes in them.

    Pacenotes are added to waypoints, which I'm also using to define rough track limits. During the race, the pacenote director figures out when to say the pacenotes and will calculate distance calls automatically. A distance call is the distance from the current pacenote to the next pacenote. If you marked two waypoints that are 100 meters away as, say, "3 left" and "crest", the co-driver will automatically say "3 left, 100 [PAUSE], crest ...". The director will utter a call T seconds before you cross the waypoint, basing the estimate on the current car speed and other stuff that you have control over. You can configure T in the config file.
     
    #1 lellolillili, Dec 30, 2021
    Last edited: Oct 10, 2022
    • Like Like x 3
  2. BlackMetal

    BlackMetal
    Expand Collapse

    Joined:
    Aug 10, 2013
    Messages:
    146
    So I'm making a map that includes a few rally stages. I'm very interested in testing this.
     
  3. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Yeah that map looks perfect for rallies.

    If you already know how to create time trials then it's gonna be super easy. The process is virtually the same. I'll PM you.
     
    #3 lellolillili, Dec 31, 2021
    Last edited: Dec 31, 2021
  4. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Small update.

    I've decided that the the UI app was overkill, since I can do exactly the same thing by printing waypoint information on the console.

    This means that I don't have to mess around with angularjs and I can spend more time making pacenotes.

    I've now written pacenotes for a bunch of long special stages and I'll start uploading them as soon as I find some time to test them with my wheel.

    Still very early to release anything, but do PM me if you're curious and want to test this out.
     
    • Like Like x 1
  5. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Beta testing has started! Please go ahead and test it out by downloading the rally pack (point 3, installation section in the original post). I'm sure we're gonna have to do a bit of back and forth to make this work properly as there's a few moving parts to this. Fingers crossed. And read the guide!
     
    #5 lellolillili, Jan 6, 2022
    Last edited: Jan 6, 2022
  6. alex1dp

    alex1dp
    Expand Collapse

    Joined:
    Mar 5, 2017
    Messages:
    67
    Overall, this seems to be a very well thought out system. The automated timing of the calls is especially nice.
    The only problem i've found is that sometimes, especially on louder cars, the calls can get drowned out by the engine and transmission sounds. If possible, a separate volume setting would be nice.
     
    • Like Like x 2
  7. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Thanks for the input. Just confirming: have you tried with my sounds or the original Pacenotes Core mod sounds? I'm asking cause I think mine are a bit louder.

    Regardless, I agree that the mod needs a volume button for the co-driver. Unfortunately the audio part is handled by the Pacenotes Core mod by Dummiesman, so it's not really my job to add that feature.

    Maybe you could ask Dummiesman to add that? I see from his code that there are some sort of hardcoded defaults, including a volume setting (unpack his mod and look through his code, Ctrl f volume). It's probably just a matter of implementing a volume change option.

    In any case, this seems important enough that I may try to find a hacky solution for now. Would you mind telling me a car that's a particularly bad offender? I've tried group B bolide, the rally Cherrier, Autobello Piccolina, and the volumes sound great in all of those (hood cam). That's why I have been ignoring the volume issue so far tbh.
     
    • Like Like x 1
  8. alex1dp

    alex1dp
    Expand Collapse

    Joined:
    Mar 5, 2017
    Messages:
    67
    The worst offenders I've found so far are the Group 4 Bolide and the rally Vivace, but I use the driver camera, so everything sounds muffled.

    I tried both yours and the original sounds, and I've found the originals to be louder, but I may have messed with the files earlier and forgotten about it.

    I'll have a look at the Pacenotes Core and change the values there for the time being.
     
    #8 alex1dp, Jan 7, 2022
    Last edited: Jan 7, 2022
  9. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Ah yeah I haven't tested with the inside camera yet, I use hood. I'll have a think about how to go about this. Thanks
     
  10. angelo234

    angelo234
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 11, 2017
    Messages:
    540
    I've tested it out now and its pretty nice. One suggestion I've got though is that in order for the mod to work without having to unpack the zip file, the art, scripts, lua, etc. folders need to be the top level folders in the zip file and not have them inside of a top level folder. Also when there are many successive corners, I think the co driver needs to call the pacenotes earlier and space out the calls more, since it's kinda overwhelming for me lol and maybe don't say the distance if its less than or equal to 50 meters or something.
     
    #10 angelo234, Jan 8, 2022
    Last edited: Jan 8, 2022
    • Like Like x 1
  11. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Thank you so much for testing. Hopefully you also enjoyed the stages.

    Indeed, the pacenote director could use with with a more sophisticated handling algorithm. I'm thinking 2 calls in a row is perfectly reasonable and in fact desirable, but the 3rd call in a row probably needs additional padding. This is especially true for newcomers cause it takes time to get used to listening to pacenotes while driving. Incidentally, this is why I made the pacenotes very light (normally, I'd add twice as much detail for personal use).

    So it makes a lot of sense that I add your suggestion to my to-do list, thanks!

    However, if you feel like all calls are coming a bit too early, I think that adjusting the callout time (and position offset) might solve the problem of having too many calls in a row. Try 0 for position offset and 2.5 seconds for time offset. Have a look at the config file to adjust those.

    Ah, the distance thing is configurable, just set the cutoff to 50 and it won't say 50 anymore. It will just prepend "and" to the next pacenote instead. If you don't like "and", you can configure that too (you can put an empty string in it so that it won't say anything)
     
    #11 lellolillili, Jan 8, 2022
    Last edited: Jan 8, 2022
    • Like Like x 1
  12. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Re: the volume. See configuration section in my post above. I explain how to make it louder. Also, you may wanna check out my rally pack thread, I posted 7 more stages.
     
    • Like Like x 1
  13. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Update: just made the installation process slightly easier. You now only have to extract one zip file, but in order to use my co-driver voice (which is highly recommended), you need to rename the following folder

    /AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenotemod/art/sound/pacenotes
    to
    /AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenotemod/art/sound/pacenotes_original


    as well as this file here
    AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenotemod/scripts/pacenotes/pacenotes.json
    to
    AppData/Local/BeamNG.drive/0.24/mods/unpacked/pacenotemod/scripts/pacenotes/pacenotes_original.json

    Thanks @BlackMetal for feedback about the installation process.
     
    #13 lellolillili, Feb 20, 2022
    Last edited: Feb 22, 2022
    • Like Like x 1
  14. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Released! Please help me debug!
     
    • Like Like x 1
  15. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,096
    Do you still need to rename the sound folder in the pacenotes core to have your sounds ?
     
  16. pacifistduck

    pacifistduck
    Expand Collapse

    Joined:
    May 9, 2020
    Messages:
    113
    Is there any way to disable checkpoint sfx? I entered a few random stages with pacenotes and they're still there. On the good side of things, checkpoints are no longer visible on my end.

    I also encounter a few bugs. will update after I clean up my mods and clear caches.
     
  17. lellolillili

    lellolillili
    Expand Collapse

    Joined:
    Nov 29, 2021
    Messages:
    128
    Should no longer be necessary, but definitely do that if you're hearing the old sounds.

    Unelated: do you hear checkpoint sfx when passing through waypoints?

    Yeah they should be disabled. At first I had to restart with R in order to disable them, but after a while it started working properly. No idea why. Try restarting the game a few times.

    Also please describe the bugs if you get the chance.
     
  18. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    3,096
    No i don't, but in the previous version it started doing it while in a stage.
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice