OpenGL Cataclysm Proposal

Ever since seeing the Voxel Cataclysm demo that was done a while back, the idea of a 3d display mode for the game has lurked in the back of my mind.

Recently, I saw some discussion about how a 3d version of CDDA would be prohibitively difficult. This, given certain assumptions like the need for labor intensive 3d assets, is a fairly reasonable claim.

As a side project both for fun and a way to improve my programming skills, I have over the years been making various iterations of custom OpenGL graphics engines. Some of these have basic game engine components on top, but my focus was primarily on the rendering side. I discovered pretty quickly while trying to develop basic competency in Blender/3dsMax that I HATE 3d modeling. Though some free pre-made models are available online, I found it was much easier to work with and create custom assets in 2d. Then, for 2d assets in a 3d world, I would employ a simple technique called ā€˜billboardingā€™ ( flat textured rectangular surfaces that always orient towards the camera so you canā€™t perceive their flatness ).

I started asking myself, is this really that hard? We now have some very good 2d assets for this game so perhaps one of the major perceived hurdles is already cleared. Hereā€™s a quick rundown of some of the details Iā€™ve brainstormed on making something like this work.

  1. Context creation
    In short, this is actually easier than I originally thought. Iā€™m not super familiar with SDL, but discovered that opening an OpenGL context from within SDL is supported:
    Using OpenGL With SDL

    This means that the input, event handling and sound could remain largely the same.

  2. Rendering sub-system hook
    Shaders are king in 3d graphics and need to be passed a fair bit of data in order to make the magic happen. A large element of this whole setup would be exposing all of the variables required by the shaders via an interface layer. The primary object in the rendering system would be a single orbital camera, centered on the player position with basic mouse rotation and zoom functionality. So, on the input side of things at the very least the mouse input would need to be made available.

    As far as world data, the main thing required would be the current state of viewable tiles that would otherwise be displayed in normal SDL mode at maximum zoom out level. There may be additional details that would be needed in order to get objects like walls, vehicles and some terrain to render in a pleasing way.

  3. Rendering details/Asset management
    All the tiles would need to be handled in a manner quite similar to the current SDL asset management. OpenGL texture objects would be created and associated with the appropriate game objects. A pre-processing stage would also be required for nice looking smooth zoom levels on all the textures through mip-map generation.
    ( As a side note, everything up to this point could be used to simply make a nicer looking 2d map display taking advantage of opengl anisotropic filtering and mip-maps to have smoother textures and a continuous zoom level )
    For actually creating a passable 3d illusion, most objects would only need a basic spherical billboard transform. Terrain tiles would be mapped to a plane and just given perspective projection transformation. This would mean looking essentially the same as a 2d map from directly above with no z-axis rotation. As tilt is applied the terrain would shift in 3d perspective. A depth test based on the position of the camera would determine the rendering order so things overlap appropriately.

ā€¦and that is what Iā€™ve got so far.

Most of this is stuff Iā€™ve worked out in my own code before. The hardest part of this from my perspective is getting a good interface up without being too invasive and not breaking any existing code. Iā€™d love to hear any thoughts people have on that aspect particularly. Iā€™ve looked at the SDL parts of the code a bit, but Iā€™m probably missing a few aspects.

ANYWAY, long post I know, but this is something Iā€™m interested in trying out seriously when I have the time. Figured that Iā€™d toss this out there in the meantime.

1 Like

I donā€™t know enough about how CDDA handles visions or graphics to contribute anything intelligent here, but I would like to encourage you to keep working on this. Iā€™d love to play CDDA using the voxel style.

1 Like

Donā€™t really understand most of that, but as far as an interface, drop-down descriptions of health parameters seems like a nice thought. But I donā€™t know what aspects of the interface youā€™re talking about.

I can do voxel graphics, at the very least provide placeholders if you get anywhere with it, I typically do a quick version on magickavoxel and touch them up in blender to remove anything unnecessary. Also realm of the mad God is a pretty good example for 3d with 2d sprites, and Dont starve is another.

1 Like

Rendering is almost separated from the game, so you can try to create new rendering engine.

Yeah, that is basically the idea.

I really hope you can get this working, I would definitely attack my blender courses again to contribute something of this size, Iā€™m sure alot of fellow students would love the practice as well.

Any update? Did you figure out how tough it would be?

Iā€™ve got a lull in work coming up at the end of the month, Iā€™ve been waiting til then to start really putting any serious time into this. Iā€™ve got my plan set out at least, so thereā€™s that.

The biggest time sink is probably just going to be the inevitable game of hide and seek with the repository to find all the critical bits. Iā€™ve got enough fully working bits on the OpenGL engine side that I can gut for initial experimentation. If you wanna take a look, here is a video of an early iteration of one of my 3d engines. It uses a billboarding technique for the trees similar to what I want to do with the tiles. I made it for a (now defunct) fantasy rogue-like type game I wanted to make a while back. I just started getting obsessed with procedural generation techniques and random complexities of rendering shit and never got close to anything really game like. https://youtu.be/evTzexpElg8

1 Like

Nice start. I see you are aiming for 1st person view afterall then? Or this was just a sample of the engine?

With @stone apparently started on 3d voxel style boxes, would they be compatible with your billboard style engine? Or will it render the graphics regardless of style?

Iā€™m just trying to visualize the goal and end product. In my opinion, I would personally enjoy either style. I think at the end of the day, its whichever process would be easiest to implement.

No intention to go 1st person, that was just an easy to link example of billboarding in a previous engine I worked on. My goal to start is just get an OpenGL frontend up and running, which wouldnā€™t really necessarily involve anything particularly ā€œ3dā€. I want to implement a basic orbital camera with mouse control and turn certain tiles into billboards. A way to cheap and dirty 3d with existing assets, I guess.
Iā€™m particularly excited about seeing what improvement could be had just adding nice filtering and smooth level of detail zooming to the map.

2 Likes

I understand the Keep It Simple Stupid principle. Just get the front end up and integrated. Still excited to see it, keep us updated please!

1 Like