R0J0hound's Recent Forum Activity

  • Can't look at the capx because it uses plugins I don't have installed. You can look in preview.js for the exact implementation but if you had to do dt and time with the event sheet this is what it would look like:

    global number time=0

    global number previoustime=0

    global number dt=0

    every tick

    --- set dt to min(0.1, wallclocktime-previoustime)

    --- set previoustime to wallclocktime

    --- add dt to time

  • Looks like the closest you can get to the runtime snapshot is to use pretick.

    Basically run this when the plugin is created:

    this.runtime.pretickMe(this);

    Then when you run the action to capture the pixel, you set a boolean in your plugin and tell the runtime to redraw.

    this.runtime.redraw=true;

    Then in pretick you'd grab it.

    I wouldn't call drawgl directly. I mean you could but it would be very slow. Getting pixels from the canvas is slow anyway. What we're doing is grabbing the entire canvas and loading it into an image, which can take several frames. If you called drawgl directly you'd just be making the runtime draw something it would draw anyway.

  • CreativeMind

    None to my knowledge, but I only use HTML export. However there shouldn't be since it's just math an JavaScript and JavaScript should ru the same everywhere.

  • How far have you got it? The cvs is just a file. You can use the AJAX object to get it into a text variable. You can then use the tokenat expression it get indavidual values from it.

  • Are you saying it is, or are you asking how?

  • I think the answer is in c2's runtime with it's capture action. It doesn't grab the canvas right there, instead it grabs it later (I think it's right after the next redraw).

    I was fiddling with that with the paster plugin before and you have some places in the plugin that's run at different times.

    Two that come to mind are the tick() and tick2() functions. I forget if there are others. One is run before the event sheet and one is done after. You do have to tell the runtime to call those functions with I think a tickme() call? Searching for tick2 probably would give a post with more info as I recall, as well as any I'm fogetting here. Anyways my guess is in those places might be better times to grab the canvas, but it's kind of test and see.

    Basically the process would be to set a Boolean with your action and in the tick function it would check if the Boolean is set and then do what your action does currently.

    The idea can probably be more definite, you just need to break down what the runtime is doing. Off hand I think it looks something like this? I'd have to verify where the capture is done.

    Tick()

    Events

    Tick2()

    Capture canvas

    Draw

    Repeat

  • One thing I didn't cover was in the action right before the callback you see the line:

    var self=this;

    Then inside the callback self is used instead of this. The reason for that is "this" is the object instance inside the action, but when the onload function is called "this" is instead the global variable space because the function is called without a object. You can find more information by googling "JavaScript this".

    Anyways that just means to just use self instead of this everywhere inside the onload function. If you used "this" instead it would explain why the instance variables aren't being changed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ye7yakh

    Is the canvas size the same as the image size? If they're not that could explain the slightly off white next to the black from resizing I suppose.

  • In js as soon as you give a URL to img.src the image will be loaded asycronously and when it finishes it calls the function at img.onload. It's an html thing.

    Yeah you'd probably want to want to wait till the image load trigger to draw it to the canvas.

    It should work fine getting a 2d context because it's using the new canvas created right above it.

    The preserveDrawingBuffer setting is slower when it's on which is why it typically is off. The fact readpixels worked once with that flag off probably has to do with undefined behavior since it's not supposed to work when the flag is false. As far as I can tell, you can only set that flag when first getting the context, aka when the runtime creates it. But ya it's not really acceptable for a user to have to make that change when using such a plugin. :p

    If the image URL idea isn't working paste the code for that function and the trigger it calls. The events should look like this:

    On click

    --- get pixel at X,y

    On pixel got

    --- set redvar to pixel.red

  • I thought it was generated and run at the start of the game. It might still happen when the first script is run though, I'm not sure.

  • If the python files are outside the exe you can just ship the pyc fies generated instead of the py ones. The slowdown is from Construct generating the script to bind objects with python, then of course python also parsing and running it. I don't think it can be improved since the length of the script is proportionate to the number of objects. Unfortunately it can only be made when the game runs, and can't be pre-compiled.

  • 99Instances2Go

    I can't visualize the idea. It seems kind of non-intuitive. I'd have to see it in action.