Making a large Battle Simulator game with Bevy and Rust

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • #gamedev #rustlang #bevy
    Have you ever wondered how games like Ultimate Epic Battle Simulator are able to have millions of units on screen while running at a relatively fine FPS? Well in this video, I built on one of my previous videos "Remaking my game from scratch in an ECS with Rust and Bevy" where I attempted to create a battle simulator like UEBS. I wasn't very successful in the previous video but by the end of the video, using my newly learned skills in Bevy and Rust, I was able to develop a project that runs at a steady 100+ FPS when having 20k tanks duking it out on the big field. In this video I show you some useful optimizations when attempting to make a battle simulator game such as spatial partitioning through Quadtrees and rendering optimizations using custom render pipeline Shader Instancing with WebGPU and wgsl. I was no where near getting millions of units on screen but I'm pretty happy with this project as a whole! If you like the video make sure to drop a like and subscribe.
    Making a large Battle Simulator game with Bevy and Rust
    Join my discord!:
    / discord
    Time Stamps:
    Intro - 0:00
    Where we left off... - 1:30
    Spatial Partitioning through Quadtrees - 2:30
    Explanation of Shader Instancing and tank 3d Model Timelapse - 4:30
    How to actually perform Shader instancing - 5:30
    Intro to unit combat implementation - 7:41
    How to partition quadtree to find potential Combatants - 8:53
    Glossing over how much I struggled to implement Combat - 10:58
    Outro - 11:07
    Music Used:
    Chill Wave by Kevin MacLeod
    Heroic Age by Kevin Macleod
    ♪ Marshmellow (Prod. by Lukrembo)
    Link : • lukrembo - marshmallow...
    ♪ Biscuit (Prod. by Lukrembo)
    Link : • (no copyright music) l...
    ♪ Onion (Prod. by Lukrembo)
    Link : • (no copyright music) l...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 19

  • @bipedpotato
    @bipedpotato  3 หลายเดือนก่อน +5

    Subscribe for a "consistent" upload schedule, also I'm aware that this video doesn't have the most elegant explanations, and I guess youtube compression really dislikes this video as well I just wanted to get it out as soon as possible so we don't reach 4 months without uploading.

  • @vitasartemiev
    @vitasartemiev หลายเดือนก่อน +3

    There is a crate called bevy-spatial. It provides kd-trees that track marked entities as a resource. It supports fast lookups within a radius, nearest neighbor lookups and axis-aligned rectangle lookups (see pull request). It may help you outright or inspire you for your own version.

  • @morkallearns781
    @morkallearns781 3 หลายเดือนก่อน +2

    I've been making grass and am hitting a hard performance bottleneck, so I was thinking about trying a custom render pipeline to implement instancing as well. Fixed update might also be useful. Really cool stuff! Definitely relate to the "messy and inefficient" part, probably will have to rewrite it once I get all the pieces of my game working (gameplay tbd, but building a huge procedurally generated open world).

  • @peterhayman
    @peterhayman หลายเดือนก่อน

    thanks for sharing! traversing quad trees sounds super interesting

  • @itzhakeretzkdosha6875
    @itzhakeretzkdosha6875 3 หลายเดือนก่อน +4

    Great video! It would be nice if you explained the last part where you add shooting with some code and drawings

    • @bipedpotato
      @bipedpotato  3 หลายเดือนก่อน

      Yeah you are right but the video was getting a bit long, perhaps in another video further down the line?

  • @darknetworld
    @darknetworld 3 หลายเดือนก่อน +3

    That so cool. I bet it not easy to run smooth for many units in game.

    • @bipedpotato
      @bipedpotato  3 หลายเดือนก่อน

      yeah it was pretty complicated and I’ve only reached the surface of full potential battle simulators like UEBS that can simulate millions of units ON TERRAIN AND WITH ANIMATION without that much lag.

  • @bonesai-dev
    @bonesai-dev 3 หลายเดือนก่อน +2

    This is really awesome

  • @thedevblog5916
    @thedevblog5916 หลายเดือนก่อน

    Super cool! Sorry if I missed it, but are you using a custom physics engine? Or are you using a crate?

    • @bipedpotato
      @bipedpotato  หลายเดือนก่อน +1

      its just a simple separation check which is made more performant through a spatial partitioning system through a quadtree. I didn’t use any crates.

  • @GonziHere
    @GonziHere 3 หลายเดือนก่อน +1

    Nice, btw is it fully deterministic?

    • @bipedpotato
      @bipedpotato  3 หลายเดือนก่อน

      So i would like it to be but as you can probably tell from the last segment of the video, one side should not win by so much with equal units. The combat system is a really hacky system that I whipped up last minute so I didn’t really expect much either. Other than that the rest of the game should be completely deterministic as Its run on a fixed update.

  • @nihil75
    @nihil75 3 หลายเดือนก่อน +2

    umm.. I think Bevy 0.12 already does batching & instancing for you without a custom shader?
    I can render 6.5 million blades of grass with:
    var model = mesh_functions::get_model_matrix(vertex.instance_index);
    (I did not define instance_index myself. it's built in to the vertex input)

    • @bipedpotato
      @bipedpotato  3 หลายเดือนก่อน +3

      this way i have more control and can remove features that I deem to be useless to my project, also I did not know that instancing was already built into bevy and didn’t want to test it out.

  • @spindlywebs
    @spindlywebs หลายเดือนก่อน

    always happy to see non ai gamedev vids :D

  • @JoMaFjErynMaLaZOr
    @JoMaFjErynMaLaZOr 3 หลายเดือนก่อน +2

    I like

  • @LivanariLivanari
    @LivanariLivanari 5 วันที่ผ่านมา

    video is too hard to understand