www.tombraiderforums.com  

Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tomb Engine

Reply
 
Thread Tools
Old 30-11-22, 22:17   #1
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default Node editor tutorial



Hi!

This thread will focus on everything about node editor! This includes: getting familiar with node editor interface, understand action/conditional nodes and how to use them, and any other tutorials created by either me or other users

Basically this thread will be in similar structure to Lua workshop thread: https://www.tombraiderforums.com/sho...d.php?t=227414

If you have suggestions or questions you can ask them here or on other threads

Note: It is possible to make your own node functions: https://github.com/Stranger1992/Tomb...r:-Node-Editor

Table of Contents
- Chapter 1 - What is node editor?
- Chapter 2 - Understanding Volume Trigger window
- Chapter 3 - Understanding nodes
- Chapter 4 - Understanding nodes: advanced

Update log
- Added extra info in chapter 4 about conditional nodes and action nodes. (17.12.2022)
__________________
Chronicles Lara: "Whatever"

Last edited by Kubsy; 17-12-22 at 11:52.
Kubsy is offline   Reply With Quote
Old 30-11-22, 22:43   #2
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default

Chapter 1: What is node editor?

We will start of with an explanation of what is node editor.

Node Editor is a scripting graphical user interface which is supposed to be aimed for beginners with little to no programming knowledge. Kind of similar to Unreal Engine's blueprints or Unity's visual scripting interface.

Another benefit of Node editor is it was constructed similarly to TRNG's trigger window since each of the node is like a TRNG flipeffect trigger but the main difference is that many nodes can be spawned in the same event set and connected to eachother (more on that later) which can do a lot of stuff at the same time, pretty cool right?

All in all, an EventSet and the nodes you put in it are equivalent to TRNG's TriggerGroups and the triggers you put in it.

Node editor was released in Tomb Editor 1.6 and works for TEN version 1.0.2 and Tomb Editor 1.6 and up. If you use Tomb editor 1.5.9 and TEN 1.0.1 or below, you will need to update, the latest version can be found here: https://www.tombraiderforums.com/sho...=223846&page=4

There are several advantages and disadvantages to using node editor:

Advantages:

- It's quick to implement something very easy without written lua.
- very little programming needed.
- everyone can implement nodes (link to guide in the initial post) but you need lua knowledge.
- at the time of writing, there are a lot of action/conditional nodes provided.

Disadvantages

- You can't use it to program complex gameplay and complex effects (written lua required).
- can get messy if you have a lot of action nodes and don't "simplify".
- You cannot do looping (only action and conditional nodes).

However, despite the disadvantages, the beginner-friendliness and easy-to-use node editor still allows for making cool events and such!

next tutorials will focus on the interface and using the nodes.
__________________
Chronicles Lara: "Whatever"

Last edited by Kubsy; 01-12-22 at 11:27. Reason: Editing on the fly
Kubsy is offline   Reply With Quote
Old 01-12-22, 16:36   #3
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default

Chapter 2: Understanding Volume Trigger Window


This next chapter of the tutorial will focus on the Volume trigger window which is used for node editor (but also for lua function scripts)

The general layout of the volume trigger window looks like this (open the image on a new browser if you want to zoom in):


There are a lot of buttons so let's break down the window bit by bit and explain what they mean.

We shall start with the Event set column:


Event sets column is where all of your grouped events (or if you would like to call them: Trigger groups from TRNG) will reside, different sets will do something different depending on what you put.

1 - this button will add a new event set
2 - this button will copy the event set
3 - this button will delete the event set
4 - this button will let you search for an event set if you have many event sets already added
5 - this button will unassign the event set so you can have the volume trigger be inactive

The top bar of the trigger volume window:


1 - Textbox to allow you to name your event set
2 - Tabs to trigger volume trigger in different situations:
- When entering = when Lara/moveable or any volume activator enters
the volume trigger
- When inside = when Lara/moveable or any volume activator is inside
the volume trigger (this will trigger every game frame and stop when
Volume activator is not in the volume anymore)
- When Leaving = when Lara/moveable or any volume activator is
leaving

3 - Switch between the modes, for now we will use node editor as this is the point of the tutorial. Level Script Functions are for functions written in lua in a file ( LevelFuncs.YourFuncName = function() )
4 - unassign lua functions.
5 - Searches for nodes in your window.

The bottom bar of the window:


1 - adds an action node to the scene
2 - adds a conditional node to the scene
3 - Connects the nodes if they haven't been already
4 - renames the node
5 - change the colour of the node
6 - Deletes the selected node
7 - deletes all of the nodes
8 - copy the lua function to clipboard to be pasted to the file (more on that later)
9 - activators, who can activate the volume trigger
- Lara - Wonderful Lara Croft herself
- NPC - Enemies
- Other objects - moveables such as animatings, pushables, traps etc
(but not enemies). You can specify which moveable can trigger
the volume trigger only - more on that later
- Statics - static objects
- Flyby cameras - Flybys (must have "Activate heavy" turned on in flyby
properties!)

10 - Call count - how many times should the event set be called (triggered) since it is a property of the event set. If the call count is 0 then it will called (triggered) infinitely.

And last but not least! The scene itself:


This is where all of your nodes will reside. The scene can be moved with right-mouse and you can also selected multiple nodes with ctrl+click or by click and drag along the nodes.

Next tutorial will focus on nodes and creating a simple event.
__________________
Chronicles Lara: "Whatever"

Last edited by Kubsy; 03-12-22 at 18:22.
Kubsy is offline   Reply With Quote
Old 03-12-22, 18:57   #4
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default

Chapter 3 - Understanding Nodes


This tutorial will go over spawning nodes into our scene, understanding the difference between conditional and action node and some handy shortcuts/info.

First of all let's create a new event set. Go to the Event Set column and press the add sign which will create a new event set. It should look like this:


now you can name it if you'd like: go to the Event set name and rename it to something. I renamed mine to "Haha some event set". This will of course be reflected to the event set on the event set column


Now we can go explore the fun stuff and spawn our first nodes. Go to the bottom bar of the window and add an action node and a conditional node, the default action and conditional node will be spawned (if you spawn 2 of them then they will be linked already however if they are not then just link them by dragging from the bottom of the dotted grey area of the node).


As you can see we have a node called "Action 1" and conditional node called "if 1" what is the difference?

Well an action node is a node which will do some action in the above screenshot it is flash screen. In each action node you have a bunch of properties that you can manipulate so for flash screen you can change the colour and intensity of the flash. Hint: you can hover your mouse at the different properties and they will tell you what they customize!!

Conditional node is basically an "if statement" so in the above example, the flash screen would trigger if a player presses forward. Conditional nodes have "then else" connectors which means if that conditional node is true then trigger these action nodes. If not then trigger other action nodes.

Consider this:


if the key "forward" is hit, then flash the screen. If not then shake the camera. Of course this would work if you have these nodes on "when inside" volume event!

Of course you can access many different nodes by clicking at the dropdown tab.


However, in my opinion, a much better and clean way to choose nodes is by right-clicking at the dropdown list. Which would give you a detailed explanation of what this node does and split into sections:


In some of the nodes you may see a moveable called "volume activator" for example in the distance check node:


A volume activator is any moveable or static passing through the volume. This is particularly useful if you do not mind any moveable (for this distance check node) to pass through this volume and compare distance to eachother. But you must remember to check relevant activators at the bottom of the window!

However if you want specific moveables, cameras, statics to trigger volume. You can press the dropdown the menu and select specific moveables.

In this case, compare Lara against small scorpion.


What this conditional node means?

- "Equal" - if the distance is equal to (there's many comparisons - less than, more than etc to select)
- "0" - value to check the distance. Can be any number
- "All dimensions" - check the distance from any direction (vertical, horizontal, diagonal etc. You can also select "horizontal only")
- Moveables - compare distance Lara against small scorpion.

Very useful hint: You can click and drag moveables from 3D view of TE to the Node editor scene itself.

this video shows dragging SETH moveable from 3D view to node editor scene:

https://streamable.com/e2q386

you can also overwrite to an existing node (if applicable):

https://streamable.com/9i8kgp

In the next tutorial we will discuss more about nodes.
__________________
Chronicles Lara: "Whatever"

Last edited by Kubsy; 16-12-22 at 20:16. Reason: Editing in progress
Kubsy is offline   Reply With Quote
Old 16-12-22, 20:15   #5
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default

Chapter 4 - Understanding nodes: Advanced


In the last Chapter we discovered nodes. We learned what are action and conditional nodes where each have different properties. However we did not discover 2 useful functions that can be useful, and those are: Nested conditional nodes and exporting node scene to written Lua.

Nested Conditional nodes


Reminder: conditional nodes are nodes which act like an "If-statement" it will trigger depending on the condition.

Here, we can also nest them to create more complex events depending on what the player will do.

Consider this node scene:


we have 2 conditional nodes which control different nodes in a different scope (i.e, "key is held" is not able to trigger the health text because it can't really see, but the "moveable health check" can!)

note: for key stuff it is recommended to select "While inside" event as it checks each game frame!

What is happening is this:

- if a player is holding forward, it will trigger the text with "You are pressing forward" with attributes like shadow, black colour etc.

- It will then go to another conditional node to check Lara's health (note: I accidentally put "Volume activator which will check any moveable's health :P) if it's more than 500, it triggers the node on the left hand side, if not then it triggers the node on the right hand side.

- however if the player is not holding forward then the nodes on the left hand side each game frame and triggers the right hand side node which is "you're not pressing forward at the moment".

Hopefully that gives you a clear idea of nodes in general, they can become really powerful and give a huge gameplay enhancement with some creativity

Some other useful stuff with conditional nodes


There are other things you can do with conditional nodes. In the previous example, the 2 conditional nodes are connected together, however you could have 2 unconnected conditional nodes so they work independently (in fact you can have as many conditional nodes as you can in the scene itself!)

consider this slightly modified example:


We now have split 2 conditional nodes so they work independently. This means that even if you don't press forward, then the health check conditional node will still trigger.

note: the conditional nodes will trigger in order of appearance, so the top most conditional node will trigger and then traverse downwards to check for conditional/action nodes

Independent action nodes

Consider this again modified example:


the conditional node exists for holding the key, however you also have an action node (Which I call an "independent action node") that is not connected to the conditional node and thus will always trigger no matter what.

Exporting node scene to written Lua


Even though you can do most of the stuff in the nodes itself, there are a few problems.

What if you would like to trigger stuff when the game starts? Or even on load?? when saving??? Or even on exit like you can with written lua???? Well thankfully you can do that

Remember this button?

well you can use it to export stuff from the scene into written lua and then paste it to your .lua file. Let's do that!

First put the node that you would like to be exported to the scene, In this case I chose the inventory node to provide the player with a crowbar at the start:


Hit the "export lua script to clipboard" and the following message should appear:


that means the written lua behind the node has been copied and saved to your clipboard on your computer great! We can now paste it to the .lua file so enter your level .lua script and paste this to the "OnStart" function.


now this may seem complicated at first however it is not! Let's look at each part.

"LevelFuncs.ExportedNodeFunction = function(activator)"

this basically means you are making a level function named "ExportedNodeFunction" (to indicate it was exported from node but you can rename and you shouldn't have problems).

activator means who can activate the function?

"LevelFuncs.Engine.Node.AddInventoryItem(TEN.Objec ts.ObjID.CROWBAR_TEM, 1)"

this accesses the node that you exported and inserted into lua. in this case the crowbar will be added to your inventory on start of the game (if you did put it in the OnStart function)

Note: do not delete "TEN.Objects.ObjID." and "LevelFuncs.Engine.Node." this deals with a concept known as "Object Oriented programming" where the code accesses classes in order to access its functions.

Next tutorial will focus on making events to see them in practice.
__________________
Chronicles Lara: "Whatever"

Last edited by Kubsy; 17-12-22 at 12:01.
Kubsy is offline   Reply With Quote
Old 17-12-22, 11:50   #6
Kubsy
Explorer
 
Kubsy's Avatar
 
Join Date: Nov 2019
Location: Polska
Posts: 710
Default

I am updating the tutorial regularly, I have just now updated chapter 4 with extra info and the changed/updated stuff will be listed in the initial post
__________________
Chronicles Lara: "Whatever"
Kubsy is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 17:59.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.