CPHERE
A (WIP) RTS/Citybuilder game that takes place on a procedurally generated spherical world.

Back to home

About

After playing games like Anno 1404, Age of Empires and Civilization I fantasized about making a similar game that takes place on a spherical earth instead of a flat earth.
I've had this idea for several years until recently I actually started working on it.

The game is made in my own C++ game engine using OpenGL. I've learnt a lot about rendering 3D graphics during this (unfinished) project.


Web Demo

Water rendering

Initially I had zero experience writing 3D shaders, so the water shader was quite a challenge to make. Making this water shader for a spherical surface, instead of a flat one, made this even harder.

After learning about water caustics, reflections, the fresnel effect etc. I finally got to this result, of which the breakdown can be seen in the video.

Island generation

The video shows how the islands/continents in the game are generated.

Originally I started programming the game in Java (with LibGDX), but after I rewrote the whole thing in C++, the island generation became 20(!) times faster.
This was one of my motivations to rewrite the whole game in C++, which also gave a huge FPS boost.

Ship pathfinding

Ships in the game are able to travel around the world.
To make this possible there needs to be some sort of navigation graph.

For this, I made a icosphere generator that cuts out the islands, and subdivides triangles close to the coastline one extra time to give extra pathfinding precision. (see image for icosphere)

With this 3d graph you can use pathfinding algoritms, like A*, to find a path from A to B.
This path is then smoothed out to mask out sharp angles etc.

Buildings & instanced rendering

In the video you can see how buildings (only houses & trees for now) are being placed on an island grid.

To render the trees and other buildings I use instanced rendering.
That means that thousands of trees can be rendered in only 1 draw call instead of thousands. This eliminates the waiting time between CPU and GPU and therefore greatly increases peformance.

Graphics breakdown

Here's a simple video showing all graphical features.