Code Monkey home page Code Monkey logo

bluegraph-samples's Introduction

BlueGraph Samples

Unity project containing various samples using the BlueGraph Framework.

The following samples are available for you to play around with or use as a base for your own projects:

Dialog Tree

Visualize and modify a typical RPG-style dialog system.

Dialog Tree Scene

Dialog Tree Graph

This includes nodes for setting portraits and letting the player choose different responses based on game conditions (their current stats, relationship to an NPC, etc).

Each NPC can be assigned a different Dialog graph asset to execute when the player interacts with them.

Running the Sample

Open the Test Dialog Tree scene and go into play mode. Click on the shopkeeper cat to start a conversation.

To show additional dialog choices, set your Intimidation stat to 10+.

Modifiable in Play Mode

This graph can be modified in Play Mode, allowing you to quickly iterate on conversation flow while testing the game.

Breakpoints

While in Play Mode, you can set breakpoints on the Graph to pause execution when the breakpoint is reached. Right click a node in the graph and click Set Breakpoint. Once that node has been reached in Play Mode, it will be highlighted and you have to click Continue from Breakpoint to move on.

Dialog Tree Breakpoints

Execution Flow

Execute a series of nodes in the style of UE4 Blueprints in response to different events.

Execution Flow Graph

Running the Sample

Open the Test Execution Flow scene and start Play Mode. You should see debug messages spamming the console.

The Graph Container object in the scene has a Use Mono Behaviour Graph script that executes different nodes along an execution path (white edge) starting from different MonoBehaviour events.

Executable Nodes

This sample contains nodes for branches (if/else) logic and loops to control which nodes are executed along the execution path.

Any class extending ExecutableNode automatically has input and output execution flow ports and contains a method to run your business logic when that node is executed on the graph:

[Node]
[Tags("Executable")]
public class DoFoo : ExecutableNode 
{ 
    [Input] public string message;

    public override IExecutableNode Execute(ExecutionFlowData data)
    {
        string msg = GetInputValue("message", message);

        Debug.Log(msg);

        // ExecutableNode.Execute() will return the next node 
        // to be executed (what our flow output is connected to)
        return base.Execute(data);
    }
}

Terrain Generator

Procedurally create a Unity Terrain by blending different heightmap generators

Terrain Generator Scene

Terrain Generator Graph

Running the Sample

Open the Test Terrain scene and on the Terrain asset's Procedural Terrain script click the Apply to Terrain button in the inspector.

You can edit the graph to add new heightmap factory nodes (fBM noise, Perlin noise, etc) and blend different noises together using Animation Curves and other blend algorithms.

To see your changes applied to the Unity Terrain in the scene, click the Apply To Terrain button again.

Factory and Transform Nodes

There are two types of abstract nodes in this graph that all other nodes are built on top of:

  • HeightmapFactory instantiates a new Heightmap instance
  • HeightmapTransform takes one or more Heightmap inputs and outputs a new Heightmap with the transformation applied.

For all nodes the output Heightmap is displayed within the node to help you visualize how each step of the graph changes the final results.

Math Nodes

The Common/Math folder contains boolean logic and floating point math nodes that are used within all other samples.

Math Nodes

Misc

Other examples that have no other home.

There is a node to demo mesh previews within an IMGUIContainer (see MeshPreviewNodeView) as well as "kitchen sink" nodes for demoing the different types of data supported.

Terrain Generator Scene

Terrain Generator Graph

There is also a DynamicVector class that, when used as a port type, allows you to cast any vector/float dimension to another vector/float within the graph editor. This makes use of BlueGraph's IConvertible support for safe type conversions.

bluegraph-samples's People

Contributors

mcmanning 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.