1076's Forum Posts

  • 6 posts
  • I think you're looking for the Persist behavior:

    www (dot) scirra.com/manual/161/persist

  • Hey, thanks for the help!

    Yeah, mainly what I'm trying to do is do iterative array manipulation in the web worker, so it should work out just fine. I think, though, that progress callbacks are the way to go, similar to more low level code like C#.

    Something like passing a function over to a web worker, and then working through steps, and passing back a progress message, as opposed to handling the entire function at one time with the web worker.

    So, you could pass it a tilemap name and an array, and then have it look at the array 100 tiles (for example) at a time, send the message back to change 100 tiles on the main thread, and then continue on. This makes the main thread do the real work of accessing the canvas objects, but releases it at intervals to do animations as well.

    Because, like I said, that's really the main issue I'm having, is that Construct will lock everything up trying to complete one task, when it really should be allowing some Graphical functionality to continue on.

    Obviously, in that example, there are clearly defined work units, so it's a 'simple' example. I think there are some other use cases but, as you said, it gets very tricky. In any case, I hope I'm not the only one who could gain from this kind of functionality.

    I really appreciate the code snippets. They'll undoubtedly help. When I get to implementing a solution, I'll update here with how I went about it, and link to a plugin, if that's the route I take.

    Thanks, again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A little bit of an advanced question here, but I'm hoping there's a simple answer.

    Has anyone made a web worker plugin to run parallel functions?

    All I'm hoping to do is create a loading screen that can run a loading animation while content loads in the background. Obviously, this isn't possible with Javascript's single-threaded approach, but web workers could allow for that functionality. Since the Pathfinding behavior uses a web worker, I was hoping someone had already extrapolated on that to create a Web Worker plugin, but I didn't find anything when searching for it.

    I'm prepared to try to make it myself, but I'm on a bit of a time crunch and was hoping that there had been some groundwork already laid. What I would like is a Web Worker object that functions mostly like the Function object, but runs any actions given to it as a web worker, instead of in the main thread.

    Any information about this would be a great help! Thanks!

    I would love to link to the project, but for some reason I'm not allowed to?

    Anyway, you should be able to get to the Github repo here:

    github (dot) com/the1076/The-Legend-of-Zelda--The-Synd-Rupees

    And play a development version, to see the hang up, here:

    cynicstudios (dot) com/subdomains/games/construct/loztsr/

  • It's probably best to not just have your sql open to any query it gets.

    A really simple solution would be to sanitize the data via PHP on the back end so that the only thing that would ever happen from an AJAX call would be that a number is added to the high score. That way, even if they tried to send an injection, it would end up as just a number, and dropped on the high score.

    More advanced would be to format the number in a specific way so that if any other number was received (such as an injection attack), it wouldn't even add that false high score.

    I would suggest a PDO operation, instead of mysqli, but if that's not an option for you, you can still sanitize mysqli.

  • Bumping this, just to make sure.

    If anyone knows if the Tilemap plugin has this functionality, that's all I'm looking for. I just don't want to have to roll my own plugin if the standard one will work.

  • Hi guys,

    I'm working on a top-down RPG and I was wondering how I could get the tilemaps to load from a tmx file asynchronously, while the loading graphic is still able to spin.

    If you want to see a demo of the issue, you can find it here:

    cynicstudios (dot) com/subdomains/games/construct/drakora/

    Note how the loading graphic in the bottom right spins, but then stops for 3-5 seconds before continuing on with the game. That pause is the tilemap load, which is of considerable size. Any help in decoupling the tilemap load from the graphics rendering would be helpful.

    Let me know if there's anything else I can provide that might help.

    Thanks!

    **Edit

    Updated the URL to fix the broken link.

  • 6 posts