#Java

A stupid 2.5d Engine in Java

8 years ago

9

I wondered how (3d) Game Engines work. So i tried to build a small one myself - kind of.

Why build a stupid Engine?

Well, to be real, it's not a serious Engine. Just for educational purpose, as most times. That's why I didn't dig too deep into the rabbit hole and kept the calculations on the CPU instead of using, e.g. OpenGL to utilize the GPU. And that's why it's stupid and 2.5D instead of 3D :D


2.5D?

If you're wondering what 2.5D means, the Engine is able to place 1D (Points) or 2D (Images, Lines, Text) Objects in three-dimensional space, and render these Objects using a Z-Buffer. The Z-Buffer sorts the Object by their distance to the ViewPort. A distant Object will then be rendered before a near Object, which may result in the distant Object being concealed by the near Object. But the Engine is unable to render 3D Objects. These would require 3D Collision Detection and I thought that might be a bit too much for the CPU to keep a reasonable FPS-rate.


But it works!

So I actually even used this Engine to reverse engineer the 1995 released Ascendancy Game. Can't show that for licensing reasons though (or at least i think so).

TestPanel1 was actually a test interpretation for the Solar-System-View of the game, with different test assets.



TestPanel2 is a simple spinning Galaxy with ~5000 stars.



As you can see, it runs with a reasonable 30-40fps. If you're interested, you can find the code on GitHub