Dalal's Forum Posts

  • I realize this is a minor thing, but it felt easy enough to report. The checkmark after "My comment isn't aggravating" is pushed to the next line. The screenshot is from the release page.

  • I currently fade from and to white by using an "Overlay" layer with the background set to white, and changing its opacity. I went this approach because it most easily achieves a fullscreen white-out on varying device resolutions.

    The issue is that it results in a lot of overdraw and thus fillrate issues on certain devices, causing a drop in framerate during fades. Do you have any ideas for a more performant approach?

    EDIT: I thought of using an Effect (brightness or something) on the entire layout. Tried it out, and Brightness looks UGLY. So it rules that effect out at least. Perhaps there is another effect I could use?

  • That is very helpful, thanks!

    Now I need an iOS one.

  • Any good resource where I can find out what devices people are currently using?

    E.g.

    Samsung Galaxy S4: X million people

    Samsung Galaxy S6: Y million people

    iPhone 4s: Z million people...

    iPhone 6: bla million people...

    etc.

    A percentage breakdown would suffice. I'm having trouble finding this info. Appreciate your help!

  • If you don't change any of the object images or animations, then simply use letterbox scale mode. Then on a 720p screen you'll get 720p display.

    Definitely. That's what my game already does. However, I'm wanting 720p on a 1080p screen, or even a 4k screen. Essentially, I want to limit the max resolution. Does it make sense to do that to improve performance? The idea is that the GPU will have to render less overall pixels, but I'm not sure if what I'm doing to achieve that makes any sense.

    I used this tutorial the other day, maybe this will help you

    https://www.scirra.com/tutorials/932/mu ... erformance

    This method is almost perfect for my needs. However, it seems that if you click on the 5th square (going right to left), and then click on the 4th square, the view gets cut off to only show the region in the bottom-right. What causes this exactly? And how could one fix it? The events appear identical. It's only that specific combination (Scale to 6.0, then Scale to 3.0) that appears to cause it. Wth?

  • Thank you all! Some very good insights here. Marapa, that tutorial is basically perfect

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My game targets the standard 16:9 aspect ratio, and the window size is set at 1080x1920 (it's portrait).

    Because it's 1080p, it looks super crisp. However, I want to see if I can give it a performance boost by reducing the resolution down to 720p, or 720x1280. It'll look slightly 'softer' on high-res devices, but nothing too horrible.

    The problem is that the game is a bit complex, and going through and adjusting every object and event to work with the new resolution will be arduous and prone to error. Is there an easy way to scale the whole game down in a way that reduces the amount of pixels the GPU needs to render?

    A dynamic approach is preferable, but any ideas you guys have, no matter how good/bad, will be much appreciated! Thanks.

  • You might consider moving the balls yourself, either with a CustomMovement behavior, or just by giving the balls XSpeed and YSpeed variables and Every Tick setting Ball.X to Ball.X + Ball.XSpeed*dt and Ball.Y to Ball.Y + Ball.YSpeed*dt.

    This way you'll have control over each axis separately (I don't know if the behavior you are using already allows that). You want the YSpeed to always be the same no matter what kind of hit. For angled hits, add a little speed to the XSpeed to bounce it off to the side. The effect this will have is that angled hits will move quicker through the air (since their overall speed will be higher), but their YSpeed will be the same, causing them to come back down at the same time.

    Now, this method might serve you for short play times, but due to the various inaccuracies that occur due to the ball hitting the player at different offsets (sometimes at lower Y coordinates, sometimes at higher Y coordinates, and at slightly different times, with a fluctuating frame rate), over long plays you might find that it becomes unfair again, even though the initial offsets were correct. For this reason, I would suggest re-enforcing the offset right after a player hits it. You might try saving the time offset in the ball, and then when you hit a ball, use Ball.Offset and the current time to determine when to release the ball upwards so that it falls back into its correct pattern.

  • I think Event 3 needs one more condition. "Is Not Crouch Attacking".

    It was freezing because Event 3 would set its animation to Idle first, and after that you'd change it back to CrouchingAttack. Since this would happen every tick, it would never get the chance to go to the next animation frame.

    These events are prone to such errors though. I would suggest trying to use more sub-events and Else conditions for neater logic. For example:

    On N Pressed
         Player Is Standing
            Do standing attack animation
         Player Is Crouching
            Do crouching attack animation
        etc.
    [/code:2vxkp847]
  • This seems to work for me, and it's a simple formula. Scrap the Sine behavior. Add instance variables to your Sprite called XSpeed and TargetX.

    // Basic Formula
    Every Tick:
       Set X of Sprite to Sprite.X + Sprite.XSpeed*dt
       Set XSpeed of Sprite to (Sprite.XSpeed + (Sprite.TargetX - Sprite.X)*STIFFNESS_AMOUNT)/(1+DAMPENING_AMOUNT*dt)
    
    // Optional: Prevent Excess Wobble Near TargetX
    abs(Sprite.TargetX - Sprite.X) < 0.5
       Set X of Sprite to Sprite.TargetX
    [/code:6s2masrv]
    A good starting value for both STIFFNESS_AMOUNT and DAMPENING_AMOUNT might be around 5 to 10.
    
    Now I'm not sure if this is the "proper" way to do it, but it makes sense if you think about it. The further the object is from the target, the greater the force that needs to be applied to it, so we add a value to XSpeed proportional to its distance from the target. The stiffer a spring is, the HARDER it pulls an object towards it, so we multiply by the stiffness. Finally, springs slow down because of some energy lost in friction and whatever else. So we divide by some value over time.
  • Use Families. Add all your buttons to a Family. Add Family instance variables Enabled, Pressed/Clicked, etc. Also, add a 'callback' variable.

    Use callbacks to automatically go to a section of code (call a certain function) when a particular is button is clicked.

    Example:

    On Touched "Button"

    -- Call Function (Button.callback)

  • One thing I've done in the past (which you may have already tried): if the RUN animation isn't too long (less than half a sec before it loops), you could wait until it reaches its beginning (transitional) frame before stopping.

    For example:

    -- If Player is Stopped & RUN is Playing & RUN animation frame is 0

    ---- Set animation to STOPPED

    The issue with this is that he'll run a little in place before he becomes truly idle. The longer your run animation, the worse it'll look. Often times, you'll have multiple identical (or similar) frames in your RUN animation. If so, you can improve the result by testing to see if it's any of these frames rather than just the first one. If your player has deceleration (i.e He gradually comes to a stop when there's no input), then this could look pretty decent if you start the transition while he's slowing down.

    A more complex approach (just throwing it out there, don't know if it'll look good) would be to locate an appropriate transitional frame, and then animate the character towards that frame. For example, if the character's walk is 10 frames long, but he is two frames past the ideal transitional frame, reverse the animation, and then stop it once he's at the right frame. If, on the other hand, he is 8 frames in, let it play out until it loops. Find the closest distance and change the animation accordingly.

    Don't know if that gives you any ideas at all :P

  • You could try adding another spritefont object which contains the different frames. For example, you'll have SpriteFontStyle1 and SpriteFontStyle2.

    In game, place both objects in the same place. Manually toggle the visibility of both sprite font objects to achieve the animation you want.

  • Just throwing this out there. It looks like you intend for your code to only run once when the conditions are met, so why not use "Trigger Once" in your conditions?

  • I think I found a little hack you could use

    Array.Push(YourValue) // push a new element regardless of the comparison

    Array.Delete(Array.At(Array.Width-2) = Array.At(Array.Width-1) ? Array.Width-1 : Array.Width) // compare and delete if need be

    I might have screwed that up, but essentially you can exploit the fact that trying to delete an element outside of the array does NOTHING. So you can put your conditional in the delete event. If the comparison passes, use an index outside the array (so it won't delete anything). If it fails, then delete the element you just added by using the last index in the array.