#jobs / burst

1 messages · Page 1 of 1 (latest)

proper rock
#

Ever heard of "gradient descent"?

#

This code performs that.

radiant pivot
#

interesting

proper rock
#

The top part of the file is managed code that starts the jobs

#

The bottom part -- the stuff that implements IJob -- is the Bursted part

radiant pivot
#

I'm trying to find the docs for this, could you send me the link?

proper rock
#

the actual math isn't too important (it just figures out the derivative of a function that represents how desirable a point is, and moves up the gradient)

radiant pivot
#

nice

proper rock
#

This doesn't actually take advantage of parallelism. It just starts the job and then instantly completes it.

radiant pivot
#

but does it start it and let the rest of the script continue while its doing the job?

proper rock
#

not in my case

#

But you can do that.

radiant pivot
#

yeah, thats what im looking for, to avoid freezes every time I build the nav

proper rock
#

Here's an example of a system that does get some paralleism

#

It uses RaycastCommand

radiant pivot
#

nice

proper rock
#

that lets you build a huge pile of queries and then submit them to the Jobs system

radiant pivot
#

interesting

proper rock
#

although, I just realized

#

you were asking very specifically about nav mesh updates

#

I've used this before. Not for super intensive work, though

radiant pivot
#

well it was specifically NavMeshSurface

#

so idk if this will work but i'll take a look

proper rock
#

ah, NavMeshSurface.UpdateNavMesh ?

#

that's allegedly async

radiant pivot
#

ah, then building it must be the bottleneck

proper rock
#

it starts a coroutine

#

i'm not sure if that coroutine actually yields until the process is done

proper rock
#

so it has to live on the main thread

radiant pivot
#

ah

#

i'll take a look

proper rock
#

That's why you can't just slap async on a method and call it a day, to answer your earlier question :p

radiant pivot
#

its just so odd bcause it was working before

proper rock
#

maybe you're suddenly doing a lot more work

#

like, your voxel (i think that's the word?) size went down

radiant pivot
#

 public async Task BuildNav()
    {
        NavSurf = GetComponent<NavMeshSurface>();
      
        await Task.Run(NavSurf.BuildNavMesh);
        NavSurf.UpdateNavMesh(NavSurf.navMeshData);
        
        //sTask.Run(NavSurf.AddData);
        //BuildNav();

    }
    public void SpawnStuff(GameObject Struct)
    {
        
        //const int rotLen = 4;
       //int* rots = stackalloc int[rotLen]; 
        rots.Add(0);
        rots.Add(90);
        rots.Add(-90);
        rots.Add(180);
        
        //Place the Layout
        Layout = Instantiate(Struct, transform.position + new Vector3(0, 5.8337f, 0), Quaternion.identity);
        //Randomize The Layout's Rotation
        Layout.transform.eulerAngles = new Vector3(0, rots[Random.Range(0, 4)], 0);
        foreach (Light light in Layout.GetComponentsInChildren<Light>())
        {
            if(light.tag != "DontDoLightFX")
            {
                Lights.Add(light);
            }
          
        }
        BuildNav();
        // Invoke("BuildMesh", 2);


    }

like this was working before

#

although this was a lot of little meshes and now im doing one big mesh

#

is baking one big mesh more intensive than baking many small ones?

proper rock
#

certianly seems more likely to cause one big hitch

radiant pivot
#

huh

#

hmm part of the issue is it just isn't running

#

ill figure it out