R0J0hound's Recent Forum Activity

  • Problem Description

    On older ati cards (ones that you can't get a driver for newer than 2010) sprites with non-power of two textures become invisible when you make them smaller.

    Attach a Capx

    https://dl.dropboxusercontent.com/u/542 ... e_ati.capx

    Note: this is a ati driver bug so you likely can't reproduce.

    Description of Capx

    This just a sprite with a 200x200 texture resized to 50x50. The result on my radeon x1200 series card is the sprite is invisible.

    Steps to Reproduce Bug

    • Step 1: Create sprite with a non power of two texture size.
    • Step 2: Resize the sprite smaller till it fades to invisible

    Observed Result

    When in the editor and I resize a sprite that has a non-power of two texture, it becomes invisible after shrinking it to a certain size.

    Expected Result

    I would expect the sprite to not become invisible.

    Affected Browsers

    N/A, it is a editor issue.

    Operating System and Service Pack

    Windows vista sp2

    Construct 2 Version ID

    r205 32bit

    Proposed Solution

    The bug has been reported a few times before and always has been closed as a driver bug, which is understandable since something like this is near impossible without being able to reproduce it. But recently I was working on something else in opengl where stuff was invisible and found the cause and a solution.

    Basically the mipmaps aren't being created when using glGenerateMipmap due to an ati driver bug. Usually the solution is to update the drivers but that is impossible on cards like mine. I then stumbled upon this which gives a solution that worked for what I was working on.

    https://www.opengl.org/wiki/Common_Mist ... generation

    [quote:xzoylwwc]Warning: It has been reported that on some ATI drivers, glGenerateMipmap(GL_TEXTURE_2D) has no effect unless you precede it with a call to glEnable(GL_TEXTURE_2D) in this particular case. Once again, to be clear, bind the texture, glEnable, then glGenerateMipmap. This is a bug and has been in the ATI drivers for a while. Perhaps by the time you read this, it will have been corrected. (glGenerateMipmap doesn't work on ATI as of 2011)

  • You could also do something like this:

    choose(0,180)+random(-1,1)*45

    If 45 is two wide reduce it to a smaller number.

  • I don't think the "for each" would be the issue. I'm kind of curious if the "or" us throwing it off when combined with the drag n drop behavior. It shouldn't though. Actually it could be the drag n drop behavior isn't correctly handling multiple objects being dragged at once.

    Until we can prove that one way or another we could get rid of the dragndrop behavior and do it ourselves with events. Like so:

    on sprite2 touched

    --- set id to touch.id

    --- set dragging to true

    dragging is true

    for each sprite2

    --- set position to (touch.XForID(Sprite2.TouchID), touch.YForID(Sprite2.TouchID))

    on any touch end

    pick sprite2 id = touch.id

    --- set dragging to false

  • Yeah that's the changes as I described. Can't see what's amiss. I'm unable to test. :/

    Ok, the general idea for multi touch is each new finger press has an id.

    When you touch a sprite2 the current is saved in a variable so you know which sprite2 goes to what finger.

    The code above is supposed to loop over each sprite2 and basically move to the closest point on the circle near that sprite2's assigned finger.

    But if it doesn't work then I'm kind of stumped until I do some testing on a multi-touch device.

  • Sorry, I think I neglected the fix in LittleStain's capx. I don't use multi-touch devices so I didn't test. The fix is to do what LittleStain did in his capx.

    1st add this event:

    on touched sprite2
    --- sprite2: set touchID to touch.touchID[/code:36jgbpqk]
    
    2nd replace sprite2.x and sprite2.y with
    touch.XForID(Sprite2.TouchID)
    and
    touch.YForID(Sprite2.TouchID)
    
    That should make it behave like LittleStain's capx.
  • Use a regex expression to do that:

    RegexMatchAt(AJAX.LastData, "01.*!", "", 0)

    Regex is very powerful and allows you to do a lot of cool text searching.

    https://developer.mozilla.org/en-US/doc ... xpressions

    This is the expression I used:

    01.*!

    What it does is:

    0 matches "0"

    1 matches "1"

    . matches anything

    * matches any number of the previous. Or in this case anything

    ! matches "!"

  • After you create the bullet and the enemy with the same angle as the enemy then this action should do it.

    Bullet: Rotate min(80, anglediff(angle(enemy.x,enemy.y,player.x,player.y), enemy.angle)) degrees toward (player.x, player.y)

  • TiAm

    I haven't touched it in a bit, but one thing I found was it seems to grab the frame 4 frames back but not always immediately. If you use the "load texture from canvas" four frames in a row then it should for *sure grab the canvas. At least as I recall.

    *tested with chrome on desktop. It might be something internal to how the browser works.

    The the main issue is copying the canvas to a texture is not undefined behavior according to the webgl spec, which might explain why iexplorer doesn't work. i had thought it might be an issue of when I grab the canvas but I haven't been able to find any place that works better.

    One thing that I could investigate further is enable a flag when the webgl context is created to tell it to save the canvas' texture after every frame. The drawback is it's not something I can do from the plugin, I'd have to change it in c2's runtime. The second drawback is the webgl spec has an ominous warning that says enabling that flag can have an overall performance impact.

  • Probably it could be done by using the effect on the game layer or layout, so you could just move the sprites around like normal. The difficult part is mapping billboard sprites to the 3d view (it's tedious math). Basically the same perspective transform the fx uses needs to be used to make it look right.

    I made an example in the topic and it works, but isn't simple:

  • Here's the example tweaked to work with rotated ellipses.

    For unrotated ellipses dx and dy are just (Sprite2.x-sprite.x) and (sprite2.y-sprite.y).

    https://dl.dropboxusercontent.com/u/542 ... lipse.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So I suppose it will have to wait till Tom gets back to resolve the issue.

    In the mean time shall we name our new spam buddy? I vote for something simple like Carl. All in favor?

    When the scirra office closes for the day the forum should change to a darker appearance with the message

    "What a horrible night to have a curse..."

    Bonus if they can get this music playing in the background.

    https://m.youtube.com/watch?v=7tNQXwjAlI0

  • Assuming in your array you use:

    0 for air

    1 for dirt

    2 for stone

    You could do the following as sub-events to a start of layout to populate the array:

    for "y" from 0 to 32

    for "x" from 0 to array.width-1

    --- set array at (loopindex("x"), loopindex("y")) to 0

    for "y" from 33 to 64

    for "x" from 0 to array.width-1

    --- set array at (loopindex("x"), loopindex("y")) to 1

    for "y" from 65 to 80

    for "x" from 0 to array.width-1

    --- set array at (loopindex("x"), loopindex("y")) to choose(1,2)

    I don't know how you're placing the tiles so you can see them but the usual way would be to loop over the array and create the correct tile based on the value in the array. Say your tile size is 32x32 you'd create the tile with something like "create dirt at (array.curx*32, array.cury*32)".

    It will be slow if you use a sprite per tile so a better way would be to use the tilemap object instead and set the tiles from the array.

    For hills and whatnot this post could be helpful, it also shows the use of the third party noise plugin:

    1.

    It all depends on how you're doing the trees, like will they be blocky or sprites. Either way you could loop over the surface tiles and occasionally grow a tree. One way would be to spawn random seeds in the air, let them fall and have them grow where they hit.

    2.

    For that perlin noise could be useful. Or you could use some oddly shaped and randomly placed sprites during the generate stage, and set all the tiles it overlaps to ore or something.

    3.

    The tilemap object will be your biggest friend for this as it's very efficient at drawing only what's on the screen regardless of how big the world is.

    4.

    I don't know of any off hand but I know there are lots of tutorials and examples to study. Do a search, I'm pretty sure there are examples that do as you describe.

    5.

    There are many ways to do it, but your idea and the approach you used in gm will most likely work here.

    As for 5 minute loading, I haven't ever encountered such a delay. If use a massive array it could take some time to loop over to generate, but otherwise I have no idea.