toger5 / Godot-Voxel-Game-MineCraftClone

This is a Godot project where I try to get familiar with the Engine.
MIT License
72 stars 14 forks source link

The game doesn't works #3

Open Zylann opened 8 years ago

Zylann commented 8 years ago

I gave the game a try, but there are problems:

In the debugger are the following errors: Failed loading resource: res://scripts/utils.gd Can't autoload: res://scripts/utils.gd

I'm on Windows 7 64 bits with Godot 2.0.1

toger5 commented 8 years ago

I'm currently not active on that project but... So I made a random git commit so you can check the current version. I forgot that i created a new file utils.gd some weeks before where i worked on the project. now i added it to the repo. THANK you for that feedback.

It is intended that the scene is almost empty on startup (wold is generated n the fly, like in mc) But i'm not shure why the editor should be laggy. The scene itself is extramly easy.

toger5 commented 8 years ago

tell me if it works so i can close that issue

Zylann commented 8 years ago

There is no utils.gd in the project, did you pushed the update?

toger5 commented 8 years ago

I currently dont get it pushed. need to look into git (made some mess and needed to restore the file)

toger5 commented 8 years ago

For now here is the data of the script (create it yourself in the scripts folder): extends Node

func vec_to_int(v):
    return [int(v.x),int(v.y),int(v.z)]

func int_to_vec(i):
    return Vector3(i[0],i[1],i[2])

func get_chunc_by_coord(cd,pos):
    var correctChunkPos = Vector2(floor(pos.x/16.0)*16, floor(pos.z/16.0)*16)
    if correctChunkPos in cd:
        return cd[correctChunkPos]
    else:
        print("chunk ",pos," is not in chunk_dict")
    return 0
Zylann commented 8 years ago

Ok, I added the script and there is no errors now. But the editor is still laggy and nothing changes, all I see in the game is this: Screenshot

toger5 commented 8 years ago

I'm confused that there are no errors and nothing is showing up. As I said I messed around with git and did override the utils.gd Maybe I also made some other changes. Currently I have very less time so I cant offer a good support. I try to fix the gi problem and uplaod the version I'm running on my pc. This version is running. For now I just can ask you If you have the time to instert some print functions in the geometry for wg to check which part of the code gets executed. And maybe you could double check if there are really no errors.

EDIT: the most important line is 329 in chunk.gd check if it gets executed. If search where it is called and check it that funtion gets executed and so on. maybe you find the bug which would be great help.

toger5 commented 8 years ago

also make shure to use the: newCollisionSystemAndBlockDestroying branch

toger5 commented 8 years ago

I now did the upload and made master up to date. so you should be fine using master I guess. I just tested it on my system and it works

toger5 commented 8 years ago

Okay I now Finally fixed the last issues (I again lost something from one script) Hopefully I didn't destroyed any progress but it seems to work fine. I know what the issue was. The uploaded branch was broken because of some mergers I did with the other branch. (wont go into too much detail but The collider.gd script would need to be innitialized from the player.gd script. This line of code was missing in the repo.) So now you should be fine by just deleting the whole project on you pc and get the current master. Pls give me feedback if it does work.

Zylann commented 8 years ago

Yes, now it works! FPS is very low, but I can see the blocks appear. I also figured out that turning off the DirectionalLight increases FPS a lot, I don't know why but it seems to be the origin of the lag.

toger5 commented 8 years ago

If you use no directional light than you dont have to make shadow calculations -> higher fps. For my system this works okay (30-50) so I leave it on. you also should be able to adjust the shadow detail in: Project_settings -> Rastarizes -> max_shadow_buffer_size maybe you get a setting that is okay for you fps and still looks better than no shadows.

Zylann commented 8 years ago

I see! in the project settings, max_shadow_buffer_size was set to 10240, which is HUGE :'D I reduced to 2048, set shadow_filter to PCF13 and set the light's max_distance to 100 (instead of 0) and I get smooth 60 fps with reasonable shadow quality :)

toger5 commented 8 years ago

nice!! sounds good

toger5 commented 8 years ago

if you want to you can increse the render distance. Its this variable:var RANGE = 5 in line 24 of geometry_for_wg.gd it is measured in chunks in every direction from the player. (so 5 means (5+5+1) * (5 + 5 + 1) = 121 chunks)

toger5 commented 8 years ago

check how much you can render without having low fps

Zylann commented 8 years ago

I tried 12, and dropped to 12 FPS while the 220th chunk was generated. Not sure if it's a culling problem or geometry count (I can render a LOT more in Unity, Minecraft itself or my own implementations without culling in C++). I wonder if Godot uses VBO?

Zireael07 commented 7 years ago

@Zylann: based on a discussion in godotengine/godot #7844, I think the answer is no, it doesn't use VBO.