Entwickler Blog

Latest Comments

Keine Kommentare vorhanden.
Uncategorized

Because Godot’s Lod system leaves something to be desired, it took me a while to realize my idea of terrain with the Godot gridmaps and vegetation. What good is the best gameplay if the map is only 500m wide and runs at 30 fps?
I am using Godot to realize this project. I program almost exclusively in C++. I have not used scripts in Godot so far and would like to avoid this. In the future, however, I will implement Lua.
General rules:

  • Objects are removed from the tree when they are not needed. Durch das entfernen werden die Objekte weder ge-processed noch gezeichnet.
  • Nodes that consume a relatively large amount of resources should use the VisibleOnScreenNotifier3D to check whether they are visible at all. If not, they are also thrown out of the tree.
  • VisibleOnScreenNotifier3D should run in a sub-thread to relieve the main thread.

Vegetation:
I have developed my own node/object that can hold 3 objects. These are removed from or added to the tree depending on the distance. In addition, there is the VisibleOnScreenNotifier3D which removes all nodes if the entire node is not visible.

Lod-Node:

  • Billboard
  • Object without complex damage
  • Object with vertex and fragment shader
  • VisibleOnScreenNotifier3D

This provides a massive performance boost. It also has the advantage that I can place the nodes comfortably before they even have to be visible.
GridMaps:


As I am working alone on the project, it was important to me to have a simple system to quickly create terrain. In addition, working underground is an important trope for dwarfes, which of course should not be missing in A Dwarfen Story. So cubes should it be.


However, I quickly encountered a few problems:

  • Creation of a map with over 1,000,000 cubes
    o Poor performance
    o Crashes because Godot cannot process so many objects with collision
  • Place additional cubes at runtime
    o Leads to massive stuttering.
    o Slow generation to avoid stuttering not fast enough
    o Placing cubes not working in a seperate thread

Current Solution:
I now use N-Gridmaps and not just one that is initially loaded at startup.
The only limiting factor here is that the initial loading takes a while. Of course, this could also be due to the code, since for each cube it is determined what material it is made of, what vegetation grows on it, etc.
Each gridmap has a twin:

  • Grimap with Collision-Objects
  • Gridmap without Collision-Objects.

Depending on the distance to the camera, one or all of them are removed from the tree.
(Similar to the logic of my lod object for the vegetation.)
Duplicating and setting the mesh library with or without collision objects is done dynamically when initially generating the terrain.
To further improve performance here, I can now vary the number of tiles (gridmaps) and their number of cubes.

Conclusion:
This is my first time working with a game engine and the last 6 months have been very enlightening. Now that I finally have the terrain the way I want it, I can get on with the gameplay

Tags:

No responses yet

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

de_DEGerman