Pix Engine: Platformer Engine

Updates:

[1] Basic Controllers

  • Player 1 (blue rectangle)

    • Move Left with “left” arrow key
    • Move Right with “right” arrow key
    • Jumps with “up” arrow key
  • Player 2 (red rectangle)

    • Move Left with “a” arrow key
    • Move Right with “d” arrow key
    • Jumps with “w” arrow key

[2] Camera Switch between players

  • Player 1 (press “m” key)
  • Player 2 (press “n” key)

[3] Engine

  • Gravity is implemented
  • Physic bodies implemented (players)

** Known bug / Nice Bug:
Leave jump button pressed, and if you reach a platform ceil, the player will be attached to it until you release the jump button… it is kind of nice.

PixEngine1-22-2022_20-04-37.html (2.1 MB)

3 Likes

I found this before I read it and I made a video showing it https://drive.google.com/file/d/1Ds8aJTNsn3pmbnpoB37RtEmFdiURjBkX/view?usp=sharing

1 Like

Wow, Is that the way that moves in your computer? or Are you applying slow motion to it? :thinking: It lags a lot… and its not supposed to… mmm, I would need to add debug data, like FPS and other stuff… That was exported at 60FPS… That video is like 4 times slower… :expressionless:

I mean it either means that it was being pretty laggy when I did the video, or the video just cant get to 60 fps (I was using a bad online screen recorder because I don’t have a screen recorder on my computer).

I only really need the collision code because I have tried to make a rpg but but the collision is always bad and you can see the character moving inside the wall a little bit.

PixEngineForRPG_gamer_boi.wick (3.9 KB)

Alright… @gamer_boi, You might not understand the code, but here is some info about it…

This approach creates a huge table to store the green walls in memory. In this example, every table cell is 10px. See line 221 on the picture below… if the Whole screen/stage is 1920px,1080px, and if every table cell is 10px, then the table has 192 columns and 180 rows.

You can choose numbers less than 10, like 5 or 1, but the lower the number, the more PC memory requires… and also, more calculations are required if you choose a number like 1. I think 10 or 20 is better if your Map is 1920x1080 or more…

Now, why this number is important? If you choose 10, your minimum resolution to place your walls is 10px. This means that you shall place (x,y) your walls in multiple of tens… Also, the size of your wall shall be a multiple of that number… example:

Screen Shot 2022-01-23 at 9.03.24 PM

As you noticed, these 4 numbers are multiples of 10… This is the only caveat.
What are the benefits? The player will only check every frame the table to see if he can move… so it doesn’t matter if you have 50 platforms or walls, he will only check if the desired position has data or not…

How to use it?
just place these green walls (remember the info above) in the screen at the COLS layer, and it will automatically register them into the Map table.

1 Like

thanks, btw for my game Im going to make the player hitbox and block hitbox 100 by 100 so its easier for me.

so I tried to have it change the enviroment when you leave the house but it always keeps the same hitboxes, could I get some help @Jovanny? PixEngine1-23-2022_17-51-50.wick

I can’t provide support right now sorry. I’m working on the Engine.

PixEngine1-29-2022_8-22-35.html (2.2 MB)

Controls:

  • Move Left: “left” key
  • Move Right: “right” key
  • Jump: “up” key
  • Change Player: “c” key

Updates: (Not much, but still good ones…)

  • No more stick to the ceil (bug fixed)
  • Platform and wall friction added based on rectangle’s stroke width (stroke of zero means no friction, meaning the object never stops until a force is applied)
  • mass, force, velocities, and accels simulation concepts
  • Debug Data Statictics
2 Likes

This is a really neat engine! Will the source code be avaliable after the engine is complete?

1 Like

Yes it will.

PixEngine1-30-2022_13-47-17.html (2.2 MB)

Updates:

  • Climb Up Platforms (light brown ones)
  • Solid Top Platforms (yellow ones)
  • Solid Platforms (light green ones)

Controls:

  • Move Left: “left” key
  • Move Right: “right” key
  • Jump: “b” key
  • Change Player: “c” key
1 Like

Updates:
Inverted Gravity Zones (kind of a nice achievement) :star_struck:

Please test it, and let me know what do you think…
PixEngine1-31-2022_21-52-50.html (2.3 MB)

Controls: :video_game:

  • Move Left: “left” key
  • Move Right: “right” key
  • Jump: “b” key
  • Change Player: “c” key
2 Likes

this is super interesting, but there are a few things i want to say about it.

  1. there’s no friction in the air. i know that’s more realistic but i don’t really like how slippery it feels, and it also makes it harder to land accurately.
  2. if you run up to a wall (with friction) and jump while holding the direction that pushes you into the wall, you kinda stick to the wall. here’s an example where i hold right when I’m at the wall and jump. (it’s only 3 seconds long) https://drive.google.com/file/d/1WkQLBwRfaUfq3oel2A4Ag1HODMWaIHVW/view?usp=sharing
1 Like

I can’t see the vid right now, but both points are good points and they will be customizable…

  • Air friction can be activated through engine settings.
  • Wall Friction is applied based on rectangles stroke thickness, This will be good for some game behaviors such as wall jumps and other stuff.
1 Like

yeah it would be more acurate if the air had maybie a fraction of the ground friction (air friction)

Air friction is totally independent from ground friction. Air friction usually is not added in videogames. In this case the players are unstable due to the velocity limits and other factors.

I’ll include settings for the players so they can deactivate air acceleration. That is another factor.

I like how physics are implied in regulating this platformer engine.

I checked out the html version and I must admit, the inverted gravity zone is truly fascinating!
(It reminded me of geometry dash for some reason)

I also thought the player accelerated quickly to the maximum velocity when moving, but I guess that is adjustable from the “engine settings.”

Despite not having much to say, I still felt obliged to congratulate you on your progress with Pix Engine :+1:

1 Like

@gamer_boi , @Hamzah_Alani, @BaronAWC, any other suggestion or feedback is more than welcome. I want to add a lot of things… The challenge right now for me is to add features, but at the same time maintain the end user developer experience simple and easy to use.