Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platformers - gravity. Request to integrate P2 in Lance. #45

Open
sugarmaster opened this issue Apr 29, 2017 · 11 comments
Open

Platformers - gravity. Request to integrate P2 in Lance. #45

sugarmaster opened this issue Apr 29, 2017 · 11 comments

Comments

@sugarmaster
Copy link

Hi i'm kind of new to the web engine scene altough i'm a programmer and already experimented with phaser and others.

I would like to know if there is any way to create 2D platformer games with the engine: basic gravity, stand on a platform, jumping, etc...

I have looked at the DynamicObject and SimplePhysicsEngine classes and I see nothing related.

I want to create a 4 player 2D arena platformer and this engine has everything needed for it but this.

@namel
Copy link
Member

namel commented Apr 30, 2017

Hi

A game that you describe would require integration between P2 physics engine and Lance, Lance doesn't have this right now but it's actually a good feature request. I will try to turn this issue into a feature request. If you are interested in taking on this project yourself, that would be a great pull request contribution.

If you have further questions along this line, you may prefer asking on the lance-gg slack channel. You can auto-join that team through this link

@namel namel changed the title Platformers - gravity Platformers - gravity. Request to integrate P2 in Lance. Apr 30, 2017
@OpherV
Copy link
Member

OpherV commented Apr 30, 2017

Actually, a 2D platformer doesn't even need a physics engine. You can do away with simulating the "physical" behaviours that you need (running, jumping, walls, platforms). We did something similar in our Spaaace example

@sugarmaster
Copy link
Author

Thank you, namel. I think it would be great to have 2D physics in Lancer. It was kinda strange to me to find out there are 3D physics with cannon js but not a fully integrated 2D engine.

As for simulating the physics OpherV I was thinking just the same if there was no plan to include 2D physics on the roadmap: just including basic gravity with acceleration and position parameters and the platform logic just checking collisions.

I found your engine because I had the idea of making a realtime js game for a long time in my mind but couldnt find any engine with the network logic already embeded into the engine so I just dropped interest.

I will look into this matter and see what is easier for me: simulating physics or implementing a physics engine. If it's the second i will contribute it to the engine.

I will join the slack channel to ask for help and stuff. Thanks.

@OpherV
Copy link
Member

OpherV commented May 22, 2017

@sugarmaster I made great progress with this, hope to have something usable soon :)

platformer2

@dtognazzini
Copy link

Hi @OpherV, I'm curious as to the progress of your efforts. Is p2 available in Lance now?

@OpherV
Copy link
Member

OpherV commented Aug 30, 2017

@dtognazzini the upcoming Lance V2.0 includes many new features to enable these types of games. No P2 integration yet, as I'm focusing efforts on other areas - but many enhancements to the SimplePhysics module

@danielytics
Copy link

danielytics commented Sep 22, 2017

I also want P2 integration, so I plan on doing a PR for this in the coming week or so (I'll be making my first attempt tomorrow, but it may take time to get ready for a PR). I'm not particularly interested in SimplePhysics, but I'm wondering if any of the enhancements or changes impact P2 integration?

For example, I haven't yet looked at the develop branch yet, but it seems to me that some of the logic in DynamicObject (the bending code) could be factored out so that it can be reused in other GameObject-derived classes. Any tips or ideas on this before I start experimenting with it myself?

@namel
Copy link
Member

namel commented Sep 23, 2017

+1 on the P2 integration. I suspect it's the single most critical feature missing in Lance.

I agree with your intuition, that the bending code should be factored out of DynamicObject. Basically there should be bending code for any object types that live in 2D space, and separate bending code for any object types that live in 3D space.

Since we don't yet havean entity-component-system or mixin design in place, the bending code could simply be a separate service, which implements 2D bending and 3D bending. That way DynamicObject and your PhysicalObject2D would both use the Bending.2D service, while PhysicalObject3D would use a Bending.3D physics.

@namel namel closed this as completed Sep 23, 2017
@namel namel reopened this Sep 23, 2017
@alexfreska
Copy link

alexfreska commented Oct 10, 2017

Really excited to see a 2D physics integration on top of all the great work already in lance! I think it would be very useful for a lot of developers.

I have not studied the lance source code yet, but would love to take a look at or help test your PRs attempting this integration @danielytics @namel . Thanks!

@jdnichollsc
Copy link

Would be very interesting the integration with Phaser Framework

@Unsigno
Copy link
Contributor

Unsigno commented Dec 11, 2017

Hi all, i begin a Lance game to implement the p2 physics . I based the P2PhysicEngine on CannonPhysicsEngine , just to wrap the p2 world . Is not working properly at the moment , but the intention is to finish making the game work to understand whats happening and later abstract the posible classes for Lance. If some one can help or want to check it you are welcome https://github.com/Unsigno/platforms-test . ( I just moved a p2 example to a Lance project to do it online multiplayer, i will update the readme to clarify all, but you can ask me there or on lance slack )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants