Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to makje a 3D engine?
- Rogerscratcher
-
30 posts
How to makje a 3D engine?
Hello, i really want to make something like an 3D game in Scratch 2.0, but i don't know how… 
Maybe anyone can let me know how to do something like that?
(I know making something like that is hard
)

Maybe anyone can let me know how to do something like that?

(I know making something like that is hard

- AonymousGuy
-
1000+ posts
How to makje a 3D engine?
You're right, it is hard… It involves lots of trigonometry and stuff…
But a helpful studio to start out with is this one.
But a helpful studio to start out with is this one.
- giorgi01
-
27 posts
How to makje a 3D engine?
i want to create 3d game too like naruto shippuden ultimate ninja storm 3
if you teach it from somewhere can you tell me from where?

- legolady
-
21 posts
How to makje a 3D engine?
If you're serious about 3D and want to use Scratch, I would suggest you learn 2D Scratch first.
Learn how to use Scratch with the excellent tutorial at http://scratch.mit.edu/projects/18628502/?tip_bar=getStarted#editor
Then learn how to use sprites, and how to move them around.
Next, learn about the Pen blocks - how to draw lines and change colour, shade and size.
Everything you do in 3D has to be converted to 2D so it can be drawn on screen.
There are some good 3D demos on Scratch…
http://scratch.mit.edu/projects/3010186
http://scratch.mit.edu/projects/14128344
and look at the wiki..
http://wiki.scratch.mit.edu/wiki/How_to_Make_a_Three-Dimensional_Project
Good Luck !
Learn how to use Scratch with the excellent tutorial at http://scratch.mit.edu/projects/18628502/?tip_bar=getStarted#editor
Then learn how to use sprites, and how to move them around.
Next, learn about the Pen blocks - how to draw lines and change colour, shade and size.
Everything you do in 3D has to be converted to 2D so it can be drawn on screen.
There are some good 3D demos on Scratch…
http://scratch.mit.edu/projects/3010186
http://scratch.mit.edu/projects/14128344
and look at the wiki..
http://wiki.scratch.mit.edu/wiki/How_to_Make_a_Three-Dimensional_Project
Good Luck !
- TheLogFather
-
1000+ posts
How to makje a 3D engine?
OK, it's probably about time I wrote down some of my thoughts about 3D on Scratch in a more complete way!
So here it is… my guide to 3D on Scratch (Warning: it's fairly long, but you can skip to the end of each section to see the basic conclusions…)
Introduction
How you go about 3D on Scratch really depends what sort of 3D you're thinking of. I'd say there are, roughly, three types of 3D you can do in Scratch (though you can combine some of them in various ways).
But be warned: I'd really recommend you ensure you are confident creating ‘normal’ games/projects in Scratch before you head into 3D! With that warning, here goes…
1) Top-down costume slices:
This works by taking slices through a 3D object (i.e. you think what each slice looks like), and creating a costume for each (different) slice. Then you ‘stack’ them - placing each slice on top of the previous, with a slight offset. This gives the illusion of a 3D object, and by changing the offset you can even make it look like they are tilted by different amounts. Rotating the costumes will rotate the 3D object in the appropriate way, making it quite an easy method to pull off something that looks quite reasonably 3D.
The game-play is obviously fairly limited to top-down using this approach, though changing the offset of the stacked costumes does give the impression of looking from different angles or heights, so it's possible to make it look more sophisticated with some work.
A project that gives an overview of the idea: http://scratch.mit.edu/projects/1236750/
A studio with numerous examples of this approach (as well as others): http://scratch.mit.edu/studios/22121/
Amount of maths required: fairly minimal (e.g. can get away without trig, since the way the game works would be basically the same as a top-down 2D game, but you just stack costumes to give it some 3D appearance).
2) Costume size with distance:
The most basic way to do this is simply to have the various objects in your game as costumes, and then change the size of the costume with the distance to that object (i.e. the further away it is, the smaller it gets). This limits the game-play to pretty much a two-dimensional surface, because you can only see one view of the objects (unless you create more costumes for some height variation views).
If you put some effort into creating many costumes, one for each viewing angle of each of your objects, then this can give some very impressive results. (And I think combining this with a raycaster for vertical walls is probably the most effective way to create a great-looking 3D game in Scratch.)
A great classic example is Coin Runners 3D: http://scratch.mit.edu/projects/1530618/
An example combining costumes with raycaster: http://scratch.mit.edu/projects/14777574/
Amount of maths required: Some 3D to 2D projection to work out where objects will appear on-screen, and what size to make them. If you want to use multiple costumes, for different viewpoints (like Coin Runners above), then some trig required to get rotation angles to find which costumes to use for the correct view.
3) Pen-rendered ‘full 3D’ objects:
This is the most complicated 3D to do in Scratch. There are a number of things that make it difficult, such as the maths involved, but also some of the limitations of Scratch itself (pen limits, speed, lack of certain types of built-in list operations, etc.)
I call this “full 3D” because it's the only feasible way to create 3D objects in Scratch that can be seen from any viewing direction (i.e. different tilt angles above and below, and all angles around).
If you're going to try this, start with just wireframe objects. You need to think carefully about how you're going to store the information about the objects (e.g. using lists, etc.), and how you manipulate that information (due to the speed of Scratch's script interpretation).
If you're feeling really confident, once you've got wireframe going, you can start to think about filling in surfaces, even with some shading for lighting. There are really not that many Scratchers who have managed wireframe 3D in Scratch - and even fewer who get as far as trying filled surfaces!
A wireframe tutorial: http://scratch.mit.edu/projects/2855520/
An example wireframe game: http://scratch.mit.edu/projects/10015457
An example filled-surface game: http://scratch.mit.edu/projects/10085324
A studio containing examples of ‘full 3D’ projects (and raycasters): http://scratch.mit.edu/studios/201680/
Amount of maths required: Lots! Most helpful is understanding vectors in 3D. Also some trig to deal with angles and rotation.
If you really want to attempt this, I'd suggest you work carefully through the studio in my sig below.
Texturing? Raytracing?
I haven't said anything above about textures (that means drawing some kind of patterning onto surfaces of 3D objects). There's a reason for that… it's simply too much for Scratch at the moment. This is really why the best-looking 3D comes from using multiple-view costumes - because then you get the good-looking detail from a pre-existing costume, rather than trying to draw it all with the pen.
Just to give an idea of how impossible it is to pen-render textured objects that can rotate in a general way in full 3D, and do it quickly enough to use in a game, here are a few examples:
3D textured Minecraft block: http://scratch.mit.edu/projects/10536676
3D textured Link (from TLOZ): http://scratch.mit.edu/projects/10541079
3D textured Minecraft chunk: http://scratch.mit.edu/projects/14128344
3D textured globes: http://scratch.mit.edu/projects/17679303
I also haven't said anything about raytracing (that's different to raycasting). Again this isn't something you can use for a game - though it can produce some nice-looking rendered scenes. Here's a classic example…
Raytraced scene of patterned balls: http://scratch.mit.edu/projects/56074/
The End!
Whew! Well, I hope there's something helpful in there somewhere…
So here it is… my guide to 3D on Scratch (Warning: it's fairly long, but you can skip to the end of each section to see the basic conclusions…)
Introduction
How you go about 3D on Scratch really depends what sort of 3D you're thinking of. I'd say there are, roughly, three types of 3D you can do in Scratch (though you can combine some of them in various ways).
But be warned: I'd really recommend you ensure you are confident creating ‘normal’ games/projects in Scratch before you head into 3D! With that warning, here goes…
1) Top-down costume slices:
This works by taking slices through a 3D object (i.e. you think what each slice looks like), and creating a costume for each (different) slice. Then you ‘stack’ them - placing each slice on top of the previous, with a slight offset. This gives the illusion of a 3D object, and by changing the offset you can even make it look like they are tilted by different amounts. Rotating the costumes will rotate the 3D object in the appropriate way, making it quite an easy method to pull off something that looks quite reasonably 3D.
The game-play is obviously fairly limited to top-down using this approach, though changing the offset of the stacked costumes does give the impression of looking from different angles or heights, so it's possible to make it look more sophisticated with some work.
A project that gives an overview of the idea: http://scratch.mit.edu/projects/1236750/
A studio with numerous examples of this approach (as well as others): http://scratch.mit.edu/studios/22121/
Amount of maths required: fairly minimal (e.g. can get away without trig, since the way the game works would be basically the same as a top-down 2D game, but you just stack costumes to give it some 3D appearance).
2) Costume size with distance:
The most basic way to do this is simply to have the various objects in your game as costumes, and then change the size of the costume with the distance to that object (i.e. the further away it is, the smaller it gets). This limits the game-play to pretty much a two-dimensional surface, because you can only see one view of the objects (unless you create more costumes for some height variation views).
If you put some effort into creating many costumes, one for each viewing angle of each of your objects, then this can give some very impressive results. (And I think combining this with a raycaster for vertical walls is probably the most effective way to create a great-looking 3D game in Scratch.)
A great classic example is Coin Runners 3D: http://scratch.mit.edu/projects/1530618/
An example combining costumes with raycaster: http://scratch.mit.edu/projects/14777574/
Amount of maths required: Some 3D to 2D projection to work out where objects will appear on-screen, and what size to make them. If you want to use multiple costumes, for different viewpoints (like Coin Runners above), then some trig required to get rotation angles to find which costumes to use for the correct view.
3) Pen-rendered ‘full 3D’ objects:
This is the most complicated 3D to do in Scratch. There are a number of things that make it difficult, such as the maths involved, but also some of the limitations of Scratch itself (pen limits, speed, lack of certain types of built-in list operations, etc.)
I call this “full 3D” because it's the only feasible way to create 3D objects in Scratch that can be seen from any viewing direction (i.e. different tilt angles above and below, and all angles around).
If you're going to try this, start with just wireframe objects. You need to think carefully about how you're going to store the information about the objects (e.g. using lists, etc.), and how you manipulate that information (due to the speed of Scratch's script interpretation).
If you're feeling really confident, once you've got wireframe going, you can start to think about filling in surfaces, even with some shading for lighting. There are really not that many Scratchers who have managed wireframe 3D in Scratch - and even fewer who get as far as trying filled surfaces!
A wireframe tutorial: http://scratch.mit.edu/projects/2855520/
An example wireframe game: http://scratch.mit.edu/projects/10015457
An example filled-surface game: http://scratch.mit.edu/projects/10085324
A studio containing examples of ‘full 3D’ projects (and raycasters): http://scratch.mit.edu/studios/201680/
Amount of maths required: Lots! Most helpful is understanding vectors in 3D. Also some trig to deal with angles and rotation.
If you really want to attempt this, I'd suggest you work carefully through the studio in my sig below.
Texturing? Raytracing?
I haven't said anything above about textures (that means drawing some kind of patterning onto surfaces of 3D objects). There's a reason for that… it's simply too much for Scratch at the moment. This is really why the best-looking 3D comes from using multiple-view costumes - because then you get the good-looking detail from a pre-existing costume, rather than trying to draw it all with the pen.
Just to give an idea of how impossible it is to pen-render textured objects that can rotate in a general way in full 3D, and do it quickly enough to use in a game, here are a few examples:
3D textured Minecraft block: http://scratch.mit.edu/projects/10536676
3D textured Link (from TLOZ): http://scratch.mit.edu/projects/10541079
3D textured Minecraft chunk: http://scratch.mit.edu/projects/14128344
3D textured globes: http://scratch.mit.edu/projects/17679303
I also haven't said anything about raytracing (that's different to raycasting). Again this isn't something you can use for a game - though it can produce some nice-looking rendered scenes. Here's a classic example…
Raytraced scene of patterned balls: http://scratch.mit.edu/projects/56074/
The End!
Whew! Well, I hope there's something helpful in there somewhere…
Last edited by TheLogFather (March 1, 2014 15:40:12)
- Rogerscratcher
-
30 posts
How to makje a 3D engine?
Hey TheLogFather, i tried the ‘'Top-down costume slices’' option because it looks like the easiest way to make an 3D object, and it worked 
But how do i use that option to make an 3D environment? (like real life)
It would help a lot if you tell me how

But how do i use that option to make an 3D environment? (like real life)
It would help a lot if you tell me how
- TheLogFather
-
1000+ posts
How to makje a 3D engine?
First of all, you need to work out what you want in your environment, and what you want them to do - and that's basically the same as you have to do for a 2D environment. Then you have to design these objects - i.e. create sprites for them, again, just as you would for a 2D game. And then you have to make them do what you want (move around, rotate, appear/spawn, disappear/die, whatever…) by writing the scripts to make it happen - yet again, just as for 2D. Hey TheLogFather, i tried the ‘'Top-down costume slices’' option because it looks like the easiest way to make an 3D object, and it worked
But how do i use that option to make an 3D environment? (like real life)
This means that for something built around the costume-slice idea, I think you could probably start with making most of it work in 2D (designing 2D versions of the objects to start with, and making them move how you want). Then give your objects ‘height’ by adding the slices - and, ta da! you suddenly have something that looks more 3D.
One thing to note: try not to have too much rotating at once. If you have lots of costumes rotating at the same time, it can get too slow because rotating a costume is quite an intensive calculation - and if you have objects built from lots of slices, each being a costume, then that's lots of things to rotate. Also, applying effects and/or changing costume size for too many things all together will slow you down, so avoid having too many things doing those at the same time.
Hope that's hellpful!
- Rogerscratcher
-
30 posts
How to makje a 3D engine?
Thanks! 
But another question; is it possible to make an 3d environment with top-down costume slices, but in another perspective like we see things in real life? (like Minecraft, or an FPS)

But another question; is it possible to make an 3d environment with top-down costume slices, but in another perspective like we see things in real life? (like Minecraft, or an FPS)

- TheLogFather
-
1000+ posts
How to makje a 3D engine?
top-down costume slices, but in another perspective like we see things in real life? (like Minecraft, or an FPS)I guess it'd be possible to do a simplified version of it. You could even combine it with costume-sizing for objects at different distances. But the processing required for all those costume slices (in particular, if you're rotating them and resizing them) would likely limit how many objects you could manage before hitting lag. …is it possible to make an 3d environment with
But the main issue is that a top-down type approach is effectively limited to viewing from only above/below (though you can give the appearance of variation in height when you change the offset between slices, so it appears to ‘tilt’ the object). Changing this to a Minecraft/FPS-type view would mean you can only view objects from one side (so front/back, say, rather than above/below), and changing the slice offset would change the apparent sideways viewing angle to some degree.
This isn't really what you'd normally want for FPS/Minecraft, though - you would prefer ‘all-around-the-plane’ viewing - all 360 degrees around the sides, while at a particular level on a surface. That's why it's more suitable to try something like the second approach (having multiple costumes, each showing a different viewing angle, as done in Coin Runners).
Hope that makes sense…?
- Rogerscratcher
-
30 posts
How to makje a 3D engine?
Yes it does. Thanks for your help, i will try to make some 3d games!
- albert-einstein
-
52 posts
How to makje a 3D engine?
Raycasting is the simple way check out my minotaurs maze game
I'm working on (and i m pretty sure its possible) a multilevel raycaster with rays being emmited from a light source and the bouncing around but with less power.
If you don't understand that try stamping technique its a simple effective 3d generator and runs pretty fast even on bad browsers
I'm working on (and i m pretty sure its possible) a multilevel raycaster with rays being emmited from a light source and the bouncing around but with less power.
If you don't understand that try stamping technique its a simple effective 3d generator and runs pretty fast even on bad browsers
- jjbrady18
-
81 posts
How to makje a 3D engine?
Ray-casting is probably the best way to go it can involve very minimal maths
There is a good sprite based ray-caster tutorial here: http://wiki.scratch.mit.edu/wiki/Raycaster_Tutorial
Array based raycasting is slightly trickier but it is faster and you can do much more with it.
An example I made here: http://scratch.mit.edu/projects/20000032/
There is a good sprite based ray-caster tutorial here: http://wiki.scratch.mit.edu/wiki/Raycaster_Tutorial
Array based raycasting is slightly trickier but it is faster and you can do much more with it.
An example I made here: http://scratch.mit.edu/projects/20000032/
- KristofferDN
-
1 post
How to makje a 3D engine?
Test my beta i know it is bad game but it is just only a Beta Demo
but to the job:
i maked sprites from a thing i learned on school, how u can make 3D pictures
checkout my one so can it give you a idea
but to the job:
i maked sprites from a thing i learned on school, how u can make 3D pictures
checkout my one so can it give you a idea
- EX867
-
13 posts
How to makje a 3D engine?
Aaaaaaaawesome!! I will study 3d render with your perfect 3d rendering code. It looks hard but I will never give up!!! Thanks to LogFather!!
- liam48D
-
1000+ posts
How to makje a 3D engine?
In my opinion, this topic should be cleaned up, then sticky'd and possibly closed, there's some real good information here.
- SpinningCube
-
100+ posts
How to makje a 3D engine?
I want to know how to measure x, y, and z in a first person 3D game with x rotation :D :D :D
- Discussion Forums
- » Help with Scripts
-
» How to makje a 3D engine?