Remaking my game from scratch in an ECS with Rust and Bevy

Поділитися
Вставка
  • Опубліковано 17 вер 2022
  • I completely remade my game from scratch using rust and bevy in an ECS!
    No Music for this video because its more of an explanatory video also I'm trying something new. So let me know if you think there should be music in my future videos or not.
    Join my discord!:
    / discord
    Software used:
    Bevy: bevyengine.org
    VScode:code.visualstudio.com
    Blender:www.blender.org
    Adobe premiere pro: visualstudio.microsoft.com/
    OBS studio: obsproject.com/
    Audacity: www.audacityteam.org/
    If you liked this video here are some youtubers who i like to watch and am inspired by:
    Dani: / danidev
    Makes entertaining and fun videos is making an fps called karlson!
    Cherno: / thechernopr. .
    Really good videos and tutorials about graphics programming mostly.
    PolyMars: / polymars .
    Enjoys learning lots of frameworks which is his main focus.
    Barji: ua-cam.com/channels/z3l.html...
    Has a lot of interesting gamedev challenges on his youtube.
  • Наука та технологія

КОМЕНТАРІ • 63

  • @bipedpotato
    @bipedpotato  Рік тому +14

    let me know if u guys think i should make videos without music or with music im trying out without music at the moment and i want to know ur thoughts about it.

    • @omdangy
      @omdangy Рік тому +7

      No need for music. Voice quality could be better though!

    • @Temak11233
      @Temak11233 Рік тому +5

      No music please!

    • @perc-ai
      @perc-ai Рік тому

      Low music

    • @_creare_2742
      @_creare_2742 Рік тому +2

      I think some quiet background music would be good

    • @sillanrakentaja
      @sillanrakentaja Рік тому +2

      No music, for me at least the content speaks for itself 🙏

  • @hakler
    @hakler Рік тому +78

    I would recomend using a profiler to see what's actually tanking your fps before just giving up on for exaple quadtrees. Though I think spacial hashing would be a better fit for you in this case.

    • @bipedpotato
      @bipedpotato  Рік тому +8

      ye i probably should have used a profiler because quadtrees in theory should be able to make it so much faster lol.

    • @moonshinetheleocat1235
      @moonshinetheleocat1235 Рік тому +24

      Doesn't really surprise me too much.
      DICE ran into a similar issue when designing one of the battlefield games. They realized later on that brute forcing the array was actually faster than the quad tree till they reached a certain threshold.
      Instead of implementing a quad tree, which they found out the speed loss was primarily pointer hopping. They did spatial hashing where entity data that could potentially collide were put into buckets that were just arrays
      What they found out was that processors have gotten a lot faster. But memory hasn't. And bouncing on pointers isn't good

    • @ParanoicoBR
      @ParanoicoBR Рік тому +7

      @bipedpotato7610 I'm not 100% sure, but it seems the performance of the quadtree might be worse because of cpu cache misses, which occur more often on sparse datastructures.
      When you use arrays instead, the data is packed more tightly together which usually reduces the number os caches misses - one of the main aggressors for perfomance degradation on modern cpus.
      Just food for thought: you could get even better performance with quadtree using memory arenas or another memory allocation strategy to pack the quadtree nodes more tightly together - possibly reducing cache misses. I cant even imagine how painful it would be to implement it tho lol

  • @laundmo
    @laundmo Рік тому +65

    re: spatial partitioning, I'm the author of bevy_spatial which uses kd-trees or r*-trees for spatial partitioning and lets you do efficient k-nearest-neighbour queries on your entities. I've mostly tested it with single/few queries on large amounts of entities, and in examples i'm able to reach 40K moving entities before dropping below 144hz, with it re-creating the kd-tree every frame.
    there's definitely some work to be done on the crate, for example detaching the calculations from bevy's main loop, but so far I'm happy with what it provides.

    • @bipedpotato
      @bipedpotato  Рік тому +12

      Never actually looked into bevy_spatial maybe i will integrate it into the game in the near future.

  • @mfyoutube5003
    @mfyoutube5003 Рік тому +3

    wow thank you very much for this video!! you motivated me
    cheers from France

  • @johanhellberg9677
    @johanhellberg9677 6 місяців тому +1

    Awesome! Cool work on the game

  • @Ducaluk
    @Ducaluk Рік тому +7

    Nice work, really cool. There are almost no one making rts games in any framework, good luck !

  • @gospher6342
    @gospher6342 Рік тому +3

    Keep it going my dude

  • @jupitersky
    @jupitersky Рік тому +3

    "As I was concerned for their health"
    Now I'm worried for _my_ health with how hard this made me laugh... xD
    Earned a well deserved sub that joke did.

  • @gamerboy3443
    @gamerboy3443 Рік тому +1

    Very nice information Sir

  • @olegcharnyshevich1127
    @olegcharnyshevich1127 Рік тому +1

    Awesome

  • @Spenito
    @Spenito Рік тому +1

    What is your editor theme and is it available for Neovim?
    Also awesome video, I've tinkered with Rust off and on but never really got too into it. I kinda wanna try this out for my next project though,

    • @bipedpotato
      @bipedpotato  Рік тому

      Its called the synthwave theme for vscode. I dont know if it is available for neo vim but if u use it for vscode it might corrupt rust analyzer.

  • @ProPlayer-fm4hb
    @ProPlayer-fm4hb Рік тому +1

    Noice m8

  • @recarsion
    @recarsion Рік тому +2

    Hey, great vid! How are you doing the target selection in this game? I'm trying to make some kind of RTS prototype in bevy myself but I'm already having trouble with translating the screen position of a click into a world position on the ground. I know I need to do raycasting, I've been looking into bevy_mod_picking and bevy_mod_raycast but the examples don't really show anything like this and the docs are not very helpful either.

    • @bipedpotato
      @bipedpotato  Рік тому +1

      Ive been using bevy_mod_raycast for this if i remember correctly one of the examples mouse_intersection? I think shows how you can enable the mouse to raycast onto objects. I used a plane to raycast giving me two points which i form into a square area which the objects that are inside will be selected/

    • @recarsion
      @recarsion Рік тому

      @@bipedpotato thanks, I'll take a look at that, if I remember I'll give an update what worked so others can learn from it too

  • @sebastiantoulier5956
    @sebastiantoulier5956 Рік тому

    In the setup, appreciate the videos! Maybe a dumb question but is there a way to export content in mono in soft20?

  • @workflowinmind
    @workflowinmind Рік тому

    Out of topic sorry but what is that Windows theme?

  • @benx011
    @benx011 Рік тому +9

    very nice, but i think you should lower their hp. music would help but the trick is to make it unnoticeable, most mistake ppl make is having them too loud

    • @bipedpotato
      @bipedpotato  Рік тому

      thx this was just me testing out if no music is better than my last few videos with music. I will try to make it unoticable but can u check them out and tell me if the audio is right?

    • @benx011
      @benx011 Рік тому

      @@bipedpotato btw im an editor (u can check my yt) so im kind of experienced with that kind of stuff if u want some help lmk

  • @RBimas37
    @RBimas37 Рік тому

    Did you finish the remake?

  • @sonroku4195
    @sonroku4195 Рік тому +1

    danke mi man

  • @hpw-dev
    @hpw-dev Рік тому +1

    хороший видос

  • @magellan124
    @magellan124 Рік тому +1

    dude you're fucking smart

  • @Milk-yi9hg
    @Milk-yi9hg Рік тому +1

    Hey this would be a really cool video try rewriting your c++ game engine in rust with Bevy or OpenGL.

    • @skidodleman6669
      @skidodleman6669 Рік тому +3

      Bevy is a game engine

    • @Milk-yi9hg
      @Milk-yi9hg Рік тому

      @@skidodleman6669 yes but his has a visual editor and bevy could still be used for making a game engine anyway.

    • @skidodleman6669
      @skidodleman6669 Рік тому +4

      @@Milk-yi9hg but why would you use a game engine to create another game engine??? That makes zero sense

    • @Milk-yi9hg
      @Milk-yi9hg Рік тому

      @@skidodleman6669 What is the difference between an engine and a framework?

    • @Milk-yi9hg
      @Milk-yi9hg Рік тому

      @@skidodleman6669 ok

  • @Drezaem55
    @Drezaem55 Рік тому +1

    Oh man, those things look like evil furbies. What is the boids stuff doing now? It feels like you started out with that but apart from avoiding eachother they seem to all just beeline to the target.
    I know you asked about music: I feel like with your current microphone the sound quality of your voice isn't good enougd for a distraction like music.
    Another bit of feedback: when showing us what happens in the game: put it fullscreen, the outline of your editor isn't usefull, it's taking up space and the terminal scrolling is distracting.

    • @bipedpotato
      @bipedpotato  Рік тому +2

      So i’ve pretty much tuned down the boids system so much that the only really noticeable component of it is seperation. I might add it in again if i feel like it is worth it. Also im getting a new mic soon so the sound quality will be much better. I might go into fullscreen when i show things next time but i feel like seeing the code a bit is slightly interesting for programmers who can see how some things are done in fragments.

  • @nickgennady
    @nickgennady Рік тому +4

    How many entities can you have max? I got custom ECS I made for unreal and it can handle 1 million entities with basic logic. Unity ECS not as optimized as it could be so I’m afraid bevy could be the same

    • @bipedpotato
      @bipedpotato  Рік тому +2

      Well i can only handle like 100000 at like 5 fps given i need to test for collision,attacks,flocking, and graphics take up lots of performance. Im sure you can run a benchmark on bevy without any graphics with only entities and just spawn like a shitton of them and test for fps. Bevy is really performant and can probably handle slightly more if you haven’t taken lots of time into optimizing your custom ecs.

    • @alexandrbromles8658
      @alexandrbromles8658 8 місяців тому +2

      bevy maintains 40fps WHILE generating a map with 6.5 millions tiles, where every single tile is an Entity with Components, on 5 years old i5. I think it is pretty impressive for 0.11 version
      Also I saw the guy that is making Rimworld clone, but with thousands of NPCs, on bevy. He said that the same implementation gave him 100fps with Godot and 900 fps with Bevy (and that's the reason behind going with it)

    • @nickgennady
      @nickgennady 8 місяців тому +2

      @@alexandrbromles8658 thanks for sharing. That’s impressive. I’m keeping my eye on Bevy for sure.

  • @MasterBroNetwork
    @MasterBroNetwork 7 місяців тому +1

    I tried Bevy ECS but I just couldn't get it, Rust overall has a rather strange syntax honestly, My biggest issue was being unable to directly pass parameters into functions like usual, Resources were also really weird to access. (Example: res_mut)

    • @bipedpotato
      @bipedpotato  7 місяців тому

      yeah ecs did seem a bit alien to me when i first tried it, although bevy wasn't the first ecs i used it felt a lot better than the other ones that i used previously which was a big part of why i use Bevy so much.

    • @MasterBroNetwork
      @MasterBroNetwork 7 місяців тому

      @@bipedpotato It wasn't so much ECS for me as much as it was actually trying to access values in the world itself.

    • @bipedpotato
      @bipedpotato  7 місяців тому +1

      i would argue that this within the bounds of ECS but i can totally understand the difficulties that you encountered.

  • @TheGreatProphecy
    @TheGreatProphecy Рік тому +3

    this man said they are red and blue... I see red and Grey.. Are you colorblind, or am I?

  • @tomtravis858
    @tomtravis858 6 місяців тому

    Projects that change technologies tend to fail, stick with something, implementation is way more important than programming language.

  • @carrapaz3645
    @carrapaz3645 Рік тому +4

    U colorblind? That's not red.
    Anyway good tutorial

    • @bipedpotato
      @bipedpotato  Рік тому

      Lol i forgot i changed the color theme

  • @satyajitpattnayak7307
    @satyajitpattnayak7307 Рік тому +1

    How long does it take to learn soft?