Devlog 3 - Flat Plane
I know this sounds INCREDIBLY trivial, but I finally figured out how to make a flat plane in Godot, that can be used to make an actual terrain.
There were 2 main ways that I could have used to make this:
Method 1:
I can use a PlaneMesh and then subdivide it down into triangles. Then use vertex shaders or custom scripts to displace the plane as a whole based on noise.
It is faster to make the flat plane using this method since you give Godot most of the control over the tessellation, and the individual vertex placement. This means however that it is a lot harder to load and unload certain parts of the terrain, and it is generally harder to add noise to the terrain since you do not have control over each vertex.
Method 2:
I can use an ArrayMesh, where I create the grid from scratch, telling Godot how to connect every single vertex to create triangles. The downside to this is how long this took. I know it seems short compared to my first devlog (I think the main reason I took so long in that one was not only because I was learning Godot, but it was also because I was experimenting with player models on Blender but hopefully now I’ll be more time efficient) but it is still more time consuming to tell Godot how to connect each and every vertex. I was in fact so stumped on how to go about doing this that it suddenly came to me when I was playing with my little cousin. I even noted down how to do it on my phones notes app (excuse my bad handwriting I was in the car writing with my finger) :/
Despite it being longer to setup, it is overall better for the needs of my game, since I’ll not only need to be able to change the height of each vertex based on a heightmap, but it can also aid with making biomes, by adding custom values to each vertex, which is simply not possible with PlaneMesh. It is also easier to load and unload certain parts of the mesh, and it is better for larger maps, since your CPU isnt doing all the hard work of choosing all the vertices and indexing them.
In order to make the actually interesting part of the terrain (which btw I haven’t done in this devlog, I guess this is just like a future plans part) I can use either vertex shaders or custom scripts to make noise in the terrain. Both of these have their respective use cases, and I wouldn’t be able to say one is better than the other for my case.
Vertex Shaders:
GPU based
no collisions (purely visual)
written in Godot Shader Language (which is written in C, which is terrifying for me who practically only knows Python (GDScript and Python are similar enough for me))
Custom Scripts:
CPU based
can create collisions (actually changes the vertex’s height)
written in GDScript (happy days (ik I can write it in C#, but I’m staying far away from that))
Despite my fear of anything not similar to Python, I will still need to use vertex shaders. And I will explain that in my next devlog because this is getting too long.
Now onto my struggles incredible skill when making a.. flat plane in Godot.
I chose to do Method 2, because of it’s functionality later down the line. But that means I have to tell Godot what vertices to make, and how to connect them up. Obviously that was as simple as could be.. (you can see my failures in the screen recordings below)
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.