Report as inappropriate.
This is a demo of a sort of "2D Raytracing" engine. The world you see is NOT ACTUALLY 3D but a 2d world where the height of a wall is determined by how far you are away from it. Unlike traditional rendering engines ("rasterizers") who use triangles to represent objects and basically just draw these trianges back to front onto an image, my engine uses a technique called "Raytracing".
Raytracing works by calculating the path of a light ray for each pixel of the screen. You check what object the ray collides with and the color of that object determines the color of that pixel. The advantage of raytracing over rasterizing is that reflections can be calculated very easily by just calculating another ray from the point where the first ray hit the object, in the direction it would reflect. This is also present in my implementation, BUT ONLY OFFLINE, because online you cannot draw with transparency (for whatever reason).
My implementation works a bit different to normal raytracing implementations; instead of calculating a ray for each pixel I only calculate a ray for each column of pixels. The further away the hit point of the ray is, the smaller is the wall in that column.
Of course, this means that you cannot move vertically or "look above" a wall, but many very old games actually had this restriction as well (for different reasons). On the other hand, raytracing is, compared to rasterizing, very performance heavy, so it's probably a good idea to reduce the number of rays per second from 600p x 400p x 60fps = 14400000 to 600p x 60fps = 36000. After all, raycasts are normally calculated on the GPU which is very good at doing many simple things at once, rather than the CPU, which can only do very few things concurrently. Since Java runs on the CPU and you won't change that so easily that kills performance for these kind of things. My engine makes use of all of your CPU cores (off you are in the Greenfoot application, online that stuff is not possible) but even powerful CPUs like mine can only do 12-16 things at once whereas even low-end GPUs can do more than a 1000 things at once.
FOR THE TIME BEING YOU WILL HAVE TO DOWNLOAD THE SCENARIO ANYWAYS AS THE JSVASCRIPT CONVERTER I COMPLAINING AGAIN. At some point I may fix this but not now:)
There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)
This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.
Want to leave a comment? You must first log in.