Thanks all for liking it
Yeah, maybe I will get back to working on it later on, but I will have to fix it up a lot because there are a lot of visual bugs as you may have seen
My main idea about this game was that you could run around on the planet gathering resources just like in Minecraft, building houses, building cars so you could travel farther, and as the technology increased, building aircrafts and spaceships..
After hours of playing you could finally go into your rocket that you have built and finally fly the Moon, the one that have been haunting you in the sky all this time
As you would be able to get more resources on the moon you could build a bigger spaceship and fly to the other planets in the solar system, and all this would be in multiplayer.. No clipping while entering the atmosphere to a planet or anything like that, it would all be in real time..
I loved this idea, planets that could be built just by tweaking some values here and there
Just want to clear some of the terms up for those not familiar with it and still wants to keep reading
CPU = Central processing unit (Calculations made by the computer processor, the speed is defined by MHZ)
GPU = Graphics processing unit (Calculations made in the graphic card)
The GPU is actually about 100 times faster than the CPU at preforming certain calculations because of its extreme multi threading abilities. So it is always preferable to do as much calculations at the GPU as possible (that can't be predefined by the CPU), also because the graphic cards gets about 30 % faster each year while the CPU:s only gets about 10 % faster a year.
But unfortunately I discovered one mayor problem with my layout.. All the planet generation was built on the GPU, if I would do it on the CPU the framerate would go down to about 10 - 20%.. Why it is a problem generating the planet only on the GPU is that the CPU don't get all the information. Lets say that I want to modify one little triangle amongst millions of triangles being rendered right now, or one triangle amongst billions of triangles being generated over the whole planet, first I would have to let the CPU communicate with the GPU just to get the triangles position (mayor fps decrease), then I would have to tell the GPU that that certain shouldn't be rendered amongst all those millions..
I did somehow manage to get around this problem, that is seen in the video when I dug in the ground and also that I had some collision detection with the mountains.
The reason why I had to do this and not just simulate the same calculations on the CPU as I do on the GPU to get one vertex location is because of the following:
As the planet is a sphere and not flat (like in Minecraft), I had to start all the calculations from the center of the planet and then expand the mountains to the planet size (Hmm.. that did not make much sense)..
Let me try again..
If we have a planet with a radius of 637800 meters that I have here, and then a specific vertex with the coordinate (0.43238722, 0.78924251, -0.43604764) should be raised 567.23 meters above the sealevel.. Then we have:
(Vertex Coordinate) * ((Planet Radius) + (Mountain Height)) = (0.43238722, 0.78924251, -0.43604764) * (637800 + 567.23) = (276021.8319188006, 503826.5549069473, -278358.5240948372)
So the vertex should get the location (276021.8319188006, 503826.5549069473, -278358.5240948372) on the planet..
Now that is a very big and very specific number! And the GPU only uses 32 bits floats when doing their calculations so the result on the GPU will be something like:
(276021.8, 503826.6, -278358.5) or even worse: (276022.0, 503826.5, -278359.0)
Making it round it down to the closest half meter.. That is why I couldn't simulate the locations on the CPU as the GPU would get totally different values
So that is why I have to ask the GPU every time I will have to get some information about the planet, and this is a very annoying way of doing it.. An alternative is to shrink the planet down to a radius of 6378 meters, but that would just look unrealistic..
Anyway, all these rounding errors and all the communications between the GPU and the CPU was a really creating problems for me. So therefore if I continue this project later on I will have to do some major changes and make it more manageable, otherwise it will be more like a demonstration of a planet generation than being a actual game..
But even if this took me a couple of months and led to nowhere I don't regret it. I have never learned so much about the GPU and managing shaders than I did when creating this project! I had to take shortcuts everywhere and really use every shader programming combination possible
At 1:35 I am saying "Fractal Regeneration" but what I meant to say was just "Fractal generation".. Some how the word "Regeneration" got stuck when I recorded this video and I don't think that is the right term to use.. I am having to redo the video, not only because I am using the wrong terms, but also because the video can freeze now and then, and that is a recording problem. The game itself is very smooth and are running at 300 fps at my computer..
One more thing.. In Dungeon Dwellers I use the GPU to handle all particle sorting, update and death. All the CPU does is to tell the GPU where the particles birth is and how it should behave, then the GPU does the rest. So this made it possible for me to render about 65536 particles at the same time on the screen always sorted in back to front order wherever the camera is in about 1 milliseconds time.. Now I only use about 5 % of that capacity in Dungeon Dwellers, but it is still fun when I think about when I first started to create particle effects in DMT 1 and had a fps problem if I tried to sort 500 particles at once
If anyone has read all the way down here without falling asleep in between I am REALLY impressed
(And btw. I am really glad I copied all the text before submitting it because when I was done it wanted me to log in again!!)