Тёмный
No video :(

Traveling Trees - Explaining My Multimesh Instancer / Godot 4 Tutorial 

devmar
Подписаться 19 тыс.
Просмотров 20 тыс.
50% 1

#godottutorial #godotengine
Welcome back to my Godot-focused channel! Today's video is a bit different - we're taking a closer look at a script I've been working on - one that utilises MultimeshInstance3D to spawn a bunch of trees around the player and make them follow the player around the world whilst remaining motionless at the same time. You can create infinite forests with this, or infinite anything (it doesn't need to be trees). The vid isn't necessarily a tutorial. It's more like a casual analysis, where I'll explain the thought process behind each line.
For those of you who love getting into the nitty-gritty of game development, this one's for you. We'll be going through the script step by step, so if you're not into the coding game, you might find it a tad boring. But don't worry, I've got a fun devlog planned for the next video. I'll be introducing a new character - the Tooth Ferry! Stick around for some light-hearted game design fun.
===================
Link to instancer script:
pastebin.com/z...
Link to grid creator script:
pastebin.com/1...
Link to optimized instancer script (multithreaded):
pastebin.com/c...
If asked for a pass code, put 'devmar'.

Опубликовано:

 

5 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 73   
@actualdevmar
@actualdevmar 10 месяцев назад
Aloha! I've optimized the instancer script (see link in video description). In short, the script now packs locations, rotations and scales to Vector3 arrays (which are much faster than 'normal' or 'typed' arrays) and sends those to a separate thread to apply instance transforms. Collisions have got a simple queuing mechanism. Updates are only run when the player moves by a distance that justifies an update. These optimizations have given me a significant performance boost - ca. 30FPS. CPU throttling has been eliminated.
@SinisaSpasojevic
@SinisaSpasojevic 10 месяцев назад
Do you really need to generate trees behind the camera as well? Or terrain "flow" can only be for what's in front of camera. Not talking about camera view clipping, rather to generate trees and terrain in different LODs only what is front part of camera near plane. Basically that would cut to half number of instances you generate as player moves around. Am I correct?
@ariffirdaus5376
@ariffirdaus5376 8 месяцев назад
im using an addon to generate terrain, Heightmap Terrain just incase ya heard of it before, but i couldnt export the heightmap of the generated terrain to use with this custom node, what do i do?
@calebschmidt3577
@calebschmidt3577 8 месяцев назад
Thank you for making this! I'm trying to implement this with a heightmap that's using png or exr image file. I find that when I point the script to the image file and reload the scene, no trees are generated. If I click reimport on the image asset, they will pop in. This works great in the editor but when loading the game, it does not work. I've tried looking for a way to trigger a reimport once the scene is loaded, but I haven't found a way. Any ideas on how to fix this?
@cjdaylight3407
@cjdaylight3407 3 месяца назад
the links are not working
@pairless
@pairless Месяц назад
Can we have an update? it's been 8 months and I was looking forward to this game
@willyamcarkey717
@willyamcarkey717 10 месяцев назад
Unity has Sebastian Lague, Godot has Devmar! Great and super professional job! Love your work
@mbg4681
@mbg4681 10 месяцев назад
Speaking of, you might enjoy a video by Athillion titled "I Made Sebastian Lague's Procedural Planet In Godot 4".
@user-ub4hw4zo8s
@user-ub4hw4zo8s 2 месяца назад
@@mbg4681 And Martin Donalds videos of course!
@loycross
@loycross 10 месяцев назад
Not easy to follow for someone who hasn't really touched Godot yet, but as a web dev this feels way more useful than most tutorials, with full explanations on how things work and a general review of the code functionality. Great work, honestly.
@actualdevmar
@actualdevmar 10 месяцев назад
Thank you. This was not meant to be a tutorial per se. If I were to explain everything from scratch (including what a multimesh is etc etc) the video would be an hour long probably. Instead I decided to share the script and provide a short 'user manual' for it. But yea, one needs to know their way around Godot to find this useful.
@BastiaanOlij
@BastiaanOlij 10 месяцев назад
Very well explained! Two small suggestions: move updating the multimeshes into a thread, and instead of triggering the update at fixed intervals, trigger the update if the player has moved beyond a certain radius of where they were before the last update.
@actualdevmar
@actualdevmar 10 месяцев назад
Hey Bastiaan, I'm tinkering a bit to optimize this in case someone needs +10K trees to follow them around. Multithreading is a good suggestion. Indeed, in my implementation I update based on movement and not time. I didn't include this because I felt ppl could easily rewrite that part.
@ryant2389
@ryant2389 10 месяцев назад
This is fantastic! So awesome to see practical implementation of lod and object instancing/culling in Godot. Thanks for demoing your process.
@makebreakrepeat
@makebreakrepeat 10 месяцев назад
I actually really appreciate the code deep dive. You're giving me lots of ideas and the confidence to code them in my own projects.
@GarmrNL
@GarmrNL 10 месяцев назад
I started playing with the 3D side of Godot a while ago and stumbled on your content while looking for terrain stuff. Went on a binge and subscribed; I really like the way you explain things and especially the “why” 😄
@squarerootof2
@squarerootof2 10 месяцев назад
The Tooth Ferry sounds creepy awesome. I'm sure it won't disappoint. I'll be waiting for that.
@aomadeira
@aomadeira 10 месяцев назад
Everytime you release a new video you convince people of how capable Godot is to make amazing and stunning games, your content is truly amazing! Thank you!
@rje613
@rje613 9 месяцев назад
Super useful content man. Love these videos, truly.
@SCP6820
@SCP6820 8 месяцев назад
i love how dark this game looks
@thFaust
@thFaust 10 месяцев назад
Great Video, man. I think the code explantation wasn't boring at all! I don't like watching people code live on stream or things like that, but a concise explanation like that, I'd watch any day of the week. :-)
@bertilorickardspelar
@bertilorickardspelar 10 месяцев назад
A big thank you for all the hard work. I've known that Godot will be big since 2017. It just needs a few more solutions in videos like this to truly reach its potential. If they get a marketplace for paid assets going that will really help. Oh, by the way. When you do things like this you should really setup a patreon or something similar so we can show some love.
@zikaura
@zikaura 10 месяцев назад
Babe wake up, devmar just dropped
@Alpha_GameDev-wq5cc
@Alpha_GameDev-wq5cc 10 месяцев назад
Love this tutorial-esque style, I’m learning UE5 but a total beginner so this is still so intriguing and educational!
@Thomas_Lo
@Thomas_Lo 10 месяцев назад
keep it at this detail level. people will wanna try to build something similar and may lack the understanding in certain parts to be able to do it.
@mbg4681
@mbg4681 10 месяцев назад
I've been following your project for two years. It's awesome to see it keep evolving and getting better! Keep up the awesome work! 👍
@Polygarden
@Polygarden 10 месяцев назад
Great tutorial and great use of Multimeshes! I'm actually wondering how much the load of multi meshes is, when you have lots of different tree, grass and stone instances. (if there is a trade-off point when it's better to use normal meshes instead of multimeshes) All in all it's probably much much less nodes with this method. I will be looking into this technique aswell.
@actualdevmar
@actualdevmar 10 месяцев назад
There is a tradeoff. If you want occasional trees (which you might, depending on your design) the it will be way more optimal to use individual meshes as you can then also benefit from geometry settings like autoLod or clipping/fading etc. If you look at the gameplay footage here I'm being accompanied by 625 trees total (chunked, so culled by frustum) for which it makes sense to use multimeshes. The scene in the thumbnail has 1225 trees. The other consideration is how tightly clustered your meshes are. If they're clumped together it's usually better to go with multimesh regardless of instance count. If they're dispersed, use a standard mesh.
@RaveYoda
@RaveYoda 10 месяцев назад
Love the code breakdown!! Edit: I wish you would breakdown how you do the IK stuff too as that has been challenging for me to get working right.
@bsangel1276
@bsangel1276 5 месяцев назад
im new to godot and i didnt understand a shit, but you make it look so easy, found this video beacause wanted to learn about MultiMeshInstance and found something even better, what i can understand is that somehow you save resources by only loading what you need, cool,
@generrosity
@generrosity 10 месяцев назад
If you enjoy doing this depth of video, keep doing it! Interesting topic - sparks ideas (and confirms some thoughts on gpu instances and multimesh) even tho I'm personally far far away from using them
@goldenbuster493
@goldenbuster493 10 месяцев назад
Found out about you 10 mins ago with the mower video, AND I'M INVESTED AS HECK
@Marandal
@Marandal 3 месяца назад
Oooo an epic tutorial on godot instancing
@errorhostnotfound1165
@errorhostnotfound1165 10 месяцев назад
Maybe he could make playlists for each of the different sets of videos (one for the main devlog, one for the tutorials, ones for the other devlog(s) series)
@neozoid7009
@neozoid7009 10 месяцев назад
I was soo hyped to watch your videos
@jakem6120
@jakem6120 10 месяцев назад
Heck yeah..thanks devmar...i wonder for the longest time when u will release this when i first saw ur videos... 🙏 Thanks
@aguest5394
@aguest5394 8 месяцев назад
mur godot awesome tutorials please and thank you!
@fafo_o
@fafo_o 10 месяцев назад
THANK YOU THIS IS COOL AF
@MangaGamified
@MangaGamified 10 месяцев назад
Really good example, As an enjoyer of Horror games channels like Coryxkenshin & Peenoiseplays , it got that horror puzzle game vibe. You should use more horror if not creepy themes, no one complains about the graphics of horror games.
@fridyrogide8752
@fridyrogide8752 10 месяцев назад
Really interesting technique ; quite advanced for a beginner like me hehehhehe
@TheSunriseGames
@TheSunriseGames 2 месяца назад
where are you? come back, it's been 7 months.. we need updates
@thesleepyfox3295
@thesleepyfox3295 10 месяцев назад
Hey, Devmar, been a big fan of your work since watching your wandering clipmap vid a year ago! One thing that's always perplexed me though is why you always use square grids for clipping. Don't you end up with a whole lot of wasted detail at the corners and detail-distance missmatch when looking along an edge towards a corner? I tried a more circular wandering mesh (while still using square cells if that makes sense) in blender and got much better results, just wondering if there is a reason you don't do something similar in Godot. Keep up the amazing work, you're a true inspiration! 👍
@cprn.
@cprn. 9 месяцев назад
Hmm. Am I correct into thinking the right approach to cutting trees then would be to use a second texture that marks where a player cut the tree so that the shader wouldn't spawn there? This way I could use a timer to modify that "don't-spawn-here" texture's pixels over time to reflect re-growing (i.e. scaling the particles). Or am I overthinking this? Also, yes, very useful content. Although, I'd prefer it in C# simply because I feel like it'd give a more CV-ready skill. It's not hard to write C# looking at GD, though. And I came here because the boss fight demo... Cool as f**k.
@envymak2254
@envymak2254 7 дней назад
We need a way longer and more detailed tutorial
@portalpony477
@portalpony477 4 месяца назад
13:36 One second longer video and it would be perfect
@somedude5951
@somedude5951 10 месяцев назад
Great video. Thank you.
@Inferryu
@Inferryu 10 месяцев назад
It is VERY usefull, thank you for it.
@andreasng
@andreasng 4 месяца назад
This is magic! 😢😢
@frogguygame
@frogguygame 10 месяцев назад
this is rad, it's almost exactly what I was trying to get out of some other addons/strategies. Is it ok to use this as a basis for my own project? Is it ok to use this as a basis for a more generalized/fleshed out addon? Credit will be given, of course.
@actualdevmar
@actualdevmar 10 месяцев назад
Sure
@ThotTee
@ThotTee 10 месяцев назад
If you write the multimesh packedarray data of positions, that is much faster than write the whole transform data with set_transform. The difference is a lot of fps.
@ThotTee
@ThotTee 10 месяцев назад
I created a new data array from the current data, and i modified the important datas in there. After this i put it back to multimesh once in the and of process. I just modified the position values. I didn't test it with scale or rotation. At 50k meshes i got 70 fps instead of 40 with this way.
@actualdevmar
@actualdevmar 10 месяцев назад
I tried this with data arrays but saw no benefit. You still have to create the arrays on each update so you can read back from them. Also you'd have to do it 3 times on each update to create arrays for pos, rot and scale. Those are extra steps which add up in the end.
@ThotTee
@ThotTee 10 месяцев назад
@@actualdevmar I didn't test that if i write the full of array (pos,rot,scale) that has a benefit. I just wrote positions. But you don't need read that array 3 times, i think. It's a matrix4 array. Just you need put the new values correctly once in every update.
@ThotTee
@ThotTee 10 месяцев назад
Maybe the reason of better performance was i wrote just the positions, and it is less oprations than set all values with set_transform. Idk.
@cjdaylight3407
@cjdaylight3407 5 месяцев назад
I wonder how you gonna implement produceal roads lakes and other things but I think this game already ready to go to steam
@noiJadisCailleach
@noiJadisCailleach 10 месяцев назад
Quick question: Why pastebin, and not github?
@yeroboersma4845
@yeroboersma4845 10 месяцев назад
i left a comment on the water lvl vid, its what i think could be a good boss and welp, that
@actualdevmar
@actualdevmar 10 месяцев назад
Im definitely doing a crab boss. It's been on my list for a while.
@Zurpanik
@Zurpanik 10 месяцев назад
Freaking rad!
@DodgerEcho
@DodgerEcho 10 месяцев назад
This super video 👍👍👍
@Carson.Rhodes
@Carson.Rhodes 10 месяцев назад
How come you use GD script instead of C#. Have you found any benefits of either with your "stress tests" of games, lol. Brilliant work! keep it up!
@ViktorsJournal
@ViktorsJournal 10 месяцев назад
Hi again, lovely to see another video. I'm curious, was this necessary? Godot has auto lod which you can tweak how quickly they swap, it also has frustum culling and distance cullling and such. Was all of that not helpul for this case?
@actualdevmar
@actualdevmar 10 месяцев назад
Techniques like this one are meant for scenarios where you have numerous geometries to render that share the same mesh. I mean numerous, as in hundreds or thousands or tens of thousands. Individual mesh nodes become suboptimal over, say, 50 (even with autolod and clipping, which is also quite taxing when you have too many meshes in your scene). In this showcase I have 1000+ trees. No way I'm laying them out manually and updating their positions every few frames.
@ViktorsJournal
@ViktorsJournal 10 месяцев назад
@@actualdevmar Don't things like terrain plugin and scatter and their equivalents in other engines work like that too, painting tons of trees and foliage and so on?
@actualdevmar
@actualdevmar 10 месяцев назад
@@ViktorsJournal short answer is no. This is a different technique.
@feidev
@feidev 10 месяцев назад
This is solid, do you have a discord?
@actualdevmar
@actualdevmar 10 месяцев назад
not yet
@feidev
@feidev 10 месяцев назад
Gotcha! Whenever you create, i will be there@@actualdevmar
@elchippe
@elchippe 10 месяцев назад
Wow and all made in GDScript, no C# or C++, GDScript.
@ITHINKTHTSDON
@ITHINKTHTSDON 3 месяца назад
Bro can you mentor me on Godot I’ve been using it for some weeks and don’t have any dev experience but I have been doin research but to no avail I have this huge game idea I have everything ready just can’t make it cuh idk what I’m doin in the game engine nor coding I truly believe my game will change the gaming industry TRULY!
@RexSacriticulus
@RexSacriticulus 10 месяцев назад
Evidently, you have attempted to make your video 13 minutes and 37 seconds long.
@wherearemypants2213
@wherearemypants2213 4 месяца назад
Been a while since your last upload. Hope you alright. Cheers
Далее
Optimizing my Game so it Runs on a Potato
19:02
Просмотров 564 тыс.
Moto Trial vs Moto acrobática 🏁
00:29
Просмотров 2,4 млн
A Minecraft Movie | Teaser
01:20
Просмотров 21 млн
Jiggle Physics in Godot
13:31
Просмотров 79 тыс.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
Просмотров 516 тыс.
Godot FINALLY Got Better Softbody
2:00
Просмотров 16 тыс.
Optimization Tutorial: OCCLUSION CULLING in Godot
8:29
10+1 INCREDIBLE addons for Godot 4
8:28
Просмотров 34 тыс.
I made Games with Python for 10 Years...
28:52
Просмотров 325 тыс.
MORE VFX Shader Techniques ft. Godot
8:43
Просмотров 24 тыс.