[Help]Sidescroller Engine

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
zrrion
Prole
Posts: 1
Joined: Wed Nov 18, 2015 9:07 pm

[Help]Sidescroller Engine

Post by zrrion »

Hello. This is my first post on these forums, so I apologize if this is the wrong place for this post.

Anyway. I've taken a look at löve and it looks to be the exact thing I would want for an indie sidescroller. Problem is, I am unsure where to start. From my searching there don't appear to be any basic 2D sidescroller engines floating around for love, but rather every project has built their own.
Is this the case? If it is, where would I look to start building my own?
If it is not the case, can anyone point me towards an engine?

tl;dr could someone point me in the right direction for making a sidescroller, either to an engine, or to someething that would help with creating my own?
The z in zrrion is never capitalized, ever. Not even on Wednesdays.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [Help]Sidescroller Engine

Post by Jasoco »

If you don't need slopes, you can look into kikito's Bump 3.0 (Not 2.0. Both threads are in the Demos forum. 3.0 is better.) collision detection and resolution library. It has a simple demo of a platformer. But it's very simple. If you want to actually do scrolling you should look into a camera library if you don't want to try and figure it all out yourself. I code my own from scratch but it's a lot of work. You could start simple and go the Knytt route where the level is divided into non-scrolling screens. Then you don't have to bother with camera math and can implement that into a later project once you've gotten the hang of coding.

See, one thing you need to remember when scrolling is that you have to learn how to cull stuff that isn't on screen. Like if you have a large tile map, you don't want to be looping over every single tile in the level every frame because like 80% of it is off screen and it's wasting time and slowing down. So you need to do some math and only loop over the visible tiles. That's one tip to remember.

Also, physics for a platformer are simple usually, but can still be a bit overwhelming. If you are new to programming you can start with a different kind of game like a top-down game where you don't need to really worry about whether you're jumping or standing on a platform.

Also, don't use Box2D for your 2D platformer unless you know exactly how to use Box2D to make it work like a normal platformer. It might be tempting to use it because it's there, but it also does not work like a regular platformer out of the box. It takes a lot of tweaking and work to make sure you can work the physics correctly. Just way too much work. Just look at Concerned Joe/Move or Die. Those are built in Löve with Box2D but took a lot of work to get where they are but the character physics might still feel "floaty" to someone used to other platformers.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

Re: [Help]Sidescroller Engine

Post by adnzzzzZ »

Jasoco wrote: Also, don't use Box2D for your 2D platformer unless you know exactly how to use Box2D to make it work like a normal platformer. It might be tempting to use it because it's there, but it also does not work like a regular platformer out of the box. It takes a lot of tweaking and work to make sure you can work the physics correctly. Just way too much work. Just look at Concerned Joe/Move or Die. Those are built in Löve with Box2D but took a lot of work to get where they are but the character physics might still feel "floaty" to someone used to other platformers.
All you have to do is use body:setLinearVelocity and do velocity/acceleration calculations on your side to make it not floaty. Then whenever you need the physics engine to take over (like when you want to push an object based on some force), use body:applyLinearImpulse or body:applyForce and make sure to disable your setting of body:setLinearVelocity so the body's velocity isn't overwritten while it's being pushed. This is relatively simple logic that gives you control over how movement works.
User avatar
pgimeno
Party member
Posts: 3548
Joined: Sun Oct 18, 2015 2:58 pm

Re: [Help]Sidescroller Engine

Post by pgimeno »

adnzzzzZ wrote:All you have to do is use body:setLinearVelocity and do velocity/acceleration calculations on your side to make it not floaty. Then whenever you need the physics engine to take over (like when you want to push an object based on some force), use body:applyLinearImpulse or body:applyForce and make sure to disable your setting of body:setLinearVelocity so the body's velocity isn't overwritten while it's being pushed. This is relatively simple logic that gives you control over how movement works.
I'm not the OP, but wanted to thank you for the advice anyway :nyu:
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: [Help]Sidescroller Engine

Post by Lafolie »

A physics library can be great, but when you're starting out I do believe that it's a very good idea to have a go at doing some pseudo physics yourself. Having an understanding or insight as to how things like Box2D work internally can help you solve problems when you do use them, and adds to your overall grounding. You might even pick up some habits or techniques that are useful elsewhere (this is particularly true with data structures).
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 83 guests