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:
    108
    Released on the repo, see https://www.beamng.com/resources/pacenotedirector.21824/

    Configuration
    See repo link.


    Known issues and fixes

    Sometimes the mod will break every scenario. CTRL-L, and you should be good to go. If not, try CTRL-L, close the game, and re-launch the game.

    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

    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.

    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. The best way to learn how to make pacenotes is by inspecting the ones in the mod in F11 mode.

    Adding pacenotes

    Suppose you're making a rally for Italy, so that you have the files

    myRally.json
    - stage info and waypoint order
    myRally_forward.prefab - waypoints and start/finish stage stuff
    myRally.prefab - barriers and stage clutter

    in the folder levels/italy/quickrace, which you copy-pasted and renamed from a different Time Trial. In addition to these, you'll need to add myRally.lua to levels/italy with these lines in it

    Code:
    local M = {}
    
    local function onScenarioLoaded(scenario)
      extensions.load("ge/extensions/scenario/rally")
    end
    
    M.onScenarioLoaded = onScenarioLoaded
    
    return M
    
    This will make the pacenote director start when you begin the myRally Time Trial you just created.

    Open up myRally.json and change track name, description etcetera. You don't need to edit the .prefab files at this stage. Launch the game and start the Time Trial you just created. Open the scene tree and look for the prefab. You'll find it after scrolling all the way down, in the MissionGroup group. Unpack the prefab 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.

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

    1. They 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 start of a crest, or 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. They roughly define the track. Distances between any two points are calculated with respect to the rough outline of the track. 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. They 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 very large radius waypoints (significantly larger than the road width). More sophisticated systems such as time penalties and wrong way detection are just overkill for now. If you went off track by so much that you skipped a waypoint, your car is probably already wrecked and you're restarting the game anyway.

    For the above reasons, in your average rally, many waypoints will be blank. An empty waypoint either does not have pacenote dynamic field or has its value set to pacenote="empty".

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

    Let's now create our own Time Trial. Remove all the pacenotes except spawn point, start, finish and first waypoint. These are usually named something_start, something_finish, and something_wp1. 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 (myRally_standing_spawn because we have Rally.json in this example), otherwise your car will spawn at the wrong place with hilarious but ultimately confusing effects. Look at the examples and do the same thing I did (in spirit, not literally, otherwise you'll have name clashes). It's highly recommended that you rename the waypoints to something unique, for reasons that are beyond the scope of this tutorial. 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 at 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), 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. You can also lay down all the waypoints first, and fill out the pacenote field later on.

    Protip: re-map the "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 2: blank nodes can be either pacenote="empty", or not have the pacenote field altogether.

    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


    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 )
    v------------THIS-DISTANCE----v

    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 )
    v---THIS-DISTANCE----v

    case 3: more than 1 markers between 2 pacenotes (try to avoid this)
    It makes no sense to utter the distance between two points in between 2 pacenotes. As such, you just default to behavior 1)
    ( P ) -( )--- ( M ) ---- ( M ) - ( ) - ( M ) ----- ( P )
    v-----THIS-DISTANCE----------v

    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.

    Common Errors and Misc suggestions
    Waypoints in prefab and json must match. The spawn point must be named properly, 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 with 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.

    Waypoints are clickable if you zoom in and the prefab is unpacked.

    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 to 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.
     
    #1 lellolillili, Dec 30, 2021
    Last edited: Mar 8, 2022
    • Like Like x 3
  2. BlackMetal

    BlackMetal
    Expand Collapse

    Joined:
    Aug 10, 2013
    Messages:
    145
    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:
    108
    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:
    108
    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:
    108
    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:
    62
    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:
    108
    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:
    62
    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:
    108
    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

    Joined:
    Aug 11, 2017
    Messages:
    409
    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:
    108
    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:
    108
    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:
    108
    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:
    108
    Released! Please help me debug!
     
    • Like Like x 1
  15. Turbo49>

    Turbo49>
    Expand Collapse

    Joined:
    Apr 1, 2021
    Messages:
    2,166
    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:
    81
    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:
    108
    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:
    2,166
    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