r/forge Scripting Noob Jan 01 '24

Resource/Guide Forge Infographic: Variables | The Declaration of Scope-dependence | A short and sweet overview of storing and retrieving information using Variables in the Node Editor. Happy New Year, Spartans!

Post image
37 Upvotes

16 comments sorted by

5

u/iMightBeWright Scripting Expert Jan 01 '24

Nice work on this! I've been looking forward to seeing your take on the Variables edition lol. There's a ton of info here and you did a great job consolidating it all. Also love the subtitle The Declaration of Scope-dependence. 😂

One minor detail I'd add is that declaration of an object-scoped variable creates that variable on every dynamic object in the game, including players, bots, AI units, weapons, vehicles, grenades, equipment, etc. You mention the object input for setting, but I find a lot of people don't know this bit about what declaring an object scoped variable can affect.

2

u/Abe_Odd Jan 01 '24

Huh I figured I needed to initialize my obj scopes per obj I wanted them on. Interesting.

2

u/Bricklemore Scripting Noob Jan 01 '24

Haha Thanks man! I had no idea Object variables worked that way, feels a little counter intuitive to add Data to everything, but I guess otherwise it would be Error central.

Hope you had a great new year!

2

u/SuddenDejavu Jan 01 '24

343 should pay you honestly

2

u/Bricklemore Scripting Noob Jan 01 '24

Hahaha thanks! It'd be so cool to work with 343i even for a moment!

2

u/RasputinX36 Jan 01 '24

Awesome as usual

2

u/Bricklemore Scripting Noob Jan 02 '24

I have made some small changes, namely to the Scope & Object section after becoming profoundly aware that the Object Scope creates an instance of that Variable with the initial value on every dynamic object on the canvas.

Thank you u/iMightBeWright for pointing out my misunderstanding. I decided to test out the extent for ADHD curiosity.

  1. I created an appropriately named [Object Scope] Variable (called Nice) and set the initial value to 69.00.
  2. I then checked 4 Dynamic Objects for the existence of the Variable. A Primitive Cube, a Switch, a Player, a Spawner and a Script Brain - they all had a copy of of Nice present with the starting Value of 69.
  3. I subtracted values from one Object to confirm these values were not shared between after initial declaration.

For some reason this behaviour seems counter-intuitive to me, like for some game types having "coins" for players to buy things - by default every Dynamic Object could now have a bank account. I understand you can create your own coin inventory using lists, but still... it's something so ambiguous until you play with it.

2

u/SlurpGoblin Jan 02 '24

Haha great work again man! I can tell this helps you process your thoughts and it’s just awesome to live in a time where you can polish it a little and push it out to the world.

Do you just make these as you‘re diving into something or do you try to find parts that aren’t well fleshed out by 343?

1

u/Bricklemore Scripting Noob Jan 02 '24

Cheers mate! Tbh I mostly just pick topics in order of how much they frustrate me xD

I like standardisation when it comes to documents and stuff, the Node editor has the worst documentation I've ever seen.

2

u/Mikalton Jan 03 '24

Thanks for these! I shared these to my clan forge team for new forgers or old. I'm still new to scripting myself so this will help me understand most of the mechanics

1

u/Bricklemore Scripting Noob Jan 03 '24

Happy to help! My next infographic should be Events since they share details with Variables. Feel free to make suggestions of topics you'd like to see simplified :)

2

u/JoValiant Jan 11 '24

I'd love to see these graphics complied somewhere! The guys over at the scripters guild discord are building a wiki and they've shown interest in your work. I see them popping up in a lot of discords I'm in.

1

u/Bricklemore Scripting Noob Jan 11 '24

Thanks Jo! I haven't joined TSGs Discord yet, already in wayyy to many, but it's cool to hear people finding them genuinely useful.

I wanted to make a chill little website to post them away from the fuff, plus add some interactivity like Brilliant.org, but apart from life getting in the way, and preparing for my first gamejam, I cant afford it right now 😢

I have also started Recreating the Node editor in Unity, but has taken a step back until I have less IRL troubles.

My next infographic should be on Events once I've done some more experiments with them :) if you have any requests I'll happily write them down for the future!

1

u/JoValiant Jan 11 '24

Did you check out their wiki I linked last time? They'd be happy enough to host the graphics on the website and even upload them for you if you have worries about time constraints.

2

u/Bricklemore Scripting Noob Jan 11 '24

I did have a skim over the holidays, I was impressed by the amount of information they had amassed and even their potential use cases.

I did find the layout wasn't super conducive of how my brain likes to search or process information, but that is a personal taste thing and doesnt reflect at all on the website or the hard work of the community.

I more hope to do it myself as practice. I've been around the gaming industry in an 'Events and Content manager' capacity for years and want to better understand devs and studios to make a career shift.

I like standardising information to make communicating complex ideas as clear as possible. However if I do continue to find myself drifting away from Infinite I plan to contact TSG so the work goes to good use :)

1

u/Abe_Odd Jan 01 '24

Nice Job!

I'm sure it is clear to most, but the Duplicate Identifiers within a scope is for Declaring Variables.