R0J0hound's Recent Forum Activity

  • Well the imagUrl is just a string which you can download with the browser object’s action: invoke download.

    With nwjs you can save it to a file too.

  • In events “sprite.something” only gives numbers and text.

    The drawing canvas is probably what you need to use to access image stuff. You’d paste the sprite to the canvas then you can access and set individual pixels or get an imageurl to save or download a png/jpg file.

  • Found if you set sampling to nearest then the thin slivers go away with meshes. It's probably not a viable solution since you'd want smoother sampling for everything else but still could be useful.

  • Likely int() uses parseInt() under the hood so it would still return 0. The string would need to start with a number for int() to work.

    If your layout makes have the pattern of a letter then a number then you could do int(mid(layoutname,1,10)) or something.

  • Mesh is almost an option if we can avoid the thin transparent gaps. I want to investigate fiddling with the math to see if I can remove or reduce the rounding errors. In theory I could scale tue triangles up slightly to eliminate it too. If that works out then I’ll make it combine triangles to reduce object count. Anyways, I’ll let you know. As is it’s mostly trivial to change between drawing with canvas or a mesh.

  • Here's the wip of the triangulation. It works with the the polygon defined by sprite instances in a CW order.

    Using a mesh to display the triangles didn't quite pan out because it gives thin transparent slivers due to math rounding. So it also lets you draw the triangles with the canvas as well since it doesn't have the slivers. It doesn't look worthwhile to extend it to generate convex polygons or triangle strips at this point. It will need reworking if you want to define the polygon in another way other than sprite instances. Doesn't work with self intersecting or CCW polygons, but the CCW case can be solved by detecting the order and reversing the list.

    dropbox.com/scl/fi/png6jg6a1qresctjq5ra6/triangulate_ear_clip_mesh_wip.c3p

    Alternately, if you want to use js for this you could look into this one:

    github.com/mapbox/earcut

    Or you could take the triangulation function out the old c2 chipmunk plugin. That one generates convex polygons.

    Edit:

    Just noticed that points ordered in CCW order could be used for a convex hull.

  • If the orbit is controlled by physics then to make it be able to orbit slower you need to reduce the gravity force. Or maybe just don’t give physics to the moon and move it with the orbit behavior instead.

  • The 14.2 mb is the compressed png size. That should remain the same which means faster downloads. When the game runs, the images need to be decompressed to use.

    45*650*540*4 =~ 63.2 mb

    Depending on the hardware texture sizes are only power of two so 650x540 may have to take up 1024x1024 which would give:

    ~188.7 mb

    Also keep in mind there will be other memory usage needed for the renderer in general. I think Ashley made a blog about it.

  • Self.x+dist*cos(ang)

    Self.y+dist*sin(ang)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A few ideas:

    Since you’re hitting the limit of the algo that the canvas object uses to convert a concave polygon to multiple convex ones, you could feed your polygon to another js library to do that and just draw the list of convex polygons it generates.

    Also as a tangent you could use a mesh distort to render convex polygons.

    For example for a 100 point polygon you’d do it roughly by:

    Set mesh size to (50x2)
    Repeat 50 times
    — set mesh at (loopindex,0) to point(loopindex).xy
    — set mesh at (50-loopindex-1,1) to point(50+loopindex).xy

    And actually you aren’t limited to just convex polygons. In general you can do any triangle strip in this way which includes some concave polygons. Also if you adjust the uvs you can get a textured polygon without using blend modes, but I guess that’s unrelated to what you’re doing.

    Anyways, the idea to explore is convert any polygon to multiple triangle strips and use mesh distorts to display them. To do that you’d slightly modify a triangulation algorithm like “Ear clipping”, which basically adds triangles at convex points if no other points are inside that triangle. To make it generate triangle strips instead of just triangles you’d zig zag moving cw then ccw on the plolygon when adding triangles.

    Alternatively you could triangulate, then merge triangles sharing edges if the result is still convex.

    I’ll be attempting to make an example of the idea when I get time.

  • Almost there. You need to click on one of the sub forums first.

  • That’s all I have at the moment.

    The array is a history of the positions of the head which basically can be thought of as a polyline. You can move along the polyline by a specific distance. A simple starting point would be to move a distance along a single line segments. Anyways, many path following examples do that.

    Another idea is to just move each section toward the section ahead of it till they overlap.

    Just some ideas. I won’t be making any examples any time soon.