fungus

Open full view…

Fungus and Code

longdark
Thu, 02 May 2019 09:51:55 GMT

Hey all, We recently started developing a game that will require a lot of dialogues. Our current design would render it a mix between two genres one of which is a visual novel. However we do have a dedicated developer that works in Unity's C#. The question is, is it possible that we have Fungus deal with dialogues in the game while everything else is handled from C#? Can scripts listen to certain "events" in a narrative created by Fungus? Can the other way around happen too (Fungus detecting certain variable changes in scripts)? Thanks.

jameshaidle
Thu, 02 May 2019 15:44:22 GMT

The short answer … yes and yes. The long answer, I have created an entire game demo using Unity and Fungus. I didn't write a single line of code. However, before I did that, in prior incarnations of the demo, I was very successful in blending C# and Fungus. I don't think that there is a single thing you would need to do that Fungus couldn't. The Fungus flowcharts contain all the variable types, and if you change one in C#, you can load the change into the Fungus Flowchart as needed. Also, there is a Send Message command in Fungus, and you can start blocks when a Message is received that way. I think you will find this to be just the tool you are looking for.

longdark
Fri, 03 May 2019 05:41:52 GMT

Thanks a lot for the reply. My only worry at the moment is getting Fungus to trigger certain C# methods and scripts. Is that possible without sending messages? I saw in the documentation that I can listen to events, but apparently they are predefined states; like Conversation Start and/or End. I am looking for something akin to "Player made this choice, instead of that" or "Player accrued X in variably Y during the conversation"? I know the latter I could handle in an Update() call but I am personally not a fan of doing that unless necessary.

wolfrug
Fri, 03 May 2019 07:57:18 GMT

For best integration, you'll want to make custom commands or even custom eventhandlers to properly communicate between Fungus and C#, but you can easily make things work natively too without needing any additional scripting, by using the Call Method, Invoke Method etc. commands, found under Scripting. Call works the same as e.g. what you might put in a button, while Invoke lets you send/receive variables and do a lot more complex stuff. Again, custom commands are generally better, also for debugging and if you might want to -change- something at some point, but as mentioned you can get plenty far with just the basic stuff. Messaging is mainly used to communicate from C# to Fungus, but even better is using ExecuteBlock and direct references to flowcharts.

jdscogin
Fri, 03 May 2019 11:52:03 GMT

I use Fungus for just about everything except visual novels.