Git Product home page Git Product logo

job-system-cookbook's Introduction

C# Job System Cookbook

This is a repo of examples I've written to learn how to use the C# job system to write systems at scale, here for reference and sharing.

The goal of this repo is making it clearer how you can structure your data, schedule your jobs, and use the results. So, the examples use easy to understand problems & algorithms.

This doesn't (yet!) cover things related to using C# jobs with the upcoming Entity Component System.

Each example script has a corresponding scene where it's set up.

Job System Details

You can use the job system in the 2018.1 beta right now. Examples written here are written & tested on the latest beta version, starting with beta 4.

For a detailed look into how the C# job system works, please watch the Unite Austin presentation if you haven't seen it.

Examples

Note: examples in this repo use LateUpdate() as an easy way to handle completing jobs later than we schedule them, but in real code you might want to schedule the jobs early in Update (using Script Execution Order maybe) so you can use the result later in the same frame.

All examples demonstrate the use of persistently-allocated job memory.

Modify all 20678 vertices of a mesh in parallel every frame, using Perlin noise & sin(time).

Uses a single job.

Modify all vertices & normals of a mesh in parallel every frame.

This is the most visually interesting example. Uses a more complex single job.

First determine velocities, then change positions based on those velocities.

Demonstrates using the TransformAccessArray, necessary for doing transform operations in jobs.

Check a Vector3 and a Bounds for intersection against a list of 10000 Bounds.

Demonstrates running 2 independent jobs.

Check a Ray for intersection with a large Bounds array in two steps.

Demonstrates reducing an array of checks to a smaller list, and using temporarily-allocated job memory.

Generates a cloud of 10000 points, then calculates magnitudes & normalizes the points.

job-system-cookbook's People

Contributors

jura-z avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.