Make Your Own Vampire Survivors-Like in Unity (No DOTS)

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 50

  • @ZiberianDev
    @ZiberianDev  11 месяцев назад +9

    SOURCE CODE FOR RELEVANT FILES ARE IN THIS COMMENT & IN THE DESCRIPTION:
    After popular request I am sharing the source code for this project, now you have to subscribe and watch all of my videos :) You can start with this one where I trained AI agents in Unity to try to make money by "gaming" a system: ruclips.net/video/jWvXqwBYaAs/видео.html
    NOTE: It has been 6 months since I looked at this project and these scripts aren't necessarily ready to be shared, if anything doesn't work don't be mad.
    • GameContoller.cs: codefile.io/f/7EpfZg0mLI
    • CharacterController.cs codefile.io/f/bNZb3uRBaE
    • Bullet.cs codefile.io/f/NRkVW7KxDw
    • Enemy.cs codefile.io/f/aXst2i6oD9
    • Utils.cs codefile.io/f/F9teP3dpTe

  • @jaaferelsadig
    @jaaferelsadig 10 месяцев назад +4

    Great video, I love learning the logic behind solving these kinds of problems, thank you!

  • @91tj
    @91tj 4 дня назад

    I liked, I subbed and now it's time to try this! I hope it works for me haha
    Merry xmas and a happy new year!

  • @IdealIdleIncremental
    @IdealIdleIncremental 10 месяцев назад +8

    It's strange that your channel has so few subscribers. The depth and quality of the content are outstanding. Subscribed! Looking forward to more videos like this.

    • @Illusionaire1
      @Illusionaire1 3 месяца назад

      I think the issue is that at least for me, I would prefer if the code was explained while being typed. Instead of "Here is the code! It just works!. I'm ultra interested in this theme, but would prefer a deeper explanation with also showcasing how the code was really made, what choices were made etc... not just "here!"

  • @rashidfarhan6223
    @rashidfarhan6223 7 месяцев назад +4

    i tested it and it works!
    spoken like a true game developer sir!

  • @shonsomech7839
    @shonsomech7839 9 месяцев назад +4

    first of all ty for this amazing video and can i get this project that you made here to see how all this combine into one? i got kinda lost while trying to make it work for me

  • @rukinohi
    @rukinohi 7 месяцев назад +5

    Very nice tutorial, however, did you figure out how to move the enemies smoothly? Currently they jitter a lot, as they only move every Xth of a second.

  • @XenocraftGalaxy
    @XenocraftGalaxy 11 месяцев назад +6

    What is this place?
    I don't know.
    Do I understand the things appearing on my screen?
    No.
    Why am I here?
    The almighty algorithm has sent me.
    And what a wonderful place I have been sent.
    And now I shall attempt to appease the almighty algorithm, so that others too may experience this joy.

  • @yyvan5125
    @yyvan5125 4 месяца назад

    Very good video, nicely explained!

  • @de0o0
    @de0o0 10 месяцев назад

    I assume that the code choose the enemy randomly from spatialgroup right? So if we for example have 2 enemies in spatial group that will meet distance requirement it just choose first one in the list right?

  • @ComfortZoneGames
    @ComfortZoneGames 10 месяцев назад

    Smart approach. Thanks for the video, but may I ask this: Aren't you just "exchanging" low FPS for high FPS but with enemies moving at even lower FPS? Or didn't I get it right?

    • @ZiberianDev
      @ZiberianDev  10 месяцев назад +1

      With some of the optimizations thats true, but there are still other ones (like the spatial one) that still optimizes without sacrificing FPS.

  • @RaidenHeaven
    @RaidenHeaven 11 месяцев назад +1

    So after you get a the list of the enemies in the Partition (or neighbor Partitions) you check the projectile distance from the enemies?
    What about the enemy who is big enough to get inside in the other Partitions?
    Does an enemy exists in multiple partitions because of the size?

    • @ZiberianDev
      @ZiberianDev  11 месяцев назад

      That is a good point that I didn't talk about. Basically every bullet and enemy has a radius so if a bullet is 0.2 wide, enemy is 0.5 wide, that means if their distance (center to center) is 0.7 or less, they are touching.
      In terms of even "considering" the enemies, that is indeed a limitation in my current setup. If there is a really large enemy where its arm is on a partition that might not be considered by the bullet. But here are two solutions:
      1. Keep track of largest enemy on the map currently in the GameController so every bullet considers that added range when checking partitions.
      2. I think an even better solution is: If you have a lot of big enemies, or large variety in size, you should increase your partition size. If most of your enemies say span a 3x3 box, you should increase your partition size to be a 3x3 box, instead of using 9x 1x1 boxes in a square arrangement. I hope that makes sense.

    • @RaidenHeaven
      @RaidenHeaven 11 месяцев назад

      @@ZiberianDev Thanks for replying!!!

    • @ZiberianDev
      @ZiberianDev  11 месяцев назад +1

      Yeah the GameController is a singleton that manages which enemies get updated (I show that part in the video). It picks based on the batches. So basically there are 50 frames a second, and every frame 1/50th of the enemies update.
      For your 3rd option, yes, definitely different solutions could also work. Very flexible depending on the game & your needs.

    • @kplays_6000
      @kplays_6000 11 месяцев назад +1

      @@ZiberianDev The one thing that throws me off about spatial partitioning is that even if your partition sizes are big enough to fit your largest enemy, that one large enemy is still going to move *gradually* between partitions. You'll always have a situation where an enemy can be between and in two partitions

    • @XenocraftGalaxy
      @XenocraftGalaxy 11 месяцев назад +1

      @@kplays_6000 Ziberian covered that in the video.
      That you can account for this by checking nearby partitions, like a 3x3 grid around the monster, or if it is an incredibly large enemy, you can hard code it.
      In a more dynamic or variable equation (2+s) * (2+s). Where s is the size of the enemy.
      So, if a normal enemy is 1x1, it will check a 3x3 area. 3x3 enemy? 5x5. etc and so on.

  • @SpaceGoatboy
    @SpaceGoatboy 7 месяцев назад

    Thank you! great video!

  • @NnaNac-hu3iv
    @NnaNac-hu3iv 2 месяца назад +1

    if the map has obstacles, how to move enemy around it?

    • @ZiberianDev
      @ZiberianDev  2 месяца назад +1

      That is a challenging problem, but I believe in VS you just add a bit of randomization to their direction so they just "move around" the block, you don't deal with calculating the path around the block etc. Make sure there is no friction either, so that they can just slide by it.

  • @kplays_6000
    @kplays_6000 11 месяцев назад

    Would it be better in your sorted set to rather than sort every single batch, keep track of which scores change and move them in the set accordingly? That way you don't have to sort the entire list and can just move around the ones that need moving

  • @domenos8967
    @domenos8967 6 месяцев назад

    Thanks! But how much cost List.Remove operation? Will Unity move rest elements (tail) by one to beginning of the list?

  • @shinkouhai919
    @shinkouhai919 7 месяцев назад

    this a good tutorial, I usually just slam a box trigger collider to make in the list of the enemy. if enemy got in, add to the list, if enemy out, delete from the list. lol

  • @revimfadli4666
    @revimfadli4666 11 месяцев назад +1

    I thought unity already implemented this haha
    Did you also use dots?

    • @ZiberianDev
      @ZiberianDev  11 месяцев назад +2

      Initially I had "No DOTS" in the title but I thought people that didn't know what that is would be confused. But yeah, this solution has no DOTS, just plain Unity :)

    • @revimfadli4666
      @revimfadli4666 11 месяцев назад

      ​@@ZiberianDevok that's a rather huge speed-up, let alone with jobs and dots....
      I wonder if you can upscale the bacteria simulation with that...

  • @zivv1847
    @zivv1847 8 месяцев назад

    很棒的视频,视频的前半部分我跟你的思路是一样的,但是我没有去验证这个方法可不可行,因为我下周就要交付工作了,谢谢你帮我验证了这个方法是可行的并且很感谢提供了视频后半部分的思路

  • @OskGame
    @OskGame 8 месяцев назад +2

    OMG, I want to make a Survivor game and performance is a huge limitation without using DOTS, watching your video I'm impressed if you can share the source code, I really appreciate your work. your current job!

  • @ThanhNguyen-po7zy
    @ThanhNguyen-po7zy 9 месяцев назад

    I wonder if the physic layer in Unity will help in this case. By saying no collision between enemy, using collision trigger tom reduce the work. Does this help? never try with a lot of object like this game. But thanks for the tutorial, somehow I think this is better solution.

  • @lining-wp9so
    @lining-wp9so 7 месяцев назад

    I am developing RTS game 400 units vs 400 units, can you suggest me an optimal approach?

  • @JackBauerDev
    @JackBauerDev 3 месяца назад

    Would dots be better? Why not use dots?

  • @NeuralSensei
    @NeuralSensei 2 месяца назад

    im interested in adapting this for godot maybe this code is understandable enough. its physics seems to have the same drawbacks mainly relying on CPU, I am disappointed we don't just have gpu physics for everything in 2024. Ive done enough research to know other methods than bathcing won't make orders of magnitude difference and my physics process is the culprit of the massive lag with just 300 enemies on a damn intel Q6600. someone on more modern HW would not care to optimize the game still in early alpha.

  • @Zicrus
    @Zicrus 11 месяцев назад +7

    You could also just do everything on the GPU, which would probably be enough by itself

  • @boynet2
    @boynet2 10 месяцев назад

    thanks, is there a reason not to use dots?

    • @dreamcatforgotten8435
      @dreamcatforgotten8435 8 месяцев назад +3

      I think Jobs and Burst are reasonable to use for such a game.
      ECS would be better, but then the code-maintenance and expansion, as well as integration of Managed Assets/etc, will be more difficult.

  • @onigumo
    @onigumo 6 месяцев назад

    but what about on mobile

  • @sobalsoft
    @sobalsoft 11 месяцев назад +1

    So uh... where is this actual solution? :D

    • @ZiberianDev
      @ZiberianDev  11 месяцев назад +5

      Its at 00:00 - 06:28

    • @sobalsoft
      @sobalsoft 11 месяцев назад

      @@ZiberianDev oh gotcha, thought there was source code somewhere

    • @NadjibBait
      @NadjibBait 8 месяцев назад

      @@ZiberianDev Hmm can't find the solution, my RUclips says the video is 6:27 length, so I presume it's in the last second I don't have access to???