0 Favourites

[SUGGESTION]Physics: check if landed on ANY sprite

  • Probably not the first one to request that, but here goes:

    It would be very nice to have a feature for the physics behavior that simply checks if there's ANYTHING underneath the player. So we can know when the object hits the floor. Without having to do collision checks with every instance of a sprite. Check underneath through 10 pixels (user defined)... if you hit anything, it's true, if not, it's false.

    Also, if physics could interact with a simple solid object... I wonder if it would make collision checks a bit faster or help the above at least?

    Thanks

  • I don't think you actually want this! "Anything" includes the background objects, so would likely be true all the time, making it useless.

    Why not add all the objects you want to test for collision with to a family (perhaps name it "Floor")? Then you can test for overlap with any of the objects in the family with a single "Is overlapping floor" event. More information in the Families manual entry.

  • I meant "anything" on the same layer, for instance... You know a brutal way to simplify and optimise collision checking on many objects.

    Families! Thanks for the tip, Ashley.

    Do families help the performance of a game for collision checking for instance?

    If I have 50 sprites (5 types of sprites, 10 instances each) to do a coll check with a physics ball(player) if I put them all in the same family, will the engine do just one coll check for all at once?

    Or is it purely to simplify the event sheet?

  • The engine first does a very rough check, which excludes any objects outside the maximum possible collision area. This is a very fast check. Then it checks objects within that area using more accurate criteria. You shouldn't have to worry about number of objects, as long as there aren't too many collision checks going on.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Updated post above.

    Thanks Mipey. Yes actually it seems like when you use a physics object all floor sprites need to have physics too so that means coll checking with them just to know if it's on a floor.

    I made some tests and just having 10-15 floor sprites with physics dramatically reduces performances on slow devices like an ipod2.

    So am I missing something? Does that mean this is the performance limit of javascript?

    The most logic you can run on a slow device is a few lines of code and 5 collision checks?

    I am surprised and dissapointed. :'(

  • Bump of the last hope!:-P

  • If you are not using a wrapper... yes. Unfortunately, it's that bad.

  • Oh, but I am using Cocoon... that what you call a wrapper?

    If so then I guess I'm sh*t out of luck having paid for a personal license and not being able to make a simple physics game for a lack of solution to my problem.

    Looks like I was shooting a little too high for C2.

    Thanks for your input anyways.

  • Mobile devices are generally too weak to support complex physics games. You should avoid using physics for mobile devices if possible.

  • High expectations on HTML5 specially on mobile currently will only disappoint you i fear, even with wrappers :(

  • TheDev ( and for ludei)

    I'm in the same situation. Used to do tests with CocoonJs, whith wonderful results, all things seems to run at 55-60fps.

    Started to build a simple physics game, and have no success with performance testing. Done all the performance tips (reduced physics and non-physics objects number by 50%), made the Screen smaller (zoom-in) to show less object in screen in a time, removed all text objects, etc...

    The best I can achieve were about 27-32FPS what sounds to be good, but is really horrible to play, cause of the very slow moton of physics.

    I used to think that 20-60 physics objects are OK for a mobile (1,2Ghz CPU + GPU) with CocoonJS wrapper, but I can not optimize my game to make it. :(

    I can provide a capx/CocoonExport for ludei if they can look at this project to discover which functions make it dead on mobile.

  • Give it a shot with the latest beta R115 and see how the performance is now :), should be much better.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
192 26,760
NotionGames's avatar
NotionGames
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,324
RetroDaddy's avatar
RetroDaddy
Unread hot topic
86 28,713
St4rDu57's avatar
St4rDu57