Well I don't like EverQuest Oblivion as I have already seen more than 10 games where there were beautiful greenery. But a very good such example to note-not for playing in this case, but for game development-is the first Far Cry. The level of detail there is insane...stealth in the tropical jungle forest on an island which has half-transparent sand water, with white sharks circling the multiple sea docks. The theory they took there to allow such memory and GPU overhead handling-was basically to realign the light system by populating more of the island by dense jungle forest, meaning less sun's lighting rays from any direction.
13 hours ago, Gnollrunner said:
That's 2GB for an 800 km diameter planet at about a half meter resolution. It's procedural and uses an aggressive LOD system.
I've only been programming since 1981, but remarkably I've already learned how to comment code.
I wasn't talking about commenting son...I just suggested the standard commenting style...you most probably know this as well, but it was worth noting.
13 hours ago, DerTroll said:
As he stated, it was a small example code. So there is no need for documentation here. Only some comments for hard to understand code sections would have been nice ?
Not quite. I would like a detailed commented explanation in the code to see what you think a class represents.
Three of your code examples:
In the first you should try data encapsulation.
In the third, use explicit data cast converting. You use it but not in every case. Also use smart pointers. Here is what I suggest for the voxels:
//Planet.h
#include "Voxel.h"
#include <utility>
//Include graphical library files here
class Planet
{
private:
std::unique_ptr<Voxel> building_blocks{nullptr};
};
//Planet.cpp
//Voxel.h
#include <array>
class Voxel
{
private:
int oct[8]{0};
public:
Voxel(int set1,int set2,int set3,int set4,int set5,int set6,int set7, int set8);
Voxel(std::array<int, 8>& oct_arr);
};
//Voxel.cpp
#include "Voxel.h"
Voxel::Voxel(int set1,int set2,int set3,int set4,int set5,int set6,int set7, int set8)
{
oct[1-1]=set1;
oct[2-1]=set2;
oct[3-1]=set3;
oct[4-1]=set4;
oct[5-1]=set5;
oct[6-1]=set6;
oct[7-1]=set7;
oct[8-1]=set8;
}
Voxel::Voxel(std::array<int, 8>& oct_arr)
{
for(size_t iterator{ 1 };iterator <= 8; iterator += 1)
{
oct[iterator - 1] = oct_arr[iterator - 1];
}
}