Topic was automatically imported from the old Question2Answer platform.
Asked By
Toger5
Old Version
Published before Godot 3 was released.
Godot-Voxel-Game-MineCraftClone
Hello everybody,
I want to share my project: cloning Minecraft with Godot. Where I’m currently working on with you.
It’s still in an pretty early phase so I still do have problems with performance and the biggest feature of Minecraft: Building and Mining is still missing ;(
Like it quite a lot! You are generating chunks with gdscript or you wrote a c++ module?
kubecz3k | 2016-02-25 17:07
Thank you. No I didn’t write any c++. All chunks are generated with GDscript and the SurfaceTool. Also the voxel engine is based on dictionaries in GDscript (which is the easiest but not the most efficient way. Because GDscript dictionaries are getting really slow when there are a lot of keys in it ;( maybe I could get better results when doing it with c++)
Toger5 | 2016-02-25 19:53
Looking good!
Tybobobo | 2016-02-25 20:14
I guess for every game engine there will be at least one guy to make a Minecraft clone. But that’s great, it’s interesting to see how Voxel games can be done with Godot and how the performance will be.
Good luck and keep us updated
Valentactive | 2016-02-25 21:11
For the voxel generation you might want to try a flat 3D byte or int array if possible and use masking and reserve bits for voxels . This should speed it up significantly. Then like Minecraft you wanna have entities which means complex non voxel objects in a separate list.
After I read the comment of @trollworkout (THANK YOU !!!) I made some performance benchmarks with dictionaries.
I wrote a script which creates two dictionaries, one with Vectors as keys and the other one with IntArrays.
The results show how good @trollworkout’s comment was!!
Here is a table of the results:
all numbers are in msec’s
as a consequence im over 350 times faster when I use Int Arrays!!
And the creation process of the Dictionary also is going to be 640 times faster
I’m pretty shure that my test werent that proper set up but it still shows that there will be a huge performance Increase.
I will do an implementation of the new dict system as soon as possible. Shouldn’t be that hard.
If somebody Is intrested or wants to give feedback here is the ugly code of the test:
extends Node
func _ready():
var dictSize_hochDrei = 20
var dictV = {}
var t = OS.get_ticks_msec()
for x in range(dictSize_hochDrei):
for y in range(dictSize_hochDrei):
for z in range(dictSize_hochDrei):
dictV[Vector3(x,y,z)] = 1
print("Vector Dict created in ",OS.get_ticks_msec() - t," msec Size: ",dictSize_hochDrei*dictSize_hochDrei*dictSize_hochDrei)
var dictI = {}
t = OS.get_ticks_msec()
for x in range(dictSize_hochDrei):
for y in range(dictSize_hochDrei):
for z in range(dictSize_hochDrei):
dictI[[x,y,z]] = 1
print("Int Dict created in ",OS.get_ticks_msec() - t," msec Size: ",dictSize_hochDrei*dictSize_hochDrei*dictSize_hochDrei)
var numberOfSearches = 200000
var value
var t = OS.get_ticks_msec()
for i in range(numberOfSearches):
var x = randi()%dictSize_hochDrei
var y = randi()%dictSize_hochDrei
var z = randi()%dictSize_hochDrei
value = dictI[[x,y,z]]
print(numberOfSearches," suchvorgaenge in _DictI_ brachten: ",OS.get_ticks_msec() - t," msec")
var t = OS.get_ticks_msec()
for i in range(numberOfSearches):
var x = randi()%dictSize_hochDrei
var y = randi()%dictSize_hochDrei
var z = randi()%dictSize_hochDrei
value = dictV[Vector3(x,y,z)]
print(numberOfSearches," suchvorgaenge in _DictV_ brachten: ",OS.get_ticks_msec() - t," msec")
Small Update
I now Implemented a way to destroy blocks. This wasn’t that easy and its still buggy because I have to modify a surface and can’t just delete the cube that got destroyed by the player.