Introduction to scenarios creation

Discussion in 'Content Creation' started by Nadeox1, Jul 14, 2015.

  1. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    (imported from here)

    What you will learn:

    • What is a scenario
    • What is a prefab
    • How to setup a scenario and prefabs creation (A sprint-like course, not a lapped course)

    Requirements:


    • Basic editor usage
    • A LOT OF Patience
    • Creativity
    • Good reading comprehension



    What is a scenario?


    Scenarios were introduced with the Steam Early Access update. As the name suggest, a scenario will take the player into a 'predefined activity' in which the player will have to accomplish a defined goal. Currently the only kind of the scenarios are time-trial races.
    What is a prefab?

    A .prefab file is a 'list' of objects that will be loaded with the defined scenario. It will allow the user to create custom courses and place various objects in a scenario.
    It usually includes the waypoints needed for the race and also the player starting position.
    The file has a similar syntax of a .mis file.



    1. Setting up the files

    Download the 'Scenario Starting Kit' at from the end of this post.

    Setting up the workspace
    Go to 'Documents/BeamNG.Drive/mods/unpacked/yourmodName'.
    What we need is to recreate a folder similar to the one of the level we are going to use (So that the game will read those files when it loads that level).
    I'm going to use 'East Coast USA' so I will end up with this folder structure 'Documents/BeamNG.Drive/mods/unpacked/yourmodName/levels/east_coast_usa/scenarios'
    (the folder name must be the same of the level ZIP - You can check that name from Steam/Steamapps/Common/BeamNG.Drive/content/levels)
    Put the files form the 'Starting Kit' in the folder
    227VyYb.jpg
    You can rename the files to whatever you want. I will keep their name for the tutorial.

    2. Ingame
    During the whole Scenario creation it's highly suggest NOT TO save the level. It will create only a big mess.
    If you accidentally save, go to Documents/BeamNG.Drive/levels and delete the folder of the level you are using.
    -Starting up: Position your car

    Open your game and select the scenario.
    xV4VzCk.jpg

    You will see this:
    prcyEMQ.jpg

    Simply press the play button, pause the physics (J) and enter in the Editor Mode (F11)
    The first thing to do is going to the 'Scene Tree' window, scroll down to 'ScenarioObjectsGroup', right click on it and press 'Unpack Prefab'
    8emwyXh.jpg

    Select the player and move/rotate it to where you want your scenario to start.
    vLwMJFh.jpg

    After that, you can Repack your prefab like shown in the picture:
    aDijl2x.jpg

    It will make you choose the folder where to save this file. Simply save it on the Desktop with any name you want (It will note save it in your actual desktop).
    Navigate to 'Documents/BeamNG.Drive/Users/yourname/Desktop' and you will find the saved .prefab.
    You can either replace it with the one in 'Documents/BeamNG.Drive/mods/unpacked/yourmodName/east_coast_usa/scenarios' (or whatever level you are using).
    Or manually open it in notepad and copy-paste the content to the other one (I prefer this method, gives you more control).
    If you reload the Scenario (By pressing ESC > Play > Scenario > Your Scenario) you should spawn in the position and rotation you put the vehicle.

    Start the Scenario, pause the physics again and go in the editor and upack your prefab again (You will have to unpack it each time you want to modify it!)

    -Placing the Waypoints

    In the 'Scene Tree' go to 'Library > Level'. Select the 'BeamNG Waypoint' object.
    You can position and scale it to your likely. The first waypoint doesn't need to be placed at the car position. You can position it wherever you want.
    (Using the Snap to Terrain option will make placing them easier).
    Set your own name for the waypoint too.
    Wkh3wU0.jpg

    IMPORTANT>> Place the 'Waypoint' inside the 'prefab' group. All the objects you want to be in your scenario must be placed in the prefab!
    bMBDvmr.jpg ckZEm5M.jpg

    You can place the other waypoint by simply SHIFT+CLICK (On an axis) on your waypoints. It will clone the waypoint and increase the number.
    ioHU7vP.gif
    NOTE:The new waypoint will be put outside the 'Prefab' group. You will have to move it inside manually as shown above. Remember to do it for all your scenarios objects!

    Here I made a short 3-Waypoint course:
    22S6zuV.jpg

    I will repack it (Remember to delete the 'prefab_filename' line as said above) and repeat the process described above to make my changes permanent.

    Now I will setup the waypoints order.

    Open the scenario .json file and edit the 'LapConfig' part with the name of the waypoints I placed:
    8fUxKty.jpg

    If I save and reload the scenario, you should see your waypoints there:
    GGl6wWm.jpg

    -Placing Objects

    Placing objects has the same method of placing waypoints, just that you take your objects from 'Scene Tree' > Library > Meshes (Pick objects from the folder of your level (it will show that by default). Using objects from another level can cause errors).
    XZAEmuW.jpg

    Then repeat the procedure for saving and your placed objects will be there as soon you reload your scenario :)
    ia8yPzw.jpg



    FAQ:

    Q:Is there an easier way to make scenarios?
    A:Not currently.

    Q:My scenario is stuck on loading!
    A:Open the game console (Key varies from keyboard type) and see what the error

    Q: My objects changed numeration wtf!?!?
    A: Happens sometimes. The editor is not the state of usability currently. Manually edit the prefab and restore the original numeration

    Q: My objects are not there :(
    A: Make sure you unpacked and packed your prefab correctly before saving

    Q: How can I change vehicle?
    A: In the .prefab, by simply edit these:
    MeFoHSD.jpg

    If you ever release a scenario, the only files you will need are the ones I put in the 'Starter Kit'. There is no need to include other files.
    This way the original map would stay untouched and will cause less problems for everybody.
     

    Attached Files:

    #1 Nadeox1, Jul 14, 2015
    Last edited: Aug 11, 2017
    • Like Like x 15
  2. jammin2222

    jammin2222
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    386
    I'm going to go full retard and ask the first questions.

    So this is only a tutorial for modifying maps with existing scenarios?
    How does this translate into putting it in your own map for example?

    I made a folder in my level called scenarios and placed your starter kit in there. I modified the .jason and added my own picture, no problem. I load the scenario and I have no car, the camera wont move, and there is no prefab to unpack. Basically fail.

    Can I make the prefab from scratch in my map? What does that entail? Do I have to somehow get the one from East Coast into my map for it to work? If I get hold of the required prefab where do I put it in my map and how do I find it in the editor??

    Could you include a template prefab in your starter kit so we don't have to pinch it from elsewhere?

    Sorry for being stupid, I have wanted to know this for so long but these are the problems I encountered.
     
  3. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    This method is applicable to every map.
    You still use the 'kit' I prepared, but at the 'Workspace' preparation part, instead of naming the folder 'east_coast_usa' you name it with your folder name..

    Open the console and see what's wrong.
    Make sure you placed those files in the correct place and that your folders are named correctly.
    Eventually try to reload the scenario (While making this tutorial a similar thing happened to me, but it fixed itself after I reloaded :\ )

    I explained that in the tutorial, and I've included a blank prefab with only the 'player' inside of it.

    I did..
    lGVBIKa.jpg

    You just have to put everything from that zip in your level folder as it is. The 'Json' and 'JPG' would be in the scenarios folder. The 'prefab' would outside the scenarios folder.
     
    • Like Like x 1
  4. jammin2222

    jammin2222
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    386
    The file I downloaded didn't have it in originally.
    Capture.JPG

    I just downloaded it again and its in there. Did you update it since first posting the file?

    Lets try again now I have all the stuff.

    Thanks for getting back to me :)

    EDIT: yes it was modified since first post. It has a typo in the name now.
    Capture2.JPG
     
  5. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    You probably downloaded it before I finished writing the tutorial.
    I changed stuff various time in the making.
     
    • Like Like x 1
  6. NistingurA

    NistingurA
    Expand Collapse

    Joined:
    Nov 22, 2013
    Messages:
    2,092
    quiet nice :) and thx for the tutorial :D
     
  7. Sando

    Sando
    Expand Collapse

    Joined:
    Aug 19, 2013
    Messages:
    326
    Can we use the waypoints part for creating custom AI paths?
     
  8. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    No, it's a bit different for that. Since AI is under heavy work and thing can change drastically in no time, making a tutorial for that now is not the case :)
     
    • Like Like x 1
  9. RyvyLo

    RyvyLo
    Expand Collapse

    Joined:
    May 15, 2014
    Messages:
    438
    Thanks a lot for this tutorial !

    I was wondering if there were any way to set a custom tod, I saw there was a tod object in the [...]/hirochi_raceway/scenarios/intro_fullcircuit.json but it doesn't seem to change anything...
    I'd like to have the time passing by and to be able to modify the day and night scales for more realism in a endurance race.
     
    #9 RyvyLo, Jul 19, 2015
    Last edited: Jul 19, 2015
  10. CarSquasher

    CarSquasher
    Expand Collapse

    Joined:
    Sep 5, 2014
    Messages:
    705
    Is it Possible to have a race with more cars in it. Like that if the other cars used the ai to go around a track. Is that possible?
     
  11. Insanegaz

    Insanegaz
    Expand Collapse

    Joined:
    Aug 3, 2013
    Messages:
    508
    Great tutorial works great for me thanks :)
     
  12. redrobin

    redrobin
    Expand Collapse

    Joined:
    Aug 21, 2012
    Messages:
    602
    Is there a way to make it so that the user has a choice of more than one vehicle to use? Like, when they start the scenario, they can pick between the Covet or the 200BX or something like that.
     
  13. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,683
    Something like this would work.
    LnsGby2.jpg

    Code:
    	"levelObjects": {
            "tod" : {
                "time" : 0.95,
                "dayLength" : 120,
                "play" : false,
                },
            
        },
    
    The next update will have some new scenario with that, so you can check that closely.

    For the other question, it's not possible to have AI in the scenario currently.
     
    • Like Like x 1
  14. Jean-Mie

    Jean-Mie
    Expand Collapse

    Joined:
    Jun 14, 2015
    Messages:
    10
    First thx for the tuto ! I was wandering if we can just put some objects in scenario or can we edit the terrain too ?
     
  15. farcar

    farcar
    Expand Collapse

    Joined:
    Aug 13, 2013
    Messages:
    81
    Just chiming in to say: Thanks!
    The tutorial is very clear and works perfectly, ;)
     
  16. Tibi Seres

    Tibi Seres
    Expand Collapse

    Joined:
    Dec 23, 2014
    Messages:
    214
    I' have a problem. Please help for me!

    Everytime I' explode the prefab the game crashes.

    Any suggestion? :(
     
  17. farcar

    farcar
    Expand Collapse

    Joined:
    Aug 13, 2013
    Messages:
    81
    If you renamed the .prefab file, it can cause this. Try changing it back to what it was originally.
     
  18. jammin2222

    jammin2222
    Expand Collapse

    Joined:
    Sep 15, 2013
    Messages:
    386
    Can any of you guys help me?
    I made a scenario that has 2 cars, but its got issues.
    The port escape scenario has the police car to smash through, so I looked at that prefab and found the copcar. I copied that section and pasted it into my prefab and changed the vehicle to a covet.
    The very random problem is that sometimes they both spawn fine, sometimes the covet doesn't spawn, a few rare times no cars have spawned, and other times it's just crashed the game.
    I have tried putting the covet above and below the main vehicle in the prefab but meh. When it works, it works fine which is weird.
    This is the code for the dummy covet, any idea what I'm doing wrong?
    Code:
    new BeamNGVehicle(car) {
          JBeam = "hatch";
          color = "0 0 0 1.2";
          partConfig = "vehicles/hatch/race.pc";
          renderDistance = "500";
          renderFade = "0.1";
          isAIControlled = "0";
          dataBlock = "default_vehicle";
          position = "-2472.57 584.828 85.1066";
          rotation = "-0.02433 -0.0253431 -0.999383 87.212";
          scale = "1 1 1";
          canSave = "1";
          canSaveDynamicFields = "1";
       };
    Also is there a way to have the second dummy car have its parking brake on? You can't switch to it to apply it in a scenario.

    Cheers for any enlightenment :)
     
  19. | ..| Gonzo

    | ..| Gonzo
    Expand Collapse

    Joined:
    Sep 23, 2014
    Messages:
    19
    some question's:

    1. is possible to set UI?
    2. is possible to display section time? (for example 3 way point group)

    P.S.
    nice tutorial but need more information for example: how to make scenario with car choose.
     
  20. KennyWah

    KennyWah
    Expand Collapse

    Joined:
    Jan 16, 2013
    Messages:
    2,629

    Do they even support up front car choice yet?

    You can still go in and just change your car, if you didn't blacklist that feature.
     
  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