Is it possible to make more presets for the procedurally generated tracks? I found the path and .json, but it won't keep the same track, and eventually makes one that has nothing on it.
When you open quickraces, then select the proc. tracks as the map, it has multiple presets: I'm trying to make more, I found the path where the presets are stored, but not where the seed is stored. I've tried changing the seed, date, and trackType.
Hey! Nice to see someone trying to make more tracks You should check out the file levels/driver_training/quickrace/procTrackGen.lua, function gym() and onScenarioLoaded(). There, the parameters for the track generation are set. Specifically, you need to set the params.populateFunction to a function which will then in turn set the parameters, its a bit looped but was necessary to be able to use random parameters. Anyway, the real magic happens in the file lua/ge/extensions/util/procTrack.lua: the first part of the file holds the parameters table. this you have to modify in order to create different tracks. for example, you can change the chance for loops, gates, amount and size of nodes, size of the total area and so on. If you have any questions, feel free to message me
So tracks are based off of 1 of 5 bases, right? Either tape, O, snake, basic, or random? Under function gym (seed,size), it seems to understand the seed, and transfer it into one of the 5 tracks, but the seeds in Beam don't seem to match anything there. There is no reference of the seed in either .lua file. Sorry I'm not understanding, but could you show me a walkthrough on how to make one? Thanks I'm asking this because I'm working on making an official racing group based off of these, and it's easier to give people a mod with the tracks than to ask them to put the seed into the spot.
Hey, The seed follows this path: In the Quick Race UI, you can enter a Seed (or in the scenario through the small app). In the first case, the seed is stored in scenario.track.customData.seed (procTrackGen.lua : 641) In procTrackGen.lua : 553, a default parameter table is fetched from the procTrack module. the populateFunction of the paramters is set (555). More to this later. from line 589, a check is made to determine the seed, or generate a new random seed if none is provided. the seed is set as the parameter seed of the parameter table (600). The function "makeGymkhana(params)" of the procTrack module is invoked. this triggers the actual generation. The generation is broadly made out of these steps: Checking the Parameters, generating a seed yet again if none provided until now. (procTrack.lua : 243, called in line 121) This includes invoking the populateFunction, which will set all the parameters like loop and gate chance, where the nodes should be placed etc. Creating base nodes, using the rectModeParams table and the startRects list in the parameters. This places all the circles/gates on a plane, without a path or anything really. Finding a Path through all those nodes. "Winding" a path around the nodes, along this path. Decoration, creating objects, placing waypoints etc. For a very basic track, follow the MakeBasicTrack function of procTrackGen.lua : 309 with parameter size set to 0. It contains the following: MakeStartRects This creates 2 Rects, see Image R1 and R2. Thse have the noSplit parameter, and one of the has the startParameter, causing it to be always the start of the path Setting 3 more start Rects, see Image R3, R4 and R5. The last one is also noSplit and the finish. After those Rectangles are set, they will be split to create the base nodes (see 2. above). This works like illustrated here. The rectangles are split until enough rectangles are created. Each rectangle will be one node (see the blue dots). Also note that the noSplit-Rectangles are not split. The rest is not so important. Once you have the basic shape, you can play around with all the other parameters in procTrack.lua, like loop chance, gate chance etc., check out how the other tracks are generated (which parameters do what) etc. Hope that helps a bit
Ok, I understand how it works and what to change, so I did. I changed the .json file so that it *should* make a Tape Circuit track, but it ends up not generating anything. What's wrong? JSON: Game:
Could be multiple things. can you post the things you changed in procTrackGen.lua? Also, the log would be useful.
I didn't change anything in the .lua files, only added a .json with an exact copy of the "snake" .json. It didn't work, so I tried a different track, this time the tape recorder. It works now, somehow. I've launched the game since then, and the logs are gone now. Somehow it loads the same track consistently now, different from the preset tape recorder circuit. I must've changed something to make it work, but it was late at night when I was doing it, so I don't remember xD --- Post updated --- Update - It turns out I didn't change anything in the .lua, and it's not consistent. It just makes things show up now. I guess that's the first step.
Alright One tip for developing/trying things out: It might be better to create a scenario (as opposed to a quickrace file), with one single global function which sets all the parameters and invokes the track generation. You can then simply call this function though the ingame console (i think the shortcut is '~'). You can also reload the lua through ctrl+L, without breaking anything. If you do that in quickrace mode, some stuff gets reset that should not be reset. That way you can simply change stuff, reload lua, re-generate the track and repeat. Then, when you're finished, simply copy the part of the code which sets all the parameters into the quickrace lua file. Also, some other tips: The most important part of the generation is the positioning of the startingRects. They must all be together and touch each other, otherwise the generation will not work. Preferably, you want to draw this out on paper You can influence the amount of nodes through the parameter params.rectModeParams.density, which will yield more nodes for a bigger area. alternatively, you can set the value params.rectModeParams.fixNodes for a fixed number of nodes. Unfortunately, having more than 27 nodes can sometimes take way too long. because finding a path is a really difficult problem... Note that splitting the rectangles does not go on indefinitely, there is a minimum size, after which the rects will no longer be split. See the LongDense-Preset, denser than this doesnt make sense anyway, no place to drive... the noSplit=true property for rectangles prevents splitting. ideal for start/end positions, "Connectors" and stuff. See square circuit preset the force-property for rectangles can enforce certain values: gate=true/false - makes a gate or not. See wide gate circuit preset. radius=x - makes the radius this value. See tape recorder preset. flip=true/false - makes a looparound for this node or not. Also see the tape recorder circuit preset. Looking forward to what you will create
I've never created a scenario before, so to the wiki I go! Thanks for all your help Update - How do I make the scenario load the procGenTrack.lua file?
I'm sorry, you're doing a great job explaining everything, but I just can't make one. I have tried everything reread everything many times, but I can't seem to get something working. I understand how they work now, but not how to create more.