WackyToaster's Forum Posts

  • I usually don't do it either, but I do sometimes email myself various random files.

  • Well if you have any tips on possibly making it faster I'd appreciate it. But I honestly would really like to get access to the collision cell optimization in scripting and SDK.

    construct23.ideas.aha.io/ideas/C23-I-221

    construct23.ideas.aha.io/ideas/C23-I-408

    Or perhaps even a construct official quadtree implementation written by someone with more knowledge than me. I've talked with Federico a bit and he speculated a directly integrated quadtree would probably already be faster than getting instances through the runtime.

    construct23.ideas.aha.io/ideas/C23-I-433

    I can see the argument for it, especially since the massive success vampire survivors had, which is btw. also written in javascript. Spawns a lot of copycats of course, and I have yet to see a solution in C3 that doesn't slow my high-end PC to a crawl at 200ish instances even with nothing else happening. I would even think the current collision cells will not suffice for these type of games, considering a cell is the size of the entire screen.

    FWIW collision cells are not actually applicable to testOverlap(): the point is to eliminate even checking instances, so it is basically a filtering system that efficiently reduces the set of instances that you might call testOverlap() on. So it is not possible to implement collision cells within the testOverlap() method itself, it's something that has to come before it.

    Oh I'm aware of that, I just kinda worded it wrong.

  • I also have gotten stuck a little here and there and I think a one-line codeexample would have answered all the questions I had.

    For example:

    Create probability table from JSON

    Create a new probability table from a JSON string. The input should be an array of (weight: number, value: number|string) tuples.

    Google "What's a touple?" and only find a bunch of references to python scripting. Uhh... I ended up adding entries with events and then using "ProbabilityTableAsJSON" to export the json so I could figure out what it wants from me.

    All I needed was a single example like:

    	"[[100,'foo'],[50,'bar'],...]"
    

    And I could have gone "Ah ok, that's what it's supposed to look like".

    The scripting reference for Tweens is probably a good example in contrast.

    construct.net/en/make-games/manuals/construct-3/scripting/scripting-reference/behavior-interfaces/tween

  • You mean at runtime? Maybe with the browser object I guess?

    construct.net/en/make-games/manuals/construct-3/plugin-reference/browser

  • Just a heads-up. If you use scripting and email a .c3p file, some mailservers will rename all contained js fails for security reasons. So main.js will be renamed into main.j_ which will result in the project not being able to load anymore. To fix it you have to unzip it yourself and rename it back. Took me by surprise, thought it might be good to put this info out there.

    stackoverflow.com/questions/54385807/javascript-file-extensions-are-renamed-from-js-to-j

  • You can using the file system plugin, although I'm not sure if it can automatically access the folder/files.

    construct.net/en/forum/construct-3/how-do-i-8/filesystem-plugin-load-local-179011

  • It's quite simple, your import statement:

    	import * as Utils from "./utilities.js";
    

    Notice that you import the functions "as Utils".

    	addEnemyUID(AllEnemies, EnemyUID); // This is not defined
    	Utils.addEnemyUID(AllEnemies, EnemyUID); // But this is
    

    In other words, all the functions of Utils will be available under Utils.

  • If it's a binary file you probably have to convert it to text first I'd think.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/binary-data

    And after editing, you'll have to convert it back into binary.

  • I've been cooking a bit since I noticed that javascript testOverlap() does not benefit from collision cells. In other words it's a brute force check and can get quite expensive. See: github.com/Scirra/Construct-bugs/issues/5665

    So I dug out a js implementation of quadtrees, did some minor adjustments and now it works in Construct. Here's the OG github.com/timohausmann/quadtree-js

    Here's it adapted for C3.

    wackytoaster.at/parachute/quadtree.c3p

    How well does it work? It depends. If I test the overlap between 2000 vs 2000 instances, it actually outperforms events by quite some. Easily a 2.5-3x increase in fps. Cool, BUT... If I test overlap between 1 vs 4000 instances, events are better and outperform the quadtree thingy.

    The amount of collision checks still decreases compared to events, so that must mean the overhead of rebuilding the quadtree is what ends up eating a lot of potential benefit. It seems that somewhere around 150 vs 2000 instances the quadtree starts to pull ahead of events.

    There's also a fork that adds a method to update objects instead of rebuilding the quadtree. This would only need to be called for instances that move, so the benefit really only shows if there's plenty of static objects that don't need updating. With many moving objects, it performs worse than just rebuilding the quadtree.

    There's also a version 2 github.com/timohausmann/quadtree-ts that I didn't touch because I don't know typescript. Perhaps this one is a bit faster?

    Either way, I'm looking for some thoughts about this. It seems totally worth it to look into it further considering the performance increase in SOME cases. But it's also worth it because right now in javascript there is no way to access the collision cell optimization from Construct. :(

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The force variable can be whatever you want it to be. If you want the knockback to be tied to the characters jump strength, then yes.

  • I'm assuming you use platform behavior?

  • You check in this condition if the object is on layer "Game User Interface" but the layer is named "Game UI". You probably renamed the layer at some point, this doesn't automatically update.

  • And where exactly in that project is the variable that doesn't change? What variable is the problem?

  • Well, that's the way many people learn this. I've also nuked a file here and there until I learned. The best thing you can do is not get too disheartened by it and move on.

  • Instance vars are always static. Hard to say what's wrong without seeing the project. Perhaps an action overwrites them when you don't expect to?