# Physical engine adapted to the needs of a 2d platform game like Super Mario

**URL:** <https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680>\
**Category:** Sprite Kit\
**Created:** [January 18, 2018, 1:25pm UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680 "2018-01-18T13:25:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![basgrani](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/basgrani/32/73535_2.png) [@basgrani](https://forums.kodeco.com/u/basgrani)\
**Post date:** [January 18, 2018, 1:25pm UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/1 "2018-01-18T13:25:38Z")

</div>

Hi All,

Well, I plan to develop a platform game, like “Super Mario”, but I run into a big problem, the physics engine of “SpriteKit” (Box2D) is the worst to use in a game of these characteristics, thousands of forums / blogs support this idea (I’ve tried it myself, uffffff), for example:

[http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/](http://www.learn-cocos2d.com/2013/08/physics-engine-platformer-terrible-idea/)

- Do they know if there is an “arcade” style physical engine adapted to the needs of a 2d platform game like “Super Mario” and if possible, based on “SpriteKit + Swift4”?  
similar to this:

> **[phaser/src/physics/arcade at master · photonstorm/phaser](https://github.com/photonstorm/phaser/tree/master/src/physics/arcade)**
>
> master/src/physics/arcade

I look forward to your response … Thank you very much.

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [January 28, 2018, 7:12pm UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/2 "2018-01-28T19:12:50Z")

</div>

Hi @basgrani! After doing some research on an arcade engine that you are looking for I unfortunately did not find anything that would be based around SpriteKit and Swift 4. I hope you are still able to create your platform game. Happy coding!

Gina

---

<div class="post-metadata">

**Author:** ![basgrani](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/basgrani/32/73535_2.png) [@basgrani](https://forums.kodeco.com/u/basgrani)\
**Post date:** [January 28, 2018, 10:47pm UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/3 "2018-01-28T22:47:59Z")

</div>

Hi, I’m afraid it’s going to be a very difficult task … but thank you anyway for your time in the search.

If someone from this forum is able to develop an arcade engine for SpriteKit I would be happy to know your cost / budget, I would not mind hiring that job, Thanks. (You can send me the budget to [jorge@basgrani.com](mailto:jorge@basgrani.com))

By the way I found this Engine:

> **[Corgi Engine - the best 2D+2.5D platformer solution for Unity, by More Mountains](https://corgi-engine.moremountains.com/)**
>
> The Corgi Engine is the best Unity 2D+2.5D Platformer kit. Get it and create your own 2D game!

It’s for Unity, and it’s very good!! it’s just what SpriteKit needs for this type of Games.

---

<div class="post-metadata">

**Author:** ![steveb](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/steveb/32/94142_2.png) [@steveb](https://forums.kodeco.com/u/steveb)\
**Post date:** [January 29, 2018, 5:12pm UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/4 "2018-01-29T17:12:06Z")

</div>

Have you tried writing your own physics? Depending on what you need it can be easier than you think!

Simulating gravity and jumping is very easy (I’m sure there’s plenty of tutorials on it), and collision detection can be easier than you think, especially if you stick to rectangles and circles.

It works something like this:

- Your character should have a velocity, you use this each frame to update their position. Just thinking vertically, a negative velocity added to their position will move them downwards, a positive one will move them upwards. Essentially all you need to do is add the velocity to the character’s position each frame (multiplied by delta time)
- Gravity will subtract from the vertical velocity on each frame, which will pull the character downwards
- When the user presses jump, you add a large value to the vertical velocity.This propels the character upwards, until the gravity that you add each frame builds up at the top of the arc and then brings the character back down
- Keep and array of objects for your floor tiles, and use CGRect.intersects to check if the player has intersected a floor tile. If they have, adjust their position to be on top of the tile.

I’d give it a go, you might find that it’s not as difficult as you imagine!

---

<div class="post-metadata">

**Author:** ![basgrani](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/basgrani/32/73535_2.png) [@basgrani](https://forums.kodeco.com/u/basgrani)\
**Post date:** [January 30, 2018, 8:56am UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/5 "2018-01-30T08:56:26Z")

</div>

Yes, it is what I am doing now, but the truth is that I do not have much free time to dedicate. My idea is to make a “2D Engine for SpriteKit” similar to this:

https://www.youtube.com/embed/pyoGMUvmFMY?feature=oembed&wmode=opaque&list=PLl3caEhMYxQEsA5Fbg0M2aB9Q9Z9BTVNS

Woohoo, it occurs to me that we could create a “2D Engine for SpriteKit” Open Source! What do you think about the idea? I have experience in creating Open Source projects, here are some of my projects:

> **[Overview | BasMaterial UI](http://bas-material-ui.basgrani.com/)**
>
> Overview | BasMaterial UI, is a natural user interface based in Google's Material Design.

> **[npm](https://www.npmjs.com/~basgrani)**

I leave open my proposal to make the “2D Engine for SpriteKit” Open source, here in this forum, everyone who wants to join will be welcome, if we manage to coordinate a small stable team we will go forward with the idea!!

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [July 4, 2018, 5:35am UTC](https://forums.kodeco.com/t/physical-engine-adapted-to-the-needs-of-a-2d-platform-game-like-super-mario/38680/6 "2018-07-04T05:35:38Z")

</div>

This topic was automatically closed after 166 days. New replies are no longer allowed.
