3d platformer

I made a 3d platformer demo, and it even has slopes!

This is posibly makecode’s first 3d platformer!

7 Likes

Also, big thanks to KWX for making the majority of the renderer.

1 Like

Very cool! Did you make it just using the extensions (render, scroller, and sprite utils) and blocks?

1 Like

Parkour games are going to be THE thing now.

1 Like

this is actually really cool,a bit complicated to play but really awesome.

you should make a mod of it with super mario 64 art or like sonic robo blast 2

1 Like

No, I used an engine (slightly modified) that KWX made.

1 Like

Sadly, textures are not supported, or even solid-colored polygons. Even if they were, it would be hard to make the 3d models. All I have here is a basic wireframe and 2d sprites with textures are supported, as well as a textured ground. Also, KWX coded the engine so I don’t know how to do it. Textured polygons seem pretty impossible, as this post says:

I made an update where camera controls are separate from regular controls (now aswd are to strafe in their respective directions, and j/l are to move the camera). This can always be reverted by pressing menu. Also, there’s a new map! I also added my delta time extension, which is more accurate than how @kwx implemented it in the original engine. I also changed which lines draw, which made the game start up slower but not draw multiple lines in the same location.

@kwx, is there a way to make worldtoscreen render outside the FOV? Because currently wireframe requires both points to be on screen to be visible and sometimes it’s hard to know what’s happening. If it’s too hard, I’m okay with just leaving it, but I was just wondering because it would make the game look better (although with worse performance).

It already supports the endpoints being offscreen to some extent. However, currently both endpoints need to be in front of the camera. When you’re standing on a platform, an edge connecting a corner in front of you to a corner behind you won’t get drawn correctly.

A not-very-efficient but simple workaround would be to check for this case and split a line into multiple shorter segments if needed. Here’s a modified version of place3dLine that does this:

The more correct solution would be to clip polygons against the view frustum. (The view frustum is essentially the pyramid formed by drawing lines from the camera through the corners of the screen). That’s more complicated - see for example clipPolygon in the triangle.ts file for Carrier 3D which implements the reentrant polygon clipping algorithm, see Wikipedia.

1 Like

Thanks SOOOO much!
I also fixed my deltatime extension (kiwiphoenix364/pxt-deltatime), so here’s a version that will work better on slower devices.

I couldn’t resist tweaking it a bit to modify the physics:

The up/down motion now simulates gravity accelerating you downwards. That way, the jump path is a parabola and not a triangle which I think feels better. You can modify hJumpSpeed to change the jump height, and hAccel to change the strength of gravity.

It also turns off ground friction while in the air so that you don’t drop straight down when letting go of the forward button. You can still control the forward/back motion a bit while in the air, I guess the player is wearing a steerable jetpack.

What do you think?

3 Likes

One more small change - it now sets the speed to zero when landing (this helps avoid sliding off platforms), and loses a life instead of an immediate “game over” when falling off a platform so that it’s quicker to retry.

1 Like

LOL, I was coding this as you were coding your small change - I implemented your velocity setting to 0 when landing (if you aren’t pressing a direction on the joystick, so it also encourages keeping your speed), and I made it teleport you back to the beginning (instead of restarting, as it takes a while to load, but I did make is so you do not lose hearts, because the hearts are the number of wires in the level. I also added a simple loading sprite so anybody playing knows that the project isn’t broken. Before I saw your small update post, I spent like 2 hours making the character have better velocity based off of your post with intertia. I made it, in my opinion, work well! I think it gives pretty good control, with velocity, and considering it’s working in a 3d space without a joystick. Also, it encourages keeping your speed and not stopping.

1 Like

That is awesome! Is there a way to play it with that link?

1 Like

Yes! It just takes a while to load because it has to fill an array with the lines it draws. Press A to jump, regular joystick to strafe, and the second player’s controller (j and l) to move the camera. If you’re on mobile, click menu to change to “tank controls” where left and right moves the camera and up and down goes forward/backward, and A is still jump. (Menu also turns on stats.)