R0J0hound's Forum Posts

  • As a simple case instead of doing this.

    Array: for each xy
    --- do stuff

    You can instead do your event like this for the same effect. Except you would have to use loopindex("x") and loopindex("y") instead of Array.CurX and Array.CurY.

    System: for "x" from 0 to 325-1
    System: for "y" from 0 to 125-1
    --- do stuff

    Now it can be time consuming to loop over each cell as might be your case since it has elaborate logic that is run per cell. But if you do half the array one frame and the other half the next you can reduce the stall by half.

    One such implementation would be:

    Global number distribute=0
    
    Every tick:
    --- add 1 to distribute
    
    System: distribute = 1
    System: for "x" from 0 to 325-1
    System: for "y" from 0 to 62
    --- do stuff
    
    System: distribute = 2
    System: for "x" from 0 to 325-1
    System: for "y" from 63 to 125-1
    --- do stuff
    
    System: distribute = 2
    --- set distribute to 0

    Alternately you could do every other column with something like this:

    Global number distribute=0
    
    Array: for each xy
    System: compare Array.CurY%2 = distribute
    --- do stuff
    
    Every tick:
    --- set distribute to (distribute+1)%2
  • Instead of looping over the entire array maybe you could loop over only part of it at a time? Another idea would to reduce the number of times you read array positions by saving the values of the adjacent cells to variables.

  • You can disable the "bounce off solids" property and just use the bullet behavior's "bounce off object" action with an "on collision" condition. With that you can get the same effect as what Fidasx posted, only without solid.

  • Here is what is happening as stated by Blackhornet:

    <img src="https://dl.dropboxusercontent.com/u/5426011/fixed/Creation_picking.GIF" border="0" />

    And here is one possible way to get your function to work:

    <img src="https://dl.dropboxusercontent.com/u/5426011/pics/picking_new.png" border="0" />

    The first mirrors your issue. The for-each will only affect existing sprites. The second waits until the end of the tick to do the actions when the new objects are pickable.

  • Found a program here:

    http://www.thesimplest.net/pc/simplest-way-print-screen-screen-capture-window-needs-scrolling

    That takes a screenshot of a scrolling window. I tested it and it works well with event sheets.

  • The OnYes condition is a triggered event, which is only triggered in the event sheet and not in python. You'll have to either use just events or do it the way you'd have to do it without Construct in pure python by using a python library.

  • Well you don't have to use the snapshot, it can also load images in the files folder.

    So as in the title "why not", I updated this further. It now converts an image directly that can be loaded into the tilemap object. Right now it just does tile/no tile based on the alpha of the pixels, but it can be tweaked to use different tiles based on color.

    https://www.dropbox.com/s/vsq1xdlyvr7od ... .capx?dl=0

    Also on the plus side it's much faster. For me it works in just under a second for a 1280x1024 image.

  • JJList

    This reply is a bit late but as for the original clearing I couldn't get it any faster by not using sqrt.

    As for using the pixels from the canvas object here's an example:

    https://dl.dropboxusercontent.com/u/5426011/examples21/canvasWithTileMap.capx

    It is very slow, for me the whole bit takes about 5 seconds to transfer the canvas to the tilemap.

    So on a whim I also did a test with a snapshot and straight javascript using the browser object since I didn't want to make a plugin.

    https://dl.dropboxusercontent.com/u/5426011/examples21/snapshot2tilemap.capx

    For me it takes about 3 seconds. After looking at the times I think it can be made faster by bypassing the array and just converting the pixels to a format the tilemap can load. But that isn't a simple task as the format is pretty complicated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your slider setup had to be tweaked to make it possible.

    https://dl.dropboxusercontent.com/u/5426011/examples21/3slider.capx

    The "balance" function is what adjusts the non-picked sliders.

  • It appears to be some kind of rounding issue. If you increase the 10 to 100 then it works.

    Ok, now I get it. The rgb() function converts the parameters to integers by basically running floor() on each. With a starting red of 150 then subtracting from that gives a number a bit less than 150 which rounds with floor to 149. But with adding you get a number a bit bigger than 150 which rounds with "floor" to 150. So the red will only increase if you add 1 or more to it at a time.

    A solution is to have a global or private variable to increase/decrease and set the red from that.

  • I'm impressed that the tilemap renders so fast with 1x1 tiles. This has potential, and I do enjoy optimizing.

    I took your forth capx and added a text object to store the average time it takes the function to clear a circle.

    https://www.dropbox.com/s/mwjxctu4vhx7w ... .capx?dl=0

    So now I have something to compare against. For an initial test I went for circle clearing with as few events as possible. The algorithm I used is just the graph of a circle. Bresenham's algorithm probably will be faster but I haven't fiddled with your events with the same stuff I did with mine.

    https://www.dropbox.com/s/t8mizv3e6hugt ... .capx?dl=0

    Compared to the two "simple.capx" is about 3 times faster. Here are some things I did and my reasoning. Note that I wasn't profiling as I went along so I'm unsure of the boost each gave, if any.

    * I changed the function so x,y and radius are passed as parameters. This to eliminate the need to re-pick the bullet in the function. Actually this probably was a negligible change. It was more of a style preference.

    * I used "erase tile range" instead of "erase tile". This likely was the biggest boost since it eliminated a loop level since we can just erase spans of tiles at a time.

    * I didn't use the "Tilemap.PositionToTile" functions since with 1x1 tiles pixel position is the same as tile position. A little flexibility is lost doing this since the tilemap object has to be at position 0,0.

    That's about it. Next I'll have tinker with your events to see avoiding a sqrt() with some more events perform better.

  • delgado

    Just drag the c2addon file into C2's window and it should install.

  • AnD4D

    ARM and x86 are the processor types. ARM is what almost all android devices use so I'd say pick that.

  • "-Have save games/ chapters that user can load"

    Yes, look at the webstorage object

    "-Have moving objects in background (like people far away) that are walking?"

    Yes, anything you place in the editor is moveable at runtime.

    "-My final question is can I release it on Steam? "

    You can export it to an exe with the node-webkit export.

    https://www.scirra.com/manual/168/supported-platforms

  • For particle fluids using a bunch of circles with the physics behavior like it the video is probably the easiest way. However the physics behavior uses it's own collision detection so it isn't affected by the collision update.

    A more realistic motion of water would just be water particles that repel each other with forces instead of collision impulses. With that particles would only need to repel other particles close by, in which case the collision update might help a bit.