Open benloh opened 2 years ago
Multiple underlying issues/implications:
Currently initScript
runs after # PROGRAM INIT
. So any settings made in initScript
cannot be acted up on by the regular blueprint code until the sim is run. While we can do some method calls in initScript
, from a novice user perspective, ideally we would keep the user instance intiScripts to simple property settings. Perhaps changing the run order to DEFINE
-> initScript
-> INIT
would address this.
Some properties are only activated when Features start running. e.g. you can set a feature property, but that property isn't used until the feature runs in a regular run loop. These would have to be modified to either run before the run loop or we'd have to run the sim one frame or perhaps use some kind of phase hook.
Tossing ideas, around, here is one possible approach
# PROGRAM DEFINE
addProp agentType string 'aggressive' // student face
addProp aggro number 0 // private
# PROGRAM INIT
prop agentType string setTo 'aggressive'
featCall agent.Costume setCostume 'BlueFlower.json'
# PROGRAM POSTINIT
// copied after instance initScript and run when instance is created
if {{ agent.prop.agentType === 'aggressive'}} [[
prop aggro setTo 100
featCall agent.Costume setCostume 'RedFlower.json'
]]
if {{ agent.prop.agentType === 'passive'}} [[
prop aggro setTo 0
featCall agent.Costume setCostume 'BlueFlower.json'
]]
# PROGRAM UPDATE
if {{ agent.prop.agentType === 'aggressive'}} [[
prop aggro setTo 100
featCall agent.Costume setCostume 'RedFlower.json'
]]
if {{ agent.prop.agentType === 'passive'}} [[
prop aggro setTo 0
featCall agent.Costume setCostume 'BlueFlower.json'
]]
// INSTANCE initScript prop agentType string setTo 'passive'
How to author complex behavior strictly in gemscript without writing javascript code and extending these cases (e.g. don't have to create Features)
In this case, how to use constants to drive how a set of releated properties are configured and how to run conditional code based on what these properties are set to:
This does not cover all the use cases.
Five user cases:
Takeaway: This is 2.0 feature.
In GitLab by @jdanish on Jul 18, 2022, 16:03
ok
In GitLab by @jdanish on Jul 18, 2022, 12:21
The ideal model is: