Mona 🛠️ Visual Scripting

ETHGlobal New York 2023 · 11 Sept 2023 · 23:18

Tom, a Unity developer at Mona, a metaverse platform for building shared digital spaces, demonstrates visual scripting in an ETHGlobal New York 2023 workshop. Using an NPC dialogue system as the example, the session builds interactions from event nodes, custom events, variables and UI selection logic inside Unity and the Mona SDK, and shares the sample project. Questions touch on comparisons with Unreal Blueprints, putting templates in the Mona library and puzzle spaces, and the session ends with the sponsor bounties, including best interactive components made with visual scripting.

Topics

From ETHGlobal New York 2023, hosted by ETHGlobal.

Transcript

Hi all, I'm Tom. Uh I'm a Unity developer here at Mono. Um Mono, uh, if you don't know, is is a metaverse platform where we create uh digital spaces and experiences. People can't um people can join, you can share them, you can create games, you can create art galleries, you can create whatever you can imagine really. Um inside of Mono, we have this feature called uh visual scripting. Um and that's what uh the session is going to be about. Um so I published like self-sample projects though that we'll go through, and I also have some links that I will share. Um so here's this space that I prepared for uh the session.

Uh I can share a link here. Uh, if anyone wants to jump in, um they can totally do so and uh explore in their own time or during the session, whatever you feel like. Um so essentially um visual scripting is a way in Mono to create interactive um functionality. Um so what I've created here is this um like NBC dialogue system where you can walk up to this like hologram guy and you can have a chat with him. It's very similar to a lot of RPG games and such like if you've uh played any of those in the past. Um it has like text and like this menu, you can select different options.

There's some dialogue, which I uh generated this cool AI tool called Suno. Shout out to those guys. Uh I'll also drop a link to them in the chat. Uh anyone that's curious. Um I see people saying they're in there. I'm in a private session, so it doesn't uh so I'm not gonna see you guys running around but uh put in there. Um but yeah, you can like use the Q and E buttons to like select different options and he'll he'll reply to you and give you information. Um and this is all done with visual scripting. And this is just one of the sort of many things you can do with visual scripting.

Uh you can create dialogue systems like this, you could create puzzles or like escape rooms, like you want to be crazy to try and remake like Call of Duty or something, or like Rocket League, whatever, whatever tickles your fancy, I guess. Um yeah, um I'm gonna be here to sort of show you the ropes. Um I won't be going super basic um because I I'm gonna assume people um might be familiar with scripting and stuff like that as it's a hacker file, and I'm sure you can pick up the basics on your own uh as we go. Um so here we are inside of Unity inside of the mono SDK. We have our own um SDK project built inside of Uni that you need to use to build spaces.

Um more information about that in our docs, um, which you can find on the mono website. Um so here we are. This is the space I screwed together really quickly in in Blender. Uh it's not super pretty, but it's okay. So um with the dialogue system, um obviously you're solved speaking to this character here. Um so we have this like hologram character. On this character, we have an animator. Um anime has two states, it's super basic. He has like a talking state and an idle state. So when he's talking, he switches to the uh the talking state and and vice versa.

These are just some like animations I got from Mixemo. Uh if you want animations, it's a it's a great resource. Um yeah, so essentially um with uh that's outside of visual scripting. Uh, this is that animation system, but it's it's controlled by uh the visual script. So um when you first walk up the stairs, there is this collider here. Um, and this collider interacts with the visual script that's on it, it's called the activator. And essentially, what happens is when the player walks into this, it's gonna enable this conversation game object. And this is the manager that manages uh the whole conversation.

Um, so if I press play, um, I actually have a few nodes um up here, which allow it to work inside of the editor. Um, but you can see um what will happen is the conversation that this activator will start this conversation game object and that'll sort of get everything rolling. Uh, this is super easy to do. In virtual scripting, we have this concept of event nodes. Event nodes um something that they get triggered when you press a hotkey or when the game starts, or there's various event nodes um inside of the visual scripting um graph that you can access. Um sorry, sorry.

I wonder if you could just zoom in ever so slightly into today's at the bottom map. Um is this back? Can you see uh I got full screen? Uh unfortunately I I actually can't zoom in on this. This is like a fixed size. Okay, no problem. I mean, you're doing a great job of explaining, so um, that's fine, but yeah, no problem. So this is this is the uh the activator, it's very basic. Um essentially, when you walk into this collider, uh, that will trigger this event, this on trigger enter um event, and it will then um try and get the tag of the object which uh triggered it. In our case, it we want the type player because we only want to activate this when a player walks into the tag.

Uh and that will that will that will enable this other object which has its own visual script. Um, as you can see, this virtual script is much larger. Uh, this is the one that does the bulk of the logic for the dialogue system. Um, but essentially, what is happening is it's inside of uh our game objects in this conversation, we have a UI system. And there's several objects for responses and several for inputs. You can see these are all individual objects, and they're labeled one for three or one through two, depending which which it is, because of the different number of options.

But you could expand this type of system and have like a really expansive conversation system if you wanted. Obviously, this is just a demo, so it's just some like script that Chat GBT wrote for me. But uh if you wanted to have a full story or a Tiro guide or I don't know, uh a helper, you you could do all that sort of stuff with this type of system, which is very cool. Um yeah, so let's dive into this graph a bit. So it's so split into um several categories. Um of these are like custom events, type cell, and some of them um uh uh unit events, so it all starts with this on enable event.

So the other script when it enables this object, um it goes to this onable event, and um it says to play this response, and I'm triggering um a custom event down here. Um so this is the response event. So what this does is you give it a value, and depending which value you give it, it disables all events, and then it enables the one you want. Um so this correlates with the the numbers of of the responses in here. So you can see zero, one two three on the hierarchy. Maybe you can't see because it's really small, but hopefully you can get the idea.

Um yeah, you give it the number and it plays that event. And when it does this, it does a few other things as well. Um, it sets the animate state of the NPC to to the the talking state, so he starts like waving his hands around and explaining. Um and then it also there's a voice line. Um you probably can't hear it on when I showed you on screen share, but if you go in the space yourself, there's voice lines, so we we get the length of the voice line and we we wait until it's finished, and then we we go back to the the selection state. Um the selection state is managed by these other events here, these three. Um so there's a navigation event, there's a highlight event, and there's a select event.

Uh, these navigation event and highlight event, they're cluster related. Um essentially, when you um are in the experience and you're you're pressing cycle. Um, you might be able to see down here by zoom in. Um, it's it's going to um trigger these events. Oh, you can't really see. Um it's been lasty to me. But yeah, this this um what triggered this this navigation event essentially we're looping through um the elements in in this like input list. Uh there's three inputs, so there's this it's the value of three, and then it overflows.

So if you go to four, it goes back to zero, uh, and so on. Um, but essentially it it this keeps track of which um option you have selected, and then the um the highlight is what is changing the color. So if you look when you're changing um like changes of the colors and stuff of the UI element, this is what manages that. Uh, this is called from this, uh, it's kind of just like a visual thing, and then the select event is the one that triggers when you actually like select an option. So like I say, whoa, why are you it's gonna tell me about it's the hologram? It's gonna do that whole business.

And this is triggered by this. This is very basic. It's essentially it just takes the the selected currently selected object from the highlight uh from the navigation event, and it's stored in the variable on the side here. Um, and then it does a switch statement that triggers the correct response. Um yeah, as you can see, like there's not that many those. It does seem a bit scary um at first, but um, once you dive into it, it's it's not that complicated. Uh, this this sort of sample project will be available after the project for people to like rip into and try reverse engineer.

Um, I see a question. Is visual scripting similar to scripting in second life? Um, I've never actually used scripting in second life, but I um it's it's very similar to like Unreal Blueprints if you if you have an experience with that. Um lots of these visual scripting systems are very similar in design, um that they all have like um nodes, obviously, and then you have like variables and and events. So if you've used something like second life, um I'm sure you could probably dive into something like this and pick it up very quickly. Um a bit of unity knowledge would definitely be helpful.

The certain events uh called lifecycle events, uh, which trigger certain times in uni, such as like when the game starts or once every frame and stuff like that. Um so if you had some unity knowledge, you would have some background knowledge on those already. If not, there's not that many of them, they're fairly easy to learn. Um but yeah, um, this is kind of an overview on how this works. Uh, we do have some other visual scripting samples already in. We have this mono library with some assets in it here. Give it a minute to load.

If you're wanting to subgetting to kind of happy to take some questions if anyone has any, I'll try best to answer them. Let me scroll through, see if there is any going already. Of course, yeah. Everybody do feel free to drop your questions in the chat. Tom, I mean, I'd love to start off myself. I see Quezon is following up. But yeah, I don't know if perhaps you could um share some highlights of some projects which have been built.

Obviously, you mentioned that the opportunities are nearly kind of endless as to what people may build. But I just wondered if you had any particular highlights yourself. Yep, so so this space um that I linked actually it polls to two other spaces with a bunch of interactive um features. Um so if you uh if you're in here, like these two things, all if you uh look at them on that clip, you can like jump into some other spaces uh that previously been created. Um it has this like really cool um subsystem where it's stuffing like a puzzle space.

Um you want to know more about it, you can ask uh the MC guy will tell you all about it. Uh yeah. What do you mean by that? Like, can you move objects around? You can totally move objects around. You could potentially create like a visual script that generates the seed when the level started and have like a randomized like world every time like that as well. That would that would be possible. What do you mean? Yeah, quasism. Feel free to um expand on that if that's not quite what you meant.

Uh there's also another question, Tom, which says, how easy would it be to make these VS events available on Mona Library as drag and drop templates for that individual builds and use cases? Yep, so for for this specific like uh MPC subsumer project, I'll I'll probably clean it up a little bit and then um we'll put that on the mono library. In terms of these events themselves, I I think they're specific to graphs. I don't know if you can reference uh scripts between graphs. Um that that might be something for us to look into, but but we can totally like um upload like individual uh graphs as is like assets and you you can download them that way. Um we could distribute those through the mono library um or Discord or um whatever we decide we want to do that.

Amazing um quasi on can you create a game? Yep, you you can totally create a game. Um Scott, the the imagination is the limit. It's a it's a full like almost the full uni API is accessible through visual scripting. Um you could create like I don't know uh a basketball game. I know there is there is a basketball game somewhere um that someone created. Uh if you can search on the Model Discord, perhaps you'll find it. Um I know there was another guy who built this like space. But yeah, you you can totally create games.

We're also looking at adding a bunch of like custom nodes that allow you to do things like access external APIs and stuff like that. So once that opens, like people will be able to do the most stuff. That's amazing. Are there any um libraries or uh uh a general link where people can go to potentially look at the full catalogue of of games? I don't know if if we could possibly get a link to that or Tom if you want to to explain that a little bit further. Yeah, but the best place to uh find spaces is just go to uh monobus.com slash um marketplace.

Um this is all about our minute spaces. Uh a lot of a lot of spaces are not minute. Uh those ones uh will not necessarily be here, some of them might be. Um yeah, if you want to check out spaces, definitely check this out. There's a lot of awesome stuff going on. Um I I highly recommend a lot of them. Follow the giant has a lot of cool interactivity with like cutscenes and stuff like that. Um yeah, there's like there's like hundreds and hundreds of spaces to go through. Um not all of them have interactivity, some of them do, some of them don't.

But yeah. Um another great place to find spaces is the the Monibus Discord. Um, a lot of people's like work in progress things that they're building uh there. I can drop a link to that as well. Um amazing. And uh yeah, Tom, I I don't know if um you've got anything else planned. Please do tell me if if I'm jumping in, but perhaps for people who are looking to use Mona, um, I'm not sure if you could share any insights as to where where they could get started and in terms of building their projects. Yeah, absolutely.

So like I mentioned at the start, uh we have our own SDPA. Um you can find this on our web page uh or on GitHub itself. Um let me pull it up. Here it's here it is. Um you can download our SOPSTAR project or on GitHub. Um you can load that into Unity. Um there's full tutorial on how it's all done in the README. Um you can go in, you can start importing objects from your favorite 3D tools if you're a blender guy or um anything. If you don't have any 3D experience, you can still take part in Mona.

You can we have this library of assets you can use, uh like drag and drop style, you can find like free assets online and like Kit Bash space is that way. Um you don't have to be a 3D artist to take part in Mona. Yeah, I see somebody's just commented in the chat saying there are tons of helpful docs. Yeah, to all of the the participants uh currently here, please do make use of all the links being dropped in the chat. And of course, to anybody watching the recording of this session, um, all of these links will be shared in the description of the video as well. So yeah, lots of links being shared, so please do feel free to browse through those.

Um, Tom, I've just noticed a question in the question panel, which says, How easy would it be to make these VS events available? Um, sorry, that was just uh a replication from from the previous chat. So yeah, um, these types that, for example, with this dialogue system, we could extend this, like I mentioned, you could add more dialogue. Um, it doesn't have to be a hologram. He could be like an MBC that would like walk around the map you could talk to. You can make him a quest giver, uh, make your own quest system or something if you wanted.

Um, you could like hook it up to an embed system or like uh skills and stuff. You can kind of do almost everything you can do in uni within the virtual scripting system and then bring that into a space in Mana and create some like really cool interactive experiences. Um the concept of this is not like just take this, it's it's to try and like learn from these sort of things and then come up with your own ideas. Um hopefully that will be spice to people to have a play around a bit. Um my recommendation for anyone trying to learn this stuff is just play around a bit. Um if you get stuck, there's lots and lots of tutorials and stuff online.

Um, or you can ask your favorite uh I AI chatbot, I'm sure he'll have an opinion. But yeah, um yeah, if no one has any more questions, um we wrap up. Tom, uh perhaps one more um just in terms of the bounties and uh people who are looking to build their projects. Obviously, you you shared um that people can kind of use this and build whatever they like, and uh yeah, just if if you could confirm in terms of the bounties and the hackathon, um the types of projects people might want to build, or or whether you're happy to just see any kind of open-ended um things being built on the platform. Yeah, I I believe there is some like specific bounties for certain types of things.

Uh I actually don't know what they are. Um how much about the development team might be set up here. Uh if you want more information on that, um, there's probably some links to what will appear in chat. Or you can uh join the Mono Burst Discord or check out the socials. I'm sure they'll have specific information on that. Yep, there we go. Thank you very much. Of course, yeah. So there's there's a link there to the website, apologies. Um and so just to clarify the first bounty. Yes, Tom, loading the map, perfect. So if you scroll down, you should see Mona. There we go.

Here we go. So there's like some specific uh bounties. Um best website or app that uses one of space as an avatars and interesting words. Um we have this whole like avatar system, we use the VRM avatar system, which is this like interoperable system that you can use on many platforms. Um yeah, so you can definitely interact with avatars and visual scripting if you get a bit creative. Um guarding any of that stuff, um definitely hop in the Molobus Discord and uh I'm always there to answer questions as well as lots of other people as well. Um and then we have the best interactive components using visual scripting.

Um this would be stuff um like what we've built here. Um some things that come to mind would be like I don't know, maybe you want to create a mini-map to be a space, maybe a really big space you keep getting lost. You have like a map or something. Um maybe you want a jetpack, I don't know. Um maybe really like football and you want to play some football or soccer for our American friends. Yeah amazing I think um I'm really interested to see for this uh particular bounty what what people come up with um it seems like uh people's imaginations could get carried away um but I'm sure yeah some really cool projects will be built so uh unless there are any more questions for now just while we wrap up um as as I've mentioned all of the links are being shared in the chat you have uh the Discord zone on the Ecode server where you can ask any questions to Lamona team and as Tom mentioned as well um I believe there's a Mona Discord channel as well so just whilst we see some background images of a really cool rocket game yeah I'd just love to thank the Moni team one last time um Tom for a really cool session thank you very much for taking us through that and also to the rest of the team for sharing all of all of the docs and resources in the chat so yeah thank you very much to the team once again thank you to all of our participants for attending all of the workshops it's been really great to see you here and we do hope you have enjoyed them but also gained some insights um to help you build your project so we'll be in touch very shortly um a message will go out tomorrow to next steps for you all but if you do have any questions or problems with building your projects you can reach out to me for general questions and you can also reach out to all of our sponsors in the sponsor zones for any technical um issues or or problems that you're encountering.

So, yeah, all do keep in touch. We're really excited to see what you all build. And for one final time, I'll just like to thank Tom and the team once again for a really incredible session. So thank you all very much, and uh, we'll keep in touch and see you soon.