Custom Gravity instead Physics behavior for Cocoon

Get help using Construct 2

Post » Fri Dec 06, 2013 4:46 pm

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.RenatoB2013-12-06 16:48:05
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Mon Dec 09, 2013 11:17 am

UP!
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Thu Dec 12, 2013 11:28 pm

@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.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Dec 13, 2013 7:53 am

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 7:55 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 10:21 am

[QUOTE=LittleStain] 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..[/QUOTE]

@LittleStain

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?
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Dec 13, 2013 11:05 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 12:36 pm

@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.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Dec 13, 2013 2:02 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 2:46 pm

@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.RenatoB2013-12-13 15:24:26
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Next

Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Jackriduk and 25 guests