piranha305's Forum Posts

  • I parse and stringfy data back and fourth between the event sheet and the JS scripts, I normally try and handle all the data manipulation in the scripting API and then have a wrapper functions that read or updates the JSON object.

  • Especially when the auto complete is misleading because you have used the lower case variant of the string...

  • Agreed, but it should be documented as such..

  • doing something like this is also a bad idea unless you cache the value for recursive function (dynamic programming) this gets really expensive on the bigger the number, you can run out of stack memory very quick

  • here is a recursive Fibonacci example

  • just in case I created this bug ticket because it seems like its unintentional github.com/Scirra/Construct-3-bugs/issues/3858

    it's really not a big deal, just something that should be documented so noobs like me don't spend hours trying to figure out why my simple assignment statement is not getting the correct value.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So in construct defining instance variable is case insensitive

    so doing something like this fails because Damage & damage are the same considered the same thing

    when referencing these variables from scripts, they are case sensitive, thus considered 2 separate value. is this by design? or is this a bug?

  • agree with newt the performance benefit you get from scripting vs events is negligible, the real benefit from scripting comes from complex data structures imo. you have alot more freedom to freely manipulate data and store data. that said with that extra freedom you can fine tune some algorithms that you have on the event sheet and you might get a bit more performance. but it really depends on what you are doing, for general game play logic you wont see that big of a boost. just take a look at the ghost shooter example it implemented using full scripting and full events and the performance is very similar, mind you its a very simple implementation. one thing i noticed from comparing both scripting had a few frame drops to like 57 fps every once in a while and the event based one stay at a constant 60 fps. mind you i was just looking at the debugger and did not dig too deep into the metrics. you should explore it on your own for the use case of you game. i'd say the way to go is a mix, pure scripting does not seem like a full replacement for the evening system, they should be used in conjunction to get the most out of construct, but like i said just my opinion.

  • It's all good man, the more info the better.

  • construct arrays are actually 3 dimensional, so the array represented as json looks like this

    { "c2array": true, "size": [ 1, 1, 1 ], "data": [ [ [ "stuff" ] ] ] }

    you would need to do something like this

    + System: On start of layout

    -> Array: Set value at 0 to "{""enemies"":[2,2], ""position"":[1,2], ""wait"":[0,0]}"

    notice you have to escape the double quotes

  • the action that loads an array from json expects a very specific format. if you just wanted to store a json string in the array, you have to set one of the index of the array to json "string".

  • yeah makes sense, sometimes its just hard to resist the shiny new toys though...

  • Ashley since chrome 80, i think null coalescing has been added to javascript. it seems the scripting feature does not support the newest features being added to javascript? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

    it's not a big deal, since this is just syntactic sugar to help code cleanliness. but this brings up the question? as new features are added to the javascript (seems to be happening at a rapid pace nowadays) will construct keep up with these features in the scripting api? I would assumes this is just adding linter support for the new feature? but it might be more complex than that.

    will construct target a specific iteration of java script? there is a snippet in the documentation

    I am not sure the overhead of having construct keep up with these changes to the language, what are your thoughts on this?

    Tagged:

  • Congrats, this game is super awesome!

  • Not for the time being sorry, I had to remove them. I might start them back up in the future, but currently it's not possible