[Beginner] I can't seem to grasp platformers

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
redsled
Prole
Posts: 38
Joined: Wed Jun 04, 2014 6:33 am

[Beginner] I can't seem to grasp platformers

Post by redsled »

So, I've been jumping from tutorial to tutorial on platformers. Most of which consist of using AdvTiledLoader, Tiled, and many lines of code I don't understand. Perhaps there is a complete and thorough tutorial on the forums, but I can't find a single one. I have made games with simple physics, but none that consist of platforming. I really want to make a platformer, but I'm just missing the knowledge to do so. If anyone can help me personally so that I could, that'd be amazing. The parts I specifically don't understand are collision algorithms with tiles.

Thanks for your time,
- redsled
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Re: [Beginner] I can't seem to grasp platformers

Post by Kingdaro »

You're right that there really isn't a good platformer tutorial around, at least, not one that's easily found on the wiki or otherwise. I've seen a couple, but such a subject really should have more information, I'd think.
User avatar
Duster
Prole
Posts: 32
Joined: Fri Dec 19, 2014 8:34 pm
Location: Ontario, Canada

Re: [Beginner] I can't seem to grasp platformers

Post by Duster »

Last year when I was looking into love2d programming I was pretty sad at the lack of good tutorials on platformers. I remember reading one that was decent enough, but the author dropped it after only a couple steps
Tile-based collision is pretty simple when you get down to it though, it's arbitrary shapes and slopes that can be annoying to do. Or even, god forbid, arbitrary slopes. I shudder at the thought.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [Beginner] I can't seem to grasp platformers

Post by Jasoco »

Use Bump. It comes with a demo to help you out and while it's only a collision detection and resolution library, kikito wrote a pretty simple example of how platformer physics works in the normal demo .love.
User avatar
sladjkf
Prole
Posts: 18
Joined: Mon Mar 02, 2015 7:18 pm

Re: [Beginner] I can't seem to grasp platformers

Post by sladjkf »

HardonCollider is pretty good for collision detection.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: [Beginner] I can't seem to grasp platformers

Post by T-Bone »

I think one of the reasons you're not seeing many tutorials on the subject is that there isn't really one solution that fits all projects. How you implement it is going to vary greatly with how you want it to work.

Two of the most basic things every platformer needs is some kind of physics calculations (how the characters are affected by gravity, friction and other physical forces), and some collision testing (is the character in midair or standing on the ground?). If you want a simple tile-layout (think Super Mario Bros. for the NES), you could implement the map as a matrix of numbers, with for example 0 for air and 1 for a block (and larger numbers for different kinds of blocks, coins etc.), and collision detection will basically be one (or a few) lookup(s) in this matrix. If you want slopes or even arbitrarily shaped platforms, you're obviously going to need a more complex model of your game world, and collisions will be implemented very differently. The size also matters; if you want a huge, scrolling world, you need to take memory management into account, but if levels are small, or divided into smaller chunks, it's going to be easier. It's similar with physics: if you just want simple running and jumping, you can write just a few lines of physics and it'll work just fine, but if you want more complicated things (inertia, wind, varying gravity, swimming, flying abilites, you name it) then you're obviously going to need to do more.

I hope you understand my point: I don't think it's much about finding a tutorial on how to make a platformer; it's more about you deciding what kind of platformer you want to make and how it should work, and then trying to implement it. If you have specific questions on how to implement things, the Löve community is of course here to answer your questions :neko:
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: [Beginner] I can't seem to grasp platformers

Post by Jasoco »

Bump is good for collision detection and resolution. Sadly HardonCollider doesn't resolve collisions. Bump will make sure objects won't overlap if they're not supposed to. It's only flaw is that it only does rectangular collision. No circles, triangles or other shapes or rotated shapes.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: [Beginner] I can't seem to grasp platformers

Post by Davidobot »

Jasoco wrote:Bump is good for collision detection and resolution. Sadly HardonCollider doesn't resolve collisions. Bump will make sure objects won't overlap if they're not supposed to. It's only flaw is that it only does rectangular collision. No circles, triangles or other shapes or rotated shapes.
Do you know of any library that does rotated shape collisions?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: [Beginner] I can't seem to grasp platformers

Post by kikito »

Platformers are deceptive. There are lots of them. We have played lots of them. They have been around for ages.

The obvious conclusion is that they must be simple to do. If there are so many, people will have "threaded that path" often. There must be libraries and tutorials and stuff. So it should be a good place to start, right?

Well, yes and no. Yes, there are lots of them, and we have played lots of them. But no, they are not a good place to start.

Here's the rub: programming even the simplest platformer is "medium" in difficulty - unless you are doing something equivalent to taking an existing, working codebase and swapping the graphics. Platformers have physic-like movements (acceleration, gravity, friction, etc) and have collision detection with (a very particular kind of) resolution. Even conceiving what all those terms are is a bit difficult when you are starting. Libraries like Bump (disclaimer: I am its developer) or HardonCollider or love.physics make these parts easy, but you still need to understand those concepts, and they are not beginner-level.

So I don't think a beginner should start with a platformer.

A much simpler genre is a shooter, like galaxian or R-type. Shooters have collision detection, but no resolution, and the movement is simple to implement. So that's my advice: if you're a beginner, start there. Leave platformers for a bit later on.
When I write def I mean function.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: [Beginner] I can't seem to grasp platformers

Post by Jeeper »

Davidobot wrote:
Jasoco wrote:Bump is good for collision detection and resolution. Sadly HardonCollider doesn't resolve collisions. Bump will make sure objects won't overlap if they're not supposed to. It's only flaw is that it only does rectangular collision. No circles, triangles or other shapes or rotated shapes.
Do you know of any library that does rotated shape collisions?
Box2d :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests