sleitnick
16.5K posts

sleitnick
@sleitnick
Engineer at https://t.co/fmbN8adq7V
Katılım Nisan 2018
560 Takip Edilen38.8K Takipçiler

@sleitnick Now we need an engine with Luau as the scripting language... oh wait
English

@ayyanafghan Yeah I don't mind snake_case. The grossness is when you mix different cases
English
sleitnick retweetledi

@MrChickenRocket Trivial vector movement towards target without overshooting & a proximity check. Could also be easily inlined
English

@sleitnick Looks fine. I assume reaching targets is pretty rare. What goes on inside agent move?
English

Now around 85 FPS with 100k agents! The major changes were:
1) All agents are created in contiguous array (no longer individually allocated).
2) Signals back into GDScript are batched per frame update, rather than signals per agent
Still more work to do to get to 144 FPS
sleitnick@sleitnick
Stress-testing 100k agents. FPS dropped to 60. I had to move most of the logic to C++ to make this work. I could only scale to ~10k in GDScript before hitting a wall. Each "agent" is also just a cube here. Nothing complex. My goal is to get this stable at 144hz w/ 100k agents.
English

@MrChickenRocket I bet there's improvements that could be made here. Only "get_transform()" is inlined, & "targets_reached" could be a fixed size buffer (& certainly not recreated every frame, oops). I haven't looked at actual asm output for this yet

English

@sleitnick Generally you want the code to be smaller - typically you'd want loops over data that don't have any non-inlined function calls - final asm just being one tight block < 32kb for the loop
English

@thisgodisbored An NPC. These will eventually be passengers/staff/ground crew/etc. within airport. I'm quite new to Godot though, so I'm stress-testing it to better understand limitations & how to work with/around those limitations
English

@sleitnick Nice. What does it mean, "agent" by the way. What are they doing?
English

@ccallac7 Zero multi threading yet, but I limit it to 1k per frame for finding next path (just finds adjacent valid cell for now). All 100k update their transforms every frame though if moving. Once I plug in pathfinding, I'll probably spool up some threads to run pathfinding tasks
English

@sleitnick Damn! Is it multithreaded / are you spreading the updates out over multiple frames?
English

@MrChickenRocket Yup, I'm only updating the agents under a certain 'moving' flag. In terms of cache line, idk! Agents currently inherit from Godot's base object which might be pretty heavy. Might need to split that off to see
English

@sleitnick Good stuff. Are you minimizing your code per system loop too? Don’t forget code has to fit inside cache lines as well.
English

@sleitnick I assume it's the squares which you're trying to stress test? If you haven't tried already, perhaps the rendering server API may be useful? Learned of it recently
youtu.be/1PnG3r1rKcs?t=…

YouTube
English





