R0J0hound's Forum Posts

  • sqiddster glitchg

    Here's an overview of all the variables the C2 provides for effects.

    All vertex positions, unless stated otherwise are in relation to the screen where (0,0) is the top-left and (1,1) is the bottom-right.

    varying vec2 vTex

    This is the vertex co-ordinate of the current pixel

    uniform sampler2D samplerFront

    this is the source pixels. AKA the object's texture or the result of the previous shader.

    uniform sampler2D samplerBack

    this is where stuff is being drawn to

    uniform float pixelWidth

    1.0/width or in other words a pixel width in vertex co-ordinates

    uniform float pixelHeight

    1.0/height or in other words a pixel height in vertex co-ordinates

    uniform vec2 destStart

    The top-left vertex co-ordinate of the rectange being drawn to.

    uniform vec2 destEnd

    The bottom-right vertex co-ordinate of the rectange being drawn to.

    For example a rectangle that covers the entire screen would have a destStart of (0,0) and a destEnd of (1,1)

    Usually they define a rectangle that covers just the object, but depending on the xml settings it can be larger.

    uniform float layerScale

    uniform float layerAngle

    ^ In radians I think.

    Both these are basically the same as their counterparts in C2

    Now the folling two aren't used in any bundled effects but they'd have the same values as ViewportLeft(0), ViewportTop(0) and scrollx and scroly respectively.

    uniform vec2 viewOrigin

    Top-left of screen in layout pixels

    uniform vec2 scrollPos

    Center of screen in layout pixels.

    uniform float seconds

    Time.

    uniform float opacity

    Current object/layer opacity in the range of 0.0 to 1.0

    In glwrap.js there are these others: aPos, aTex, matP, and matMV but they are only used in the vertex shader and I'm not even sure you can access them from a pixel shader.

  • If the shader is working with shadertoy it should work fine as is I imagine, since they're both webgl.

    Here's a helpful link:

    http://www.shaderific.com/glsl-qualifiers/

    "varying" is only for data shared with the vertex shader. In C2 those variables are fixed and usually I just find what values are varying from other shaders.

    "uniform" is only for the shader parameters you can set later.

    You can omit the precision specifiers and a default precision will be used. You can even change what that default is. So if you just have a variable you use in the shader it's fine to just write "float foo" or "vec2 bar".

    You should be able to use "const" the same way as with shadertoy.

  • It's one of those number precision things with computers. There is a limit to the number of digits of a number can be stored. JavaScript uses 64-bit floating point numbers to store numbers and according to this:

    http://en.wikipedia.org/wiki/Double-pre ... int_format

    It can store 15-17 significant digits, which is on par from what you found.

  • isasaurio

    I suppose you could just give the ball an elasticity greater than 1 to make it bounce more.

    bladedpenguin

    Only the main timescale works. Individual timescales aren't used because all the chipmunk objects need to have the same timescale for the simulation.

  • You'll need the time when he reaches full speed. Then you can calculate it with:

    Acceleration = 2*distance/(time^2)

    If he reached full speed after one second the acceleration would be 150pixels/sec^2, but I'd guess the max speed was reached before one second, so it wouldn't be correct.

    You can calculate the speed for any range of frames with:

    Speed = distance/time

    Where time = frames/60

    From your info the speed from 75 to 90 pixels would be 90pixels/sec according to that formula, so he'd already be at max speed.

  • With some programming languages you can, but with python and js you can't, at least not fully.

  • Joannesalfa

    I have, but I'm wrapping the html5 api to sfml. It's not an issue using a graphics library since I'll only be using a small subset of it. The issue currently is I haven't been able to build the V8 library yet.

    That game seems to go fast, but I have no idea if it's faster.

    Nesteris

    Because it's interpreted. So is Javascript for that matter but it's faster because portions of the code is compiled to machine code when it's run.

  • Well according to benchmarks JavaScript is anywhere from 3 to 60 times faster than python.

    http://benchmarksgame.alioth.debian.org ... g2=python3

    Python is still garbage collected and yes it can be used for games, even 3d ones. Usually though for 3d the engine part is made in C and python is used for the scripting parts that don't need to be fast as possible.

  • Lunarovich

    I've had a look into it and the bug occurs when I use:

    for x in instances[/code:2a9uzrdq]
    in my code.
    
    "instances" is an array so x just loops over the indices of the the array (0, 1, 2...).  But when it fails x's value is "random".  Looking in rot.min.js the Array object has these two methods added:
    Array.prototype.random
    Array.prototype.randomize
    
    Adding methods to the Array object will break Array.foreach since it will now loop over the the methods after the indices.  I can fix it in that particular case in my code, but any other plugin or part of C2 itself that uses Array.foreach will break as well.
    
    The solution would be to do something like this to redefine the other prototype methods of the array to compensate.
    [url=http://kenegozi.com/blog/2009/04/13/javascript-and-the-extended-array-prototype/]http://kenegozi.com/blog/2009/04/13/jav ... prototype/[/url]
  • Not much progress as of late. The culprits are technical difficulties mainly, so I have to change my approach.

    Nesteris

    It's a cool idea, but I don't have enough time for such a project. Python would be a cool language for the editor, but no so much for speed in the game itself. I'm using it here because it has allowed be to make the wrapper fairly quickly, but the side effect is it runs slower.

  • What object are you pasting to the canvas?

    When pasting an object to the canvas the object's non-webgl draw function is used. When webgl is on and the browser supports webgl, then plugins do stuff to get ready to draw with webgl, and have no need for the non-webgl draw function to work. For instance pasting a tilemap object with webgl on will have that problem. One solution is to set webgl to off in the project properties, but for most that's not an acceptable solution. You could use the Paster object instead as it doesn't have this issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A solution that's kind of hacky is to use a paster object as well.

    1. Paste the tilemap to the Paster object

    2. Load the Paster.imageUrl to a sprite

    3. paste that sprite to the canvas.

  • rexrainbow

    I haven't looked into getting it working with the minifier as of yet.

  • TiAm

    Did some tweaks to get that capx working. This can draw a third as many sprites as NW.js can and have the same performance on my pc.

    https://dl.dropboxusercontent.com/u/542 ... 3bench.zip

  • The crashiness seems to be related to the Python wrapper for the graphics library from what I can tell, or I may have created an issue somewhere since it's been crashing a bit more for me lately.

    It might work on xp, if it doesn't I probably just need to tweak how the exe was made a little.

    I've tried capx with lots of objects and it seems to drop framerate. When the count is low it performs better than the browser, but with a lot the browser seems to hold out longer. Probably it's something I can improve. The bottleneck is going to be with renderer not js execution speed since it uses the same engine as chrome.

    Ghost shooter was just a convienient example. It can handle much more elaborate projects than that. I'll look into getting yours working tomorrow.