Fake 3d help

can anyone make an engine sort of similar to super mario 3d land and just to be completely sure on what im asking could you search sonic x treme and look at images because thats what i want. it doesnt have to be complete raycasting it ould just be a fake looking 3d thing used with the tilemaps . but id just want something that i could use to make a cool 3d game i wanted to work on wich wasnt a point of view type of 3d with shooting
if you could help with this id be extremely gratefull

3 Likes

There’s a lot to do if you’re trying to implement an engine like this into Arcade. Fortunately, there have been many ambitious and talented projects by users using 3D engines. But a lot would have to be implemented or innovated in the Makecode Arcade “space” to create what you’re trying to use. Here are some essential things to consider.

Terrain rendering:

Tilemaps most likely couldn’t replicate what you’re looking for, at least not currently. You could maybe make an engine, which would require a few tilemaps, and use them as height data.

Performance:

But no matter how someone would be willing to implement something like this into Makecode Arcade, it all comes down to performance. And that goes for hardware or the web simulator.

I guess the simple answer is it’s possible. But performance will always hold back anything this complicated. To put it into perspective, even simple raycasting with some sprites on screen can show poor performance on both hardware and the simulator.

Although I may not be the guy with enough experience, let alone the talent to bring this to life. It’s always good to experiment and play with certain features and extensions. Anywho, I would love to see something like this become a reality in the future.

2 Likes

im pretty sure sonic xtreme used actual 3d models because as far as I can tell it’s basically ocarina of time but sonic.

but if you want raycasting help i’d say ask @AqeeAqee. he helped me with my Halo-Doom project and created the Raycasting extension.

3 Likes

There has been a 2d plane rendered (similar to Super Mario Kart for the SNES, with spites and even lines in a 3d space being possible with the renderer, but textured 3d, and even single-color 3d, is really hard to achieve in MakeCode (in its current state). I did make this project a looong time ago, but everything was hard-coded to give the illusion of 3d (and took literal DAYS to code, and I did it anyway because I had like infinite time that I didn’t know what to do with lol). Sorry if this info is sad for you to read, as I was sad about MakeCode not being 3d too, but MAYBE one day, through many hours of ridiculously complicated math, SOMEBODY on the forum can achieve 3d (probably not me, because I’m not great at coding ridiculously efficient projects that require crazy amounts of math).

2 Likes

For drawing terrain like that, check out https://github.com/s-macke/VoxelSpace and the web demo at https://s-macke.github.io/VoxelSpace/VoxelSpace.html . This approach is comparatively resource-friendly and much simpler and more efficient than a full 3D engine, and I think it may be feasible to get this running on Makecode Arcade also. It’s basically a variant of raycasting based on a height map and color map.

3 Likes

I ended up implementing a variation of that algorithm for my game jam entry, Fire Rescue Chopper: [Announcement] MakeCode Arcade Mini Game Jam #2 - Submission thread! - #7 by kwx

My version adds a black outline at ridges for a slightly cel-shaded look, and I think the old 8-bit LucasArts game “Rescue on Fractalus” did something similar when drawing mountain outlines. It’s currently not particularly optimized, so it works ok-ish on a sufficiently fast system in the simulator, but would need converting to fixed-point math for running on hardware. I don’t have my PyGamer with me to test, but I expect frame rates well below 1fps on that…

5 Likes

This game looks great and has a lot of extension potential! If it had

  1. Manual drawing of environments (this may be difficult, because of space, and I’d assume images are a WHOLE lot easier to use for fast renderers than tilemaps).
  2. Drawing of sprites in a “3d” space (like MakeCode Kart).
  3. (Optional, maybe not needed depending on the intent of the extension) OK hardware perf.

If an extension with the engine and the three points I mentioned above would be the ULTIMATE MakeCode renderer, with (probably) many DOOM/Wolfenstein 3d clones, flight simulators (like you made), mazes, racing games, Piolotwings-type games, and many more unique ideas.

This would be cool (as the community could make many games out of it, and its like a more flexible version of raycasting but without textures), but please don’t feel obligated or like you have to make what I said just because me, a person on a forum, posted some ideas.

1 Like

Thanks! By “manual drawing of environments”, I assume you mean predefined height/color maps as opposed to randomly generated? That’s of course possible, though a direct map runs into memory limits. It currently uses 128x128 maps for height and color using 1 byte per entry each, for a total of 32kB. Doubling resolution to 256x256 would multiply this by four.

Adding a level of indirection with tilemaps would make much larger maps feasible, but I’m a bit worried about the performance impact since it adds extra lookups in the inner loop. Probably doable though.

Adding sprites should also be doable, apart from needing some careful math to get them consistent. The current code uses a bunch of arbitrary constants which don’t directly correspond to a specific perspective transform, but that’s fixable.

My very rough guess for achievable hardware performance (after fixed point conversion and optimizations) would be about 10fps for PyGamer, less for tilemaps, but that may be off by a lot.

No promises on my part for working further on this, the game was basically a quick hack for the game jam.

2 Likes

Okay, now that is awesome. I’m currently using a 2019 iMac, and it runs great on the simulator. I suppose hardware might be different, but I thought that generating terrain in such a manner would be SUPER unoptimized on both hardware and the simulator (like to a unplayable extent). But I can see this being implemented on many other projects (maybe with just a tad of tweaking.)

Anyways, cool stuff. I’ll see what I can contribute.

2 Likes

Could it be possible to convert a tilemaps to an image when it is loaded? (Although that might take a lot of space in RAM for big tilemaps) This might be a method used for future “3d” renderers, as it would still use an image, but it would be a tilemap converted to an image in software when that tilemap is loaded.

Possible yes, but like you said it’s going to take a lot of RAM. If I remember right, Arcade hardware has a 96kiB limit (at least on some devices), so the 32kiB used by a 128x128 map is already near the upper limit if you need room for other resources also. I don’t know if there’s a hard limit for the simulator apart from system memory. Considering that modern PCs have gigabytes of memory (tens of thousands of times as much as Arcade hardware), that allows far bigger sizes.

I just tried setting terrainSize to 2048 and viewingDistance to 128 in the source, and it seems to work OK in the simulator apart from taking a long time to calculate the fractal terrain.

1 Like