R0J0hound's Recent Forum Activity

  • As far as I can tell when creating an object at runtime the first instance you inserted at edit time is used to the object's created state. It can be a problem to find that instance unless you put it on an asset layout first. I usually just manually set the object state manually when creating at runtime though and completely disregard the edit time values.   It would be useful if there was a way at edit time to pick the initial object or even make a certain instance the reference for default values.

  • The sdk manual describes what they do here:

    https://www.scirra.com/manual/23/runtime-functions

    under "draw(ctx) and drawGL(glw)"

    And it's the runtime that calls them. For more detail: in preview.js the runtime calls the layout draw function in layout.js whenever a frame is to be drawn. From the layout draw function each layer draw function is called (same file) and from there each instance's draw function is called.

    You can't control when the plugin's draw functions are called but you don't have to draw anything when they are. It's quite doable to do as you mentioned to wait a time interval between draws by saving the current time and comparing against it every time the draw funtion is called. However it would only cause your object to flash one frame before the background and other objects would overdraw it after that until it flashes again.

    Here's how you could do it.

    1. add a variable to instanceProto.onCreate so you can save the current time.

    this.oldTime = 0;
    this.timeInterval = 1; //in seconds

    2. add this to the top of your draw and drawgl functions:

    var currentTime = this.runtime.kahanTime.sum;
    if (currentTime >= this.timeInterval + this.oldTime)
        this.oldTime = currentTime;
    else
        return;
    // add drawing code below

    But as I said you'd only get a passive flash of the object every interval.

  • cesisco

    That error is caused by pasting the paster to itself. C2 had a change that no longer permits this as it won't work on some exports as I understand it. I should change the example capx as it's affected by this.

  • retrodude

    I've got it working with chrome and firefox on my pc and on my android tablet. Webrts, which peerjs is based on is still in an experimental state and I think mainly google and mozilla are still working on getting a standardized spec for it. But yeah, eventually it should be useable everywhere. 50 connections at once is the limit for the peerjs server. Which is fine, as if you really needed more you could make your own server based on peerjs' server's source. A game will probably slow long before 50 players though. The main draw of peerjs is it's supposed to be fast since all the server does is act as a broker to connect two devices and then the devices can communicate directly without a server. My example is unfortunately very wip and i'm sure there are superior ways to setup the events I used.

  • So I decided to take the plunge and tinker around with some networking in C2. I found a javascript library PeerJS which uses webrtc on browsers that support it (aka Chrome and FireFox). It seemed appealing to me, as once I got a wrapper working I wouldn't need to write any server side code to get multiple devices connected together.

    So here's a relatively simple tech test of it in action. The first person becomes the host and all others connect to him. Each player has a box to drag around and all the other players box's positions are updated at an arbitrary 20fps. Supposedly I can have up to 50 players connected at once.

    So without further ado, join the box dragging nonsense:

    http://tinyurl.com/kherptw

    [EDIT]

    Nonsense indeed, after further testing I noticed quite a few things I did wrong with handling the networking events. On top of that my internet and pc are pretty slow right now.

  • tulamide sqiddster

    The plugin actually does use gl.MAX_TEXTURE_SIZE on creation and when changing the resolution. The confusion I caused was from utilizing an assert I found elsewhere that would recommend a texture size of 2048x2048 if a size was used that's larger than the max texture size. I didn't test to see what the max texture size actually was and incorrectly recalled what the size was in the assert.

  • gamepopper

    Save/load is working here. The freeze isn't a bug, it's just a slow operation to save/load the contents of the canvas. It was a feature request that has it's uses but when using large canvas' it's speed becomes impractical so the "no save" behavior is a good solution.

  • Try Construct 3

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

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

    Opps, it was a typo on my end. Should be fixed, just re-download.

  • —

    I just made a plugin that may be useful in this situation.

    http://www.scirra.com/forum/topic78654_post466046.html#466046

  • Sprite Sheet 1.0

    https://www.dropbox.com/s/ani7jkuhhcffb ... addon?dl=0

    A single image object where a sub-image can be used for drawing.

    For lack of a better description it's like tiledbg with image offset but without repeating textures. It should be useful in situations like this:

    http://www.scirra.com/forum/request-til ... 75513.html

    cheers

    [edit]

    One thing to point out is this object's "load image url" action replaces the replaces the object type's image not just the instance's like sprite and tiledbg does. So only one image per object type.R0J0hound2013-10-26 19:38:27

  • So I did, I guess I'm not paying attention. :)

    I'll have to look again. It actually varies, here are the stats:

    webglstats.com

  • The resolution is the size of the texture the plugin uses and by default it uses the initial size of the instances. So ya, it VRAM usage is the same as an equivalently sized image. The only limit other than memory is the max texture size which on my PC is 4096x4096.