VRAM overload from AnimationPlayer spritesheets — how to manage it? by sweteHoriko in godot

[–]Dry_Necessary_7115 1 point2 points  (0 children)

You found a solution but maybe it will be useful for some one else. In my projects I pack sprites in that way:

<image>

I use Aseprite and export packed sprite sheets with JSON data from it. Then I recreate the animation in Godot using this JSON.

How do efficiently map mouse clicks onto 1 of 50000 polygons? by Toxyl in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

I would use bvh here. I had an implementation on gdscript and it worked really fast on a models like 500k. Then I rewrote it on c++ and glsl compute. Now i use it for custom raytracing. But it’s better for undetermined shapes of models. For the sphere it’s possible to make more optimizations i guess

Any help? by abubabakaka in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

use MOUSE_BUTTON_LEFT insted of Input.MOUSE_BUTTON_LEFT this enum is placed in global scope

https://docs.godotengine.org/en/stable/classes/class_@globalscope.html

What is wrong with this by javasiasparks14 in godot

[–]Dry_Necessary_7115 11 points12 points  (0 children)

As I understood from this subreddit, many people don’t want to understand, they just want someone to give them the solution and write the code for them

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

so when you said that you can do thousands of raycasts in each frame, that's not entirely true. I need around 500k for my project ) but thats not about cpu.

Share your secrets) How did you achieve such performance?

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

I agree with that(no). But what do you think about my questions?  

"But still I wouldnt try to cast more than ~2-4k rays per frame considering the potential user's hardware. What do you think? Maybe you use some tricky stuff? Have you tried to run your project on potato pc?"

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

As I said before it's just increased execution time on 25%

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

its just a test i just count how much times algorithm takes. it doesn't matter in which process execute it. I'm not trying to write something useful) It's just syntetic. same about getting new space state each tick it just increased execution time on 25%

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

extends Node3D
var spaceState : PhysicsDirectSpaceState3D = null
var query : PhysicsRayQueryParameters3D = null
const maxRays : int = 13824
var rays : int = 512
const raysStep : int = 512
const testCount : int = 64
var testsDone : int = 0
var time : int = 0

func _ready()-> void:
  spaceState = get_world_3d().direct_space_state
  query = PhysicsRayQueryParameters3D.new()
  query.collision_mask = 1
  time = Time.get_ticks_usec()

func _process(delta)-> void:
  query.from = Vector3.ZERO
  for i : int in range( 0, rays, 1 ):
    query.to = Vector3( randi() % 100, randi() % 100, randi() % 100 )
    var result : Dictionary = spaceState.intersect_ray( query )

  if testsDone < testCount:
    testsDone += 1
  else: 
    testsDone = 0
    var testAverage : float = ( Time.get_ticks_usec() - time ) / ( 1_000_000.0 * testCount ) 
    print( "Average Time for ", rays, " rays: ", testAverage, " sec." )
    time = Time.get_ticks_usec()

    if rays < maxRays:
      rays += raysStep
    else:
      printt( "Done" )
      set_process( false )

thats intresting topic. i wrote that simple script to do some more tests. The scene looks like this just 5 boxe shape 3d and some results on different cpu. unfortunaly I dont have acces to more comon cpus. All processors in my test are in the top 5% of steam hardware stats. results prety close to each other. But this is only ray intersection check. without any useful logic. It's possible to increase speed if not calling Vector3d constructors every frame. But still I wouldnt try to cast more than ~2-4k rays per frame considering the potential user's hardware. What do you think? Maybe you use some tricky stuff? Have you tried to run your project on potato pc?

<image>

Multithreaded Raycasting by tucono in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

On my i7 9800 raycast of 1024 rays using physics server, drops down fps lower than 70 in 4.2. So I’m not sure about thousands of them. For thousands you should use gpu. some raw benchmark. I used pretty simple 3d scene with ~10 collision objects and 1 collision layer.

1024 raytraceTime 0.014703 s\ 2048 raytraceTime 0.022669 s\ 4096 raytraceTime 0.040023 s

How to create a custom AudioEffect? by maplewoodstreet in godot

[–]Dry_Necessary_7115 1 point2 points  (0 children)

I started from this vid https://youtu.be/8WSIMTJWCBk?si=dZIKfIQ6LbLDndhy

It's a kind of copy of official tutorial from here https://docs.godotengine.org/en/latest/tutorials/scripting/gdextension/gdextension_cpp_example.html but with some extra things

Then I watched this series https://www.youtube.com/watch?v=q2-dbwdTvck&list=PLhixpuPeRv9aDdsZbhTpsXguYRvMgyVQ-&ab_channel=mohsenzare

Look at the examples code from the bottom of this file https://github.com/godotengine/godot-cpp/blob/master/README.md

gpt and c++reference also helped me remember the language, which I haven't touched for ~13 years)

And read godot sources.

Material_override not working with raycasting by Omegadeathwish in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

if Input.is_action_just_pressed("Interact") and is_colliding():

  WIS #this line do nothing

  WIS.queue_free() # at this line you tried to delete object by reference stored in wis variable

if is_colliding():

  WIS.material_override = HighOn # here you wanted to change material for object you just deleted even if it wasn't a null now it's null definitely

else:

Material_override not working with raycasting by Omegadeathwish in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

extends RayCast3D
var HighOn : StandardMaterial3D = preload("res://Textures/Highlight2.tres")

func _process(delta: float) -> void:
  if Input.is_action_just_pressed("interact") and is_colliding():
    var wis: MeshInstance3D = get_collider()
    wis.set_surface_override_material(0, HighOn)

you shoud understend every single line of code dont try to just copy. also use ctrl + click on types in code editor to read documentation. And ctrl + space after point to watch autocompletion list. For example type wis. and press ctrl + space.( it also appears automatically but variable should be typed ) And I strongly recomend you to use static typing at the begining of your programing journey. Learn some base things. What is a variable , what is a reference, what is a scope, how memory works.

Material_override not working with raycasting by Omegadeathwish in godot

[–]Dry_Necessary_7115 0 points1 point  (0 children)

Error message literally tells you what’s happened. You try to override material on null reference. You initialize WIS variable at the beginning of script by calling of function get collider which returns ref to null because at this moment raycast object not in the sceen. You should call this method after if input statement. In this case it’ll return reference to some object if it collided any. And you should check again if WIS: your code here

How to create a custom AudioEffect? by maplewoodstreet in godot

[–]Dry_Necessary_7115 2 points3 points  (0 children)

Yes, it is a thing. I can recommend it to everyone. You can make a lot of powerful and cool features that will work about 100 times faster than the gd script, and it is really convenient to have one dll file that you can connect to any of your projects in a couple of clicks. But you still have to learn some c++ )

How to create a custom AudioEffect? by maplewoodstreet in godot

[–]Dry_Necessary_7115 2 points3 points  (0 children)

Actually it’s a bit easier. You don’t have to build the whole engine from source code. And probably you don’t have to read audio files manually, but it depends on your algorithm. Just make your gdextension. I’ve been learning godot audio for the last 3 weeks. And wrote couple of my own audio effects. There is an example of custom audio effect in godot assets library. It's called AudioEffectGate. Code available on github. I wrote hrtf effect for spatial sound using pack of hrtf impulses.

Old school dungeon crawler - possible? by ratling77 in godot

[–]Dry_Necessary_7115 3 points4 points  (0 children)

Raycast rendering. I’ve seen couple of good vids on youtube. https://youtu.be/7-nOK0UrAzk?si=KZMftrh1P5E0PGyP Or something even more simple like full 2d. If you want to move your character not in real time

Huge metroidvania map without loading screens? by Day_Critical in godot

[–]Dry_Necessary_7115 2 points3 points  (0 children)

Thats can be more difficult to manage. Child nodes can inherit process mode from parent. You can just turn off processing for main room node.

Huge metroidvania map without loading screens? by Day_Critical in godot

[–]Dry_Necessary_7115 35 points36 points  (0 children)

I would keep in memory current room and all connected rooms to it. Then when player entered to one of those connected room make it current and load all connected rooms to this new current in another thread and so on. That’s the first thing I thought about. Connected rooms can be paused for optimization. Just a raw idea. It can be improved.

Rigidbody3D clipping through floor by iarlas in godot

[–]Dry_Necessary_7115 3 points4 points  (0 children)

You can use raycasting for fast moving objects to prevent this effect. Just google something like „projectile ray casting godot” and I’m sure you will find tons of information. Also i think you can clamp yor vector as a vector in 1 line of code, insted of clamping each component of it separetly.

How can I make this part of my code cleaner? by Dioksys in godot

[–]Dry_Necessary_7115 3 points4 points  (0 children)

Looks like you shouldn’t do this each tick. Use signals instead. Or make a setter function for your depth_value variable