Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

godot4.3.beta3 error #456

Open
yythlj opened this issue Jul 11, 2024 · 8 comments
Open

godot4.3.beta3 error #456

yythlj opened this issue Jul 11, 2024 · 8 comments
Labels
bug Something isn't working Waiting for Godot Godot has a bug and should be fixed first

Comments

@yythlj
Copy link

yythlj commented Jul 11, 2024

ERROR: Parser bug: Mismatched external parser.
at: (modules/gdscript/gdscript_analyzer.cpp:909)
SCRIPT ERROR: Parse Error: Cannot infer the type of "i" variable because the value doesn't have a set type.
at: GDScript::reload (res://addons/zylann.hterrain/tools/brush/brush_editor.gd:158)
ERROR: Failed to load script "res://addons/zylann.hterrain/tools/brush/brush_editor.gd" with error "Parse error".
at: load (modules/gdscript/gdscript.cpp:2925)
ERROR: Parser bug: Mismatched external parser.
at: (modules/gdscript/gdscript_analyzer.cpp:909)
ERROR: Parser bug: Mismatched external parser.
at: (modules/gdscript/gdscript_analyzer.cpp:909)
SCRIPT ERROR: Invalid call. Nonexistent function 'set_terrain_painter' in base 'HBoxContainer (brush_editor.gd)'.
at: set_terrain_painter (res://addons/zylann.hterrain/tools/panel.gd:47)
SCRIPT ERROR: Invalid call. Nonexistent function 'setup_dialogs' in base 'HBoxContainer (brush_editor.gd)'.
at: setup_dialogs (res://addons/zylann.hterrain/tools/panel.gd:25)

occur on load

@yythlj
Copy link
Author

yythlj commented Jul 12, 2024

and no error on godot4.3.beta2

@Zylann
Copy link
Owner

Zylann commented Jul 12, 2024

Looks like a Godot bug. It worked all the way before and I don't see anything wrong with the code.
If you really want to use beta3 immediately, you could try to replace the line with this as a workaround:

	var i : int = brush.get_shape_index()

@Zylann Zylann added bug Something isn't working Waiting for Godot Godot has a bug and should be fixed first labels Jul 12, 2024
@yythlj
Copy link
Author

yythlj commented Jul 17, 2024 via email

@Zylann
Copy link
Owner

Zylann commented Jul 17, 2024

I found a nother performece problem

Don't post different stuff in the same issue unless they are really related. In the current case it's completely unrelated.

the fps will below when I change the grass detailayer distance from 100 to 500

I assume you mean FPS goes down? It will indeed affect FPS to increase the render distance of detail layers. But also they aren't particularly optimized unfortunately (due to how chunks are handled, not how they render). I don't expect a huge difference though, unless you have many or your computer isn't a fast one or something.

full density 100 distance is 60 fps
full density 500 distance is 40 fps

On my computer in the editor if I set render distance to 500 FPS doesn't even go below 60. But to be honest, FPS does drop, so it must just be that your computer is much slower than mine (I dont even have the most powerful ones, it's like 5 years old with an AMD Ryzen 5 and nVidia 1060).
Right now you would have to keep distance low, or modify the plugin to implement better grass chunk handling. The issue is what happens in the process function of hterrain_detail_layer.gd.

smallest density and use qua_1,100 distance is 60 fps
smallest density and use qua_1,500 distance is 40 fps

I don't understand what qua and those distances mean.

have any way to increase performce

As I said, the chunk handling code has to be improved. It's iterating every chunk every frame to test whether they should load or unload. In C++ or C# that's usually fast, but the plugin uses GDScript so only a better algorithm can improve it. Maybe something that only updates the difference in loaded region rather than the whole region each time, something like that...

Most of the time is spent here
A really quick and dirty fix would be to insert this in the code:

	for k in _chunks:
		if randf() < 0.9: # <--
			continue

This has the effect of spreading out chunk updates over multiple frames. With this hack, that part of the code goes from 4.3ms to 0.5ms, which is almost 10 times faster with seemingly no visual difference.
Though a proper solution nowadays I would re-implement the process by only calculating changes instead of polling every frame.

I tested a bit further and then eventually realized that view distance 500 with density of 4 had a big impact on my FPS too, but that's on the GPU. So that may be tuned down if you want to see that far.

@Zylann
Copy link
Owner

Zylann commented Jul 17, 2024

Pushed 8c1b660, which optimizes the process function of HTerrainDetailLayer.

@32kda
Copy link

32kda commented Jul 24, 2024

Hello!
I've tried a fix suggested above (adding :int) but still unable to edit height map under 4.3.

Seeing messages like:
Parser bug: Mismatched external parser. Parser bug: Mismatched external parser. modules/gdscript/gdscript_byte_codegen.cpp:919 - Compiler bug: unresolved assign. res://addons/zylann.hterrain/tools/brush/brush_editor.gd:133 - Invalid type in function 'set_shapes' in base 'RefCounted (brush.gd)'. The array of argument 1 (Array) does not have the same element type as the expected typed array argument. ... res://addons/zylann.hterrain/tools/brush/brush.gd:171 - Assertion failed.

Last one when trying to draw terrain
Is there a way to fix this?
Thanks

@Zylann
Copy link
Owner

Zylann commented Jul 24, 2024

I don't know, AFAIK the error still looks the same and is a bug in Godot 4.3 beta. You'll probably have to use a more stable version of Godot.
The Godot issue was moved to godotengine/godot#94654 also

@MJacred
Copy link
Contributor

MJacred commented Aug 17, 2024

@yythlj, @32kda: Issue #94654 was closed and the PR is part of 4.3. So this should be fixed, please re-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Waiting for Godot Godot has a bug and should be fixed first
Projects
None yet
Development

No branches or pull requests

4 participants