playMaker

Author Topic: "RUN CODE" Action ability  (Read 1327 times)

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
    • View Profile
"RUN CODE" Action ability
« on: August 28, 2013, 08:38:30 AM »
I know this might sound a bit absurd, and maybe it is technically impossible, but hear me out for a second.
Been thinking of this for a while. There are many instances I've run into where I just want to run some very small operations or math for which I don't yet have an action or a script. Creating either (and/or linking into a script) is quite a time-drain and organizationally annoying if it is only needed to do one or two simple lines of code that will never be used again.

So what about an Action that has a text field which will compile into a function? Combined with the new ability of Call Method, this action could have several FSM inputs and returns. I guess it would have to do some editor-time stuff so Unity can compile it. Maybe it auto-generates small CS files.
Obviously you can't input a variable into the code text field but that's fine - it's not for flexibility but convenience. The field should probably be size-limited to something like 8 lines so people don't go crazy with it.

Thoughts?
« Last Edit: August 28, 2013, 08:40:35 AM by dasbin »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: "RUN CODE" Action ability
« Reply #1 on: August 28, 2013, 08:41:31 AM »
I believe this is what you're looking for.

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
    • View Profile
Re: "RUN CODE" Action ability
« Reply #2 on: August 28, 2013, 08:47:08 AM »
Hey, cool. Thanks for the link. It's very close.

I still think it could be integrated with Playmaker a bit more tightly. ie Drop-down selection of FSM variables to pass to input or return, and treat those just like a function rather than direct variable manipulation.
And the JS interpreter, while super interesting and powerful, has the big flaw of not running on IOS because it compiles at runtime. I think PM needs to create it at editor time so Unity can compile like any other script. Unfortunately this alone makes Jean's admirable solution unusable for many.
« Last Edit: August 28, 2013, 08:48:59 AM by dasbin »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2484
  • Yup.
    • View Profile
    • Cleverous
Re: "RUN CODE" Action ability
« Reply #3 on: August 28, 2013, 08:56:38 AM »
Hey, cool. Thanks for the link. It's very close.

I still think it could be integrated with Playmaker a bit more tightly. ie Drop-down selection of FSM variables to pass to input or return, and treat those just like a function rather than direct variable manipulation.
And the JS interpreter, while super interesting and powerful, has the big flaw of not running on IOS because it compiles at runtime. I think PM needs to create it at editor time so Unity can compile like any other script.

This is currently as close as we have to what you're asking.

While I don't understand the technical details or constraints I have wondered how big of a feat it would be to implement that functionality directly into PM. I do agree it would be a great function to have. Perhaps it is a 2.0 goal?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: "RUN CODE" Action ability
« Reply #4 on: September 10, 2013, 12:17:44 AM »
Hi,

 Yep, runtime interpreters is not for next week... The very annoying thing is that the jurassic interpreter could be easily optimized, but currently ( I admit I don't ave the c# expertize to digg in to the code...) it parses the string every frame... d'uh... of course that will kill perfs... if only they had implemented a caching system it would be a PERFECTLY valid solution ( but for IOS and platform not supporting that kind of stuff).

Editor time compilation of logics is of course a good idea, I am not aware of anything stable on the front, even outside playmaker world.

bye,

 Jean