So lets say I want to make the structure that in my game, gamer can do basic programming, setting variables even though gamer can’t set fully about variable’s name, but user can set any value (int, float, etc) to variables I made.
And user can use basic syntax like (if~else, goto likely effect, for, wait for second effect, if conditions (something in game happens)).
And this should be done only by touch or mouse, keyboard should not be used at all.
How can I make this programmable environment by unity?
I’m also working on a scripting environment called MiniScript, which is written in C# and easy to embed in a Unity app. You can try it here or via here.
I’m actively seeking beta testers while I polish off the feature set and work on the documentation. So, if you’re willing to work with it while it’s still a bit raw, PM me and I’ll be happy to get you started.
No virtual keyboard, but just simple drag-and-drop interface, yes like you said.
Hm…I don’t have any specific programming language at all in mind because this sort of thing should be easy for users, so want to include very basic universal programming ‘blocks’ like (if~else), (for or loop), (wait or turn structure), (basic variables set usage), (can execute something),
Goal of my game, but not teaching game, but just it can be puzzle or traditional RPG likely game.
Seems interesting and want to know how to make that, but scripting way is not for most users because it become too hard and professional to them. So I want building blocks type.
If you base it on Snap, you’ll have a head start because they’ve already worked out the blocks you’ll need. And it’ll also be more familiar to people who have used Snap – or, vice versa, people who play your game will get a chance to learn Snap while they’re playing.
Yeah, but how would you get this into your Unity game? It sounds like @leegod 's looking for something off-the-shelf that already does this, but I’m not aware of any such thing for Unity.
I started such a project myself a couple years ago, when I was trapped in Australia and didn’t want to leave the house for fear of being stung, bitten, or mauled by drop-bears. But it’s based on the (now) old GUI system, and would need to be rewritten using the modern UI. And it wasn’t finished anyway… managing all those drag-and-drop blocks is a fair amount of work.
@leegod , if you do end up writing your own blocks UI, you’ll still need a script engine under the hood to actually execute the code. MiniScript might be good for that. You could also translate to something like Lua if that’s more your cup of tea. Or you can write your own, though that’s a lot of work in itself. (Though the blocks do save you some of the effort of parsing.)
Sorry, I meant just base the structure on Snap. But, yes, you’d have to implement it all from “scratch” in Unity. Unless @JoeStrout decides to write a block programming UI for MiniScript, which would be cool. It might make an interesting niche product on the Asset Store.
So I need to do that [under the hood] part, but also I don’t have much time recently… Miniscript? where is it? Listed at store? or github? Anyway, whether free or not, I need reference to actually implement this system, prefer that already done.
Scratch is open source. I believe it’s written in ActionScript, so it shouldn’t be difficult to translate to UnityScript if that’s the route you want to take. I was thinking more about taking the Scratch language definition and general interface principles, but writing the code for Unity from the ground up.
It’s not released yet; the feature set and API are fairly complete, but may need a little more polish, and the developer documentation still needs to be written. It’s discussed here (and here), and demoed here and here.
However, I could use more beta testers, so I’m handing it out to pretty much anybody who asks for it and offers to provide feedback. If that’s you, PM me!
OK, I did some research accross for this, and yes, LUA is nice, probably already in place, probably much easier than working from scratch… However, for those of you who want to play with this…
This article describes how to make a “parser” which will parse text and make it tokenized objects that can be evaluated. Its all written in javascript so you can run it anywhere.
What I did was to take all of this code and compiled it so that you can see the javascript in packets (lex, parse, evaluate and calculate and posted it up on my website. It is available here. Just look at the source, and the javascript file it points towards.
What this means… You can make your own parser, make your own scripting language and not have to rely on buying anything… And if you do it good enough… Make money off of it through the asset store. (always in favor of money)
this let you execute code during runtime. if you want to hide it behind a clickable interface you will have to construct the code from your interface but i guess this is not trivial. mostly because code is not flat but hierarchical. you must answer questions like:
how does the user navigate through existing code (for inserting, removing, changing).
how is an existing variable renamed?
how do you check the code for errors?
how are different instances handled?
In general your own internal code should provide a small set of exposed functionality for the user to utilize. you should be aware UPFRONT what this functionality consist of and how does it interact wirth your internals.