Custom Gravity instead Physics behavior for Cocoon

0 favourites
  • 15 posts
From the Asset Store
Gravity Square is a game where I aim to reach the square at the polka dot door :)
  • If I use custom gravity instead of using physics behavior would solve the problem with CocoonJS? I do not know if it happens with everyone, but when using Physics with various objects, they fall in slow motion.

    If this solves, I need to know how to do this (some example, please). Thanks.

  • UP!

  • LittleStain

    I decided to ask you for help because you've seen and helped me with the game that I need to solve this issue. Is possible to easily create a code that simulates gravity to use instead of the physics behavior to revert the bad perfomance of the application builded in the CocoonJS.

  • Hi RenatoB,

    To be honest I've seen many games and helped with many, so I really don't remember which one you are referring too.

    To answer your question:

    Physics behaviour is very CPU intensive, especially if you use many objects and use collision polygon for collision detection.

    Are you using the cocoonJS physics engine?

    Faking the gravity is possible, but I doubt it will help you improve your performance, it could though.

    Maybe you should have another look at your game and decide if you really need physics or if working with bullet-behaviour with gravity would be enough with some tweaking.

    I have once created a custom movement faking gravity for a game, because only the player object really needed gravity-like behaviour, this worked so it is possible. (In the end I had to pull a lot of rabbits out of my hat to prevent fps dropping, for it also had issues with collision detection.

    If faking gravity is your only option I could have a look to see how to implement it in a way that would be beneficial, but I think dropping physics altogether and using other behaviours to fake the physics behaviour could be of more use.

  • Ok.. remember the game now..

    The effects in it can be achieved without physics..

    But it will take some coding to get the desired effect..

  • Ok.. remember the game now..

    The effects in it can be achieved without physics..

    But it will take some coding to get the desired effect..


    Thank you for assist me again. This extra code would be very complicated? Could you give me some help about it?

    Now that you remember the game, do you think I can get a similar result using bullet behavior?

  • Similar, yes.

    The same, no.

    The more you want to imitate what you have right now, the more code it will take, but I think if you start by using bullet behaviour with gravity, you are well on your way.

    If you do, please save the project under another name, as to not break what you currently have..

  • LittleStain

    I'll need the cubes falling irregularly (angled or sideways for example) and bullet behavior causes the objects always fall straight (y-axis), isn't it? How can I simulate it? This is important for the game dynamics: prevent the ball touches the ground and the cubes falling straight always, there will be no difficulty in the game.

  • I have no idea how you have your events set up at this moment.

    It could be using the physics behaviour isn't even the issue, but the way your events handle things.

    I'm not sure what the effect is you are going for and therefore I can't really help. You can give bullet objects direction and speed, you can use the set angle to no and manipulate it through events. You can fake dampening, force and elasticity through events, but only if you know what visual effect you want and if you divide that effect into the little pieces that visual effect is made up off..

  • LittleStain

    What happens to the cubes when they fall, happens because of Physics behavior: the cubes fall in an irregular manner, sometimes spinning, hitting each other, when they are destroyed also move erratically. This causes the movement becomes more natural. One side has the problem behavior using more processing, the other I'll have to understand how to do a fake gravity movements. It is also doubtful whether after simulated, the issue of high CPU processing happening also with the simulation code.

  • LittleStain

    Could you give me some example code of how to simulate this irregular tumbling, changing angles resulting from collisions and also the issue of elasticity?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm sorry, but I can't.

    The way you are talking about it is like you want everything physics does, but without physics. That will never work. Either you use physics and accept the low fps or you are going to have to accept some changes.

    From what I've seen of your program physics shouldn't have this much effect on your fps. I haven't seen your code and or the way you have your objects set up, so I can't be sure, but I think it should be possible to get your game up and running with physics.

    Otherwise you will have to decide what you will have to change to keep the game challenging without using physics. Some things can be faked, some can't. And some things that can be faked need a lot of tweaking before looking right.

  • LittleStain

    I understand. I also thought that 32 instances of a square object couldn't overload so much the app processing. I'll try to do some tests to reduce the FPS and experiment the bullet behavior. I'll appreciate if you have any more suggestions but anyway, thank you for all this clarification.

  • in physics property are your square objects set to collision mask : bounding box?

  • in physics property are your square objects set to collision mask : bounding box?


    I checked in debug mode that the game is with a rate of 60 FPS. That's a lot for an application isn't?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)