Coin-coin le Canapin's Recent Forum Activity

  • Hi.

    I was trying to draw a filled circle using this algorithm : http://stackoverflow.com/a/1201304

    I am aware it's certainly possible to draw a filled circle using simpler way, but I'm trying to find a fast algorithm to iterate all the pixels contained in a circle, so I'm trying things.

    [attachment=1:2zbix766]disk2.png[/attachment:2zbix766]

    [attachment=2:2zbix766]disk.png[/attachment:2zbix766]

    The question is : why doesn't Canvas draw full black lines here ? The "grey" here is like 25% opacity, it should not be transparent in any way, just plain black.

  • Basically, you can't.

    If you really want to, you can check this message : destroy-objects-parts_p636126?#p636126 <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    For my game, I'll have to create custom movements from A to Z because of the Canvas landscape and I bet it won't be easy.

    Regarding my algorithm, I'm using the one written in the second comment : http://stackoverflow.com/questions/1201 ... ed-circles

    That's not very fast. I'll try to use the first one (I tried before but I was using it wrong so the results weren't as expected...).

    I know nothing about maths so it's kinda hard for me to use all this stuff with numbers, letters and sometimes more. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Thank you <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I also saw the 1*1 tilemap solution.

    If you simply want to create a hole in a picture with no more effects like your tank game, the Canvas plugin itself can do that very well, just paste any sprite on your canvas with a "Destination out" blend effect.

    It's very efficient and I think even with big holes. But maybe you've already tried this ?

    My project is slower more complicated because I really want to count each pixel in order to have a proportional number of particles.

    I need to use a faster algorith to count the pixels inside the explosion radius, and I'd also like to find a faster way to update my array, I don't know if it is possible.

    BTW, I've also added an increasing/decreasing radius option with the mousewheel as you did, so you can see the actual (bad) performances with more pixels to remove : http://canapin.com/construct/worms/terrain/

    Also, my canvas is quite small. I bet the performances decreases a lot with a bigger canvas.

    Edit : well, they don't. Takes some time to put all the pixels into the array, thought.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I dont really understand what kind of advices or feedbacks you want here ^^"

    For example, like this !

    Alhough, what about the particles being of the color of the pixel destroyed? That should be a bit better ^^

    And technical advices too.

    humanescape : thanks

  • Hi. I'm working on a game like Worms.

    I made a destructible landscape you can destroy pixel by pixel, with the help of the Canvas plugin (and the precious advices of R0J0hound).

    This is quite easy ; the tricky part was that I wanted to have a number of generated particles according to the number of destroyed pixels.

    I'm storing all my landscape pixels in an array. Then I check the pixels directly into the array instead of checking them directly on the canvas via the alphaAt method. Finally I update the array to remove all the pixels that were destroyed.

    It still needs tweaks to be faster.

    http://canapin.com/construct/worms/terrain/

    I'm interested in any advice or idea ! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Hi again.

    I've used an array as you said to read pixel informations. It's much faster !

    Now i just have to update the array, replacing all pixels from the hole by transparent pixels (a few thousand).

    Hope this won't be too CPU expensive.

  • Thank you for the explanation.

    I'll look at this

  • Hi.

    I'm working on a game similar to worms.

    I'm trying to use the Canvas plugin to destroy the landscape pixel per pixel.

    I've also set up some events to create more or less particles, regarding the proportion of destroyed landscape.

    You can check it up here : http://canapin.com/construct/worms/terrain

    Basically, it checks every X pixels in the square containing the round hole created on each click.

    You can increases X to get lower precision and better performances.

    The main issue here is that checking every single pixel of a square is VERY slow. Why ?

    The computer freezes for about a second when I check for every pixel.

    It stills freezes for a short time even if I checks every 4 pixels. That's acceptable for a turn bases game thought, but not that nice.

    Is there any other way to do the same thing with better performances ?

  • No, I did not. How does this work ?

    eli0s : Thank you, I've done something like this to get my font preloaded.

  • Nice, thanks !

  • I thought about this too, I'll give a try.

  • I thought about this but it would be a nice solution if my target hitbox was a square, which is not

    edit : well, it's actually a circle. Maybe I can just, every tick, check the distance between the center of my first object and the center of my target. If the distance is equal or smaller than the target radius, then it's a hit.

Coin-coin le Canapin's avatar

Coin-coin le Canapin

Member since 22 Dec, 2010

Twitter
Coin-coin le Canapin has 1 followers

Trophy Case

  • 13-Year Club
  • Email Verified

Progress

14/44
How to earn trophies