Page 1 of 4

### [Tutorials] Making a simple 2D physics engine

Posted: Wed Oct 08, 2014 7:18 pm
Hello again, guys! So, after finishing my simple physics engine, I decided I could make some tutorials to show to other physics-engine beginners that making a simple 2D physics engine isn't as complicated as it looks. I've been avoiding doing one for a few years, but after LÖVE Jam #2 I decided to give it a try, and turns out that I was wrong about thinking they were over complicated.

I made two tutorials (I'll still make the last one in a short future) and tried to make them as simple as I could. I made them illustrated and showcased some variants of concepts, so people could understand more easily the concepts of 2D physics and come up with their own methods of doing it.

If you guys are interested, have any ideas, suggestions or feedback about these tutorials (or the future one), please let me know.

Without further ado, here are the tutorials:

Making a Simple 2D Physics Engine - Part 1
• Content: Collision detection/handling.

Making a Simple 2D Physics Engine - Part 2
• Content: Gravity, friction, speed, masks and other global/local concepts.

Making a Simple 2D Physics Engine - Part 3
• Content: Drawing objects and optimizing your engine.

Physics Simulator game
• Content: Multiple physics-handling methods in the same game, small "playground" to test object collisions, in-game settings for variables and methods as shown in the tutorials

Tutorial snippets
• Content: Slopes, player movement, triggers, environmental physics, custom properties, etc.

• Nothing here is confirmed or unconfirmed: These snippets will be some extra posts related to specific topics, without schedule or specific topics. So, naturally, suggestions are welcome!

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 12:19 am
Quick update: added "copiable" text to the tutorial, so people following it don't need to rewrite what's in the images

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 12:51 am
congragulations Hugo, you've single handedly solved about 25% of all questions asked on the Löve2D forum! How do you feel?

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 1:20 am
Zilarrezko wrote:congragulations Hugo, you've single handedly solved about 25% of all questions asked on the Löve2D forum! How do you feel?
Heheh, I actually feel quite happy that I could help. I remember a few months/years ago having too many problems understanding these concepts, but I had a lot of help from a nice user called Qcode (the guy who made Mari0 online mod) and a few other users from the Stabyourself forums. Now that I'm very used to LÖVE, I decided that I should try to help other people too, so knowing that I'm helping makes me really glad

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 1:40 am
HugoBDesigner wrote:
Zilarrezko wrote:congragulations Hugo, you've single handedly solved about 25% of all questions asked on the Löve2D forum! How do you feel?
Heheh, I actually feel quite happy that I could help. I remember a few months/years ago having too many problems understanding these concepts, but I had a lot of help from a nice user called Qcode (the guy who made Mari0 online mod) and a few other users from the Stabyourself forums. Now that I'm very used to LÖVE, I decided that I should try to help other people too, so knowing that I'm helping makes me really glad
You should, and I hope this gets recognition because as it seems. A lot of people will need this. Good luck man, and I'll stay tuned.

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 8:42 am
Hmm... I took a quick glance at the OP, and in my humble opinion, you should not start explaining the inners of a physics engine starting from collision detection and resolution. It is an advanced concept.

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 09, 2014 12:08 pm
Roland_Yonaba wrote:Hmm... I took a quick glance at the OP, and in my humble opinion, you should not start explaining the inners of a physics engine starting from collision detection and resolution. It is an advanced concept.
Actually, I made it in a way that it is pretty easy to understand. If you go to the blog post, you'll see that, not only I explained it in a simple way, but I also gave examples to illustrate some concepts. Also, I'm explaining simple physics, so there isn't anything complex like non-rectangular collision, rotation, mass, etc. The first tutorial teaches only collision detection

On another note: If there's any moderator reading this, in which forum would this thread fit better? I put it in Projects and Demos because it is a small tutorial project of mine, but maybe it'd make more sense in either Support and Development or General.

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Wed Oct 15, 2014 9:31 am
I am working on a game engine right now, and this gives me many inspiration, I will follow your tutorial and hope I wont end up just copy pasting xD

Thank you very much

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Wed Oct 15, 2014 6:58 pm
soulaymenc wrote:I am working on a game engine right now, and this gives me many inspiration, I will follow your tutorial and hope I wont end up just copy pasting xD

Thank you very much
You're welcome, I'm glad I could help

I guess I should also let you guys know that I'm already working on the part 2 of the tutorial, so you should expect it to be released pretty soon

### Re: [Tutorials] Making a simple 2D physics engine

Posted: Thu Oct 16, 2014 10:14 am
EDIT: Nevermind, got it fixed

Great code, works like a charm. Really want to make a game with this now