1
$\begingroup$

I wanted to make a little demo for a console with Realm of the Mad God esc graphics to brush up my C and SDL skills.

View of the walls I'm trying to recreate

One problem I'm running in to is creating the 3D walls. The console I'm working with does not actually allow for 3D hardware acceleration at this moment of time and thus I can't really use real 3D. I noticed the perspective looked off in RotMG as well so I figured they must be using fake 3D also.

Now I have tried layering 2d textures on top of eachother as detailed here although this didn't quite work out so I modified the algorithm a bit and the blocks looked a lot better. Problem is they wouldn't sit next to eachother convincingly so I figured this is not the right tool for the job.

What type of algorithm should I use to recreate the 3D walls without actually using GL or other real 3D technologies?

$\endgroup$
2
$\begingroup$

What they're using in this game is called an orthographic projection. It is a special type of a projection, which does not bend objects, it does not mean that they are not using 3D.

Now, of course you can achieve this kind of effect using 2D coordinates only if you want. But it requires some mathematical understanding of the situation, as you need to do 3D calculations in order to calculate the correct 2D coordinates to use. If you do it this way, you can draw points or lines between the points after calculating the positions, and it will give the effect you want.

But here in RotMG, they are also doing texture mapping on those walls, which uses information about the actual size of the surface in 3D space. This information is lost if you simply calculate the 2D positions of the corners without also doing the texture mapping yourself.

So here you have two options:

  • You can give up your console and start doing some real 3D stuff (OpenGL, etc...).
  • You can become very good at linear algebra, preferably including homogenous coordinates, project the points from 3D to 2D space, draw your lines/points in your console, or interpolate the 3D positions with some form of rasterization, if you want to decorate the wall using texture mapping. But once you understand all of that, I'm afraid you won't want to use your limited console anymore.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.