• entries
4
31
• views
1557

# Planet generation in real time.....

740 views

Well we're back with a new entry.  As usual we have made a lot of bug fixes. The primary new feature though is the separation of graphics, and planet generation in different threads. Here's the somewhat familiar code that was modified from our first entry....

void CDLClient::InitTest2()
{
this->CreateConsole();
printf("Starting Test2\n");
fflush(stdout);

// Create virtual heap
m_pHeap = new(MDL_VHEAP_MAX, MDL_VHEAP_INIT, MDL_VHEAP_HASH_MAX) CDLVHeap();
CDLVHeap *pHeap = m_pHeap.Heap();

// Create the universe
m_pUniverse = new(pHeap) CDLUniverseObject(pHeap);

// Create the graphics interface
CDLDXWorldInterface *pInterface = new(pHeap) CDLDXWorldInterface(this);

// Camera control
double fMinDist = 0.0;
double fMaxDist = 3200000.0;
double fSrtDist = 1600000.0;

// World size

// Fractal function for world

// Create world
CDLSphereObjectView *pSO = new(pHeap) CDLSphereObjectView( pHeap, fRad, 1.0 , 0.25, 6, pNV );
pSO->SetGraphicsInterface(pInterface);

// Create an astral reference from the universe to the world and attach it to the universe
CDLReferenceAstral *pRef = new(pHeap) CDLReferenceAstral(m_pUniverse(),pSO);
m_pUniverse->PushReference(pRef);

// Create the camera
m_pCamera = new(pHeap) CDLCameraObject(pHeap, FDL_PI/4.0, this->GetWidth(), this->GetHeight());
m_pCamera->SetGraphicsInterface(pInterface);

// Create a world tracking reference from the unverse to the camera
m_pBoom = new(pHeap) CDLReferenceFollow(m_pUniverse(),m_pCamera(),pSO,fSrtDist,fMinDist,fMaxDist);
m_pUniverse->PushReference(m_pBoom());

// Set zoom speed in the client
this->SetZoom(fMinDist,fMaxDist,3.0);

// Create the god object (Build point for LOD calculations)
m_pGod = new(pHeap) CDLGodObject(pHeap);

// Create a reference for the god opbject and attach it to the camera
CDLReference *pGodRef = new(pHeap) CDLReference(m_pUniverse(), m_pGod());
m_pCamera->PushReference(pGodRef);

// Set the main camera and god object for the universe'
m_pUniverse->SetMainCamera(m_pCamera());
m_pUniverse->SetMainGod(m_pGod());

// Attach the Camera to the vertex shader

// Create a rasterizer state and set to wireframe
m_pRasterizeState = new(pHeap) CDLDXRasterizerState(this);
m_pRasterizeState->ModifyState().FillMode = D3D11_FILL_WIREFRAME;

// Initailze the universe
m_pUniverse()->InitFromMainCamera();

// Run the universe!
m_pUniverse->Run();

}

Right at the end we call "m_pUniverse->Run();". This actually starts the build thread. What it does is continuously look at the position of the god object which we have attached to the camera above in the code, and build the planet with the appropriate LOD based on it's proximity to the various terrain chunks.........Let's not bore you with more text or boring pictures. Instead we will bore you with a boring video:

As you can see it generates terrain reasonably fast.  But there is still a lot more we can do. First off we should eliminate the backside of the planet.  Note that as we descend towards the planet the backside becomes bigger and bigger as the horizon becomes closer and closer to the camera. This is one advantage of a spherical world.  Second we can add a lot more threads. In general we try to cache as much data as possible.  What we can still do is pre-generate our octree at one level down using a fractal function pipeline.  In general most the CPU time is spent in the fractal data generation, so it makes sense to put add more threading there.  Fortunately this is one of the easier places we can use threading. For our next entry we hope to go all the way down to the surface and include some nominal shading.

You're a true wizard!!! 😮 Very nice job!

8 hours ago, Rutin said:

You're a true wizard!!! 😮 Very nice job!

Thanks. We have mall called Oz Mall in my city. I guess I should start hanging out there

Awesome  Well I can't wait to see what is next!

That's awesome!

## Create an account

Register a new account

• ### Similar Content

• Hi,
We are working on a sequel to my all time favorite application:
"Garry Kitchen's GameMaker" for the Commodore 64.
(it's a very simple game creation IDE)
Application builds and runs on Windows(R) and Linux.
(the only dependency is SDL2 and there is a makefile included to build on any Linux)
NOTE: This is a just started work-in-progress...don't expect too much
We will be updating this thread posting as production progresses.
This is our most ambitious project to date so don't expect a beta for at least 6-12 months...
Thanks!
JeZxLee
www.FallenAngelSoftware.com
If you are unfamiliar with this superb game creation IDE then please check out the wiki below:
en.wikipedia.org Garry Kitchen's GameMaker
Garry Kitchen's GameMaker is an IDE for the Commodore 64, Apple II, and IBM PCs, created by Garry Kitchen and released by Activision in 1985. The software is notable as one of the earliest all-in-one game design products aimed at the general consumer, preceded by Broderbund’s The Arcade Machine in 1982. Two add-on disks are available for the Commodore 64 version: Sports, and Science Fiction. These include sprites, music, and background elements for loading into GameMaker. To demonstrate the vers...
GitHub FallenAngelSoftware/SDL2-C64GKGM2
100% FREE Cross-Platform Open-Source SDL2 Video Game Engine! - FallenAngelSoftware/SDL2-C64GKGM2
Here is a screenshot:

• I was tying to figure out what to do with my procedural planets and for an initial step and I wanted to fly a spacecraft in and establish a low orbit around my world starting from some distant point and initial velocity.  I know how to set up the gravity and I think I can pretty much do manual controls that will simulate Newtonian physics. However what I'm looking for is some software or algorithms that let me establish the orbit by controlling thrust in the right direction at the appropriate points in a trip towards the planet.
So I guess the software would accept something like starting position, starting velocity, desired orbit height (I'm assuming circular for now) , and desired orbit plane.  From there it would give me firing points, duration and trust vectors needed to for the orbit.  To make things simpler I'm assuming infinite fuel. I figure NASA must do stuff like this all the time but I haven't been able to find something solid on how it's done.  Perhaps it's too complex, I'm not really sure, but I thought I throw the question out there anyway.

• Hi guys! Our first game (Dongo Adventure) has just been released on Steam! I hope you have fun with the game! O/
The game was produced by me and my brother for 11 months. We did everything with free and open source software (Blender 3D and Gimp).
About the game: The game is 3D Platform style, inspired by the classic platform games (mainly 'Donkey Kong Country 2'), bringing all those challenges and fun of the genre. Thank you all for the support!
Official Trailer:

• By isu diss
This post is about continuation of https://www.gamedev.net/forums/topic/699032-3d-rigidbody-simulation/. I have setup the Collision Detection and Collision Response for the cricket ball. But the ball doesn't bounce off the ground. After a bit of debugging, I've found that the impulse, generated when the ball bounces off the ground is very small. What should I do to make this right(right impulse)?