phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.12k stars 7.1k forks source link

About Phaser custom builds #1517

Closed rblopes closed 9 years ago

rblopes commented 9 years ago

Hi.

I just want to ask about the Phaser custom builds, regarding the physics engines provided with each custom script.

Now, I know that latest versions of the standard library include only the P2 and Arcade physics engines by default, leaving Ninja with its own custom script. Besides that, Arcade physics have its own custom script too, but why not (as of v2.2.1) a P2 one?

And about the emitter particles and tilemaps issue mentioned in the README: how those are affect by the absense of the physics systems at all, and how they act along each of the physics engines provided.

Just asking these out of curiosity and because I don't fell that the README doc convey enough explanation for that matter.

Thanks in advance.

pnstickne commented 9 years ago

Which README - and issue(s) in such - is being referred to?

Anyway, Tilemaps and TilemapLayers don't use Physics at all.

photonstorm commented 9 years ago

The Emitter works by creating a bunch of Arcade Physics enabled Sprites and setting their velocity as required. Hence it needs AP.

The Tilemaps will render without AP, but you'll need to handle collision yourself (or convert it to a P2 object, for which methods are provided)

rblopes commented 9 years ago

@pnstickne It's in the repo's frontpage (the README file), and in the Phaser documentation front-page, under Build Files and Custom Builds :)

@photonstorm So, it's reasonable that the standard script comes with both AP and P2, by what you explained. P2 can be expensive, and generating too many P2 bodies could be a problem, am I right? And by what you've mentioned, Tilemap bodies can be converted, meaning that they need to be created first (with AP), right? I haven't used P2 for any of my (silly) projects, so I can only guess.

Well, the main topic I'm discussing here is why things are done that way, like a Ninja-only, but no P2-only custom builds, and such, but I think I'm understanding that.

photonstorm commented 9 years ago

No you don't need AP to use P2 for Tilemaps.

The only dependency is Particles. If you're not using those you could technically use a P2 only build. There's no P2 only build task, but it would be trivial for you to create one based on the existing custom builds. Copy one and tweak as needed. Just exclude Particles.

rblopes commented 9 years ago

Ok. So, that's it. Thank you. :+1: