Create a grid in Unity - Perfect for tactics or turn-based games! Part 2

Add functionality to the grid we made last video. Randomize tiles, spawning units, game flow and taking turns.
This is a long video... I originally aimed for it to be nice and quick, but ended up being an unadulterated glimpse into the mind of a game dev. So enjoy!
Perfect for any tactics or turn-based game.
Take a shot for every time I mess up BaseUnit!
Part 1: • Create a grid in Unity...
Project Files: bit.ly/2TXh4Na
Scripts: bit.ly/3hWmK1Y
❤️ Become a Tarobro on Patreon: / tarodev
=========
🔔 SUBSCRIBE: bit.ly/3eqG1Z6
🗨️ DISCORD: / discord
✅ MORE TUTORIALS: / tarodev
0:00 What we'll make
0:34 Unique tiles and tile logic
7:53 Adding a game manager
9:28 Spawning units
29:25 Player turn - Moving/Attacking
43:40 Showing tile & unit info on a canvas

Пікірлер: 260

  • @Tarodev
    @Tarodev2 жыл бұрын

    Did you enjoy the video? *Let me know* so I can continue making helpful content!

  • @olivercromwell1967

    @olivercromwell1967

    2 жыл бұрын

    hell yea

  • @oscarlundin3842

    @oscarlundin3842

    2 жыл бұрын

    Yes, I wanna see how this could be used with either designed maps or if instead of a separate grid, could this be based on the unity grid so it's easy to paint tiles? could collision boxes be translated to in walkable somehow?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@oscarlundin3842 The unity tilemap system is great... for some things. For example if you want to generate a simple map with no complex logic, it's fine. If you need interaction between tiles or to perform special logic, you'll need to generate your own grid. Example: If you wanted a pressure plate tile which opens a door tile... you cannot do this easily using unity tilemaps. Also, depending on the game, it may be better to have randomly generated (procedural) maps, or it might be better to make your own level editor to make hand crafted. A basic rule of thumb is: procedural is good for rapid development, hand crafted is better for user experience.

  • @SaoHayabusa

    @SaoHayabusa

    2 жыл бұрын

    Great Work! I really like this topic, can u make a movement system with a* algorithm or a blattle system like Fire Emblem series?? 😁

  • @HaikunWasTaken

    @HaikunWasTaken

    2 жыл бұрын

    Hey Tarodev, really great Video. I feel your pain when it comes to creating Singletons. Something that I do is to create a Singleton class (there are examples online) and let my managers inherit from that class like this: public class GameManager : Singleton. That way I only need half a line of Code to create another Singleton whenever I need it.

  • @DanDarger
    @DanDarger2 жыл бұрын

    Dev tutorial videos don't get nearly as much love as they deserve. You are a great tutor and I really appreciate your content. Wanted you to know you're making a difference. Thank you!

  • @HawaiiGuyHman
    @HawaiiGuyHman13 сағат бұрын

    I know this is an old video. I am a game dev major and needed the refresher and i really appreciated the video. you have not only refreshed my memory but also show me a lot of new ways and paths that i can take as well as cool unity tricks i will be watching more videos from you hoping to improve my coding skills as well as unity knowlage my only suggestion would be maybe to go a little slower if possible. as well as a more Indepth rundown of your reasoning/Logic sometimes i find myself lost with the video or the logic/route you decide to take

  • @tobiaslasco2297
    @tobiaslasco22972 жыл бұрын

    This is a classic case of criminally undersubscribed. Thanks for the quality content mate.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    I'm glad you enjoyed it 😊

  • @andrewmalkasian6575
    @andrewmalkasian65753 ай бұрын

    I never subscribe to people (usually). This guy is him. Make it easy to understand why I'm taking those extra steps to keep things organized

  • @Tarodev

    @Tarodev

    3 ай бұрын

    I'm that guy? I appreciate it brother 🙏

  • @LuizMoratelli
    @LuizMoratelli2 жыл бұрын

    I was just looking away from gamedev content and get this videos, is so perfect, have a lot of concepts em good practices, I would love to see more "mini-projects" like this.

  • @qiangpanchen6785
    @qiangpanchen67852 жыл бұрын

    This video is really good, even it's fairly long and complex but with close following it, I didn't encounter any error along the way, and the end result was pretty much as good as expected! So cool, and thank you for sharing this!

  • @Brovadio
    @Brovadio Жыл бұрын

    you're doing greatwork Taro, thank you

  • @callmefox630
    @callmefox6302 жыл бұрын

    Hello! I'm a aspiring indie game developer, and I think it would be really useful to see a follow-up video about grid-based pathfinding systems. I personally found it quite difficult to manage to write a pathfinding system for a grid.

  • @SilverStarStudios

    @SilverStarStudios

    10 ай бұрын

    Use astar

  • @JW-uu9je
    @JW-uu9je9 ай бұрын

    This longer video was great, thank you kindly. I'm going to have to go review the code now that I've got it working to see all the neat things you did!

  • @devdoly
    @devdoly2 жыл бұрын

    I don't usually comment, but your channel is going to huge!! Thanks for teaching us!

  • @windup247
    @windup2472 жыл бұрын

    This was an excellent intermediate/more advanced tutorial for Unity, a gem since such videos are hard to find on KZread! It brought together a lot of disparate concepts I've been picking up throughout my journey learning C# and Unity, and showed how to apply them in a useful scenario that doesn't get addressed enough (tile based strategy games). I'm sorry about your neighbors. Maybe one day they'll pick up this Unity tutorial randomly and have an epiphany!

  • @blondon99
    @blondon99 Жыл бұрын

    Thanks for the video. I'm really struggling with the big picture of how to organize projects. Stuff like this really helps and I appreciate it. Great stuff

  • @HYPERMUSH64
    @HYPERMUSH642 жыл бұрын

    What a fantastic tutorial. Super useful!

  • @haidendra5884
    @haidendra5884 Жыл бұрын

    I have been meaning to do a tactics dungeon crawler for awhile and even though I am doing mine in 3d this series really helped me jumpstart my game play mechanics

  • @AnatoleRoulet
    @AnatoleRoulet24 күн бұрын

    Fantastic tutorial, thanks ! Helped me doing tons of things i did not found in many many other tutorials (Most of the time they were skiping 'easy' part, which is not when you don't know how to do it :/ ). It is very complete and i would recommend it to anyone who wants to try to do a game :DD PS: 2 issue i had, check in files of the video for Imports and for the Canvas part, you need to press Alt to change position

  • @PS3HASNOGAMES
    @PS3HASNOGAMES2 жыл бұрын

    Cheers for this, this tutorial actually got me closer to where I'm trying to get. Would love to see a tutorial from you more specifically on an isometric tactical RPG such as Final Fantasy Tactics and etc. Thanks again.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Glad it helped you. I do have plans to do a video on a few example grid types, such as isometric.

  • @mrkulade
    @mrkulade2 жыл бұрын

    This series has been exactly what I needed for where I'm at. Thanks very much!

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    No problem bud! Glad it helped you out

  • @VinciWare
    @VinciWare10 ай бұрын

    Your videos are immensely helpful. Subscribed!

  • @AppaYipYipBro
    @AppaYipYipBro2 жыл бұрын

    Thank you for the tutorial!

  • @oyaguni961
    @oyaguni9612 жыл бұрын

    7:18 Nice played there. Thanks for the content, really useful!

  • @sewerynprobierz5618
    @sewerynprobierz5618 Жыл бұрын

    Oh Man I am subscribing right away. Thank you for this great stuff

  • @slava_bro
    @slava_bro3 ай бұрын

    Thank you for such an informative video. Keep making videos like this!

  • @Kaeru-
    @Kaeru-6 ай бұрын

    I lost my head on that "shuffle them around" @ 19:17.

  • @bunggo9914
    @bunggo9914 Жыл бұрын

    this is so awesome, actually. very helpful

  • @brunomena339
    @brunomena3392 жыл бұрын

    Man you rock! i can see you are very knowledgeable, nice video.

  • @ericdundas9768
    @ericdundas97682 жыл бұрын

    very helpful tutorial, thank you very much

  • @notagamedev5494
    @notagamedev5494 Жыл бұрын

    This is awesome video includes many concepts.🏅

  • @Reid_Spreiter
    @Reid_Spreiter2 ай бұрын

    This is fantastic

  • @uzgamedev
    @uzgamedevАй бұрын

    I like your teaching approach, thanks for the good video

  • @LION303200
    @LION3032002 жыл бұрын

    Amazing video. it has a lot of information, like bools and many lambda where it is explained very nicely and many of functions shows many information. keep going 👍👍

  • @canulasli7232
    @canulasli7232 Жыл бұрын

    Greetings from Turkey, Gaziantep. I adapted this system to my chess game. This video series about grid was very informative, I also inspired to make a new turn based game. Thanks, just suscribed. :)

  • @matthewmathis62
    @matthewmathis622 жыл бұрын

    lol. "Cool Bananas" I have heard "Cool Beans", and someone I knew used to say it a lot. I don't know if I've heard "Cool Bananas" before, but I like it! Every time you say that it reminds me of good memories. Thanks for this tutorial! I followed it well. *holds up lightsaber* ;)

  • @stackflow4007
    @stackflow40077 ай бұрын

    Great work bro, ! thanks

  • @htetwaiyanaung8114
    @htetwaiyanaung81142 жыл бұрын

    Thank you for the great video

  • @rashidfarhan6223
    @rashidfarhan62232 жыл бұрын

    put on watch later :D gotta watch it after work

  • @elliotelliot3475
    @elliotelliot34752 жыл бұрын

    I don't know why but that subscribe plug caught me so off guard that was one of the funniest things I've seen all week

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    But... did it make you subscribe? :P

  • @elliotelliot3475

    @elliotelliot3475

    2 жыл бұрын

    @@Tarodev yeah, I’ve been working on this project all week and if I didn’t have this tutorial I wouldn’t have anything to build off of, genuinely thanks, this was really helpful

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@elliotelliot3475 glad I could help you on your way mate ❤️

  • @aymericm.3516
    @aymericm.3516 Жыл бұрын

    Thanks a lot for these videos, hope there will be new episodes.

  • @wesleilucas863
    @wesleilucas8634 ай бұрын

    2024, i'm here, so fast but i can review, thanks for sharing your knowledge. Se um dia eu dominar isso, vou fazer tutorial em português para galera.

  • @truth8483
    @truth84832 жыл бұрын

    New viewer here, enjoying this grid base series to learn from. I havn't perused all your videos but I hope you have more on grid systems as I'm trying to make a 2D game with grid based movement and i hope to one day include random generation of tiles too it for some variation in levels.

  • @herr_brick3592
    @herr_brick3592 Жыл бұрын

    Wow! Thank you for the Video @Tarodev. I started using Unity some months ago with no experience in programming. This Tutorial did not just help a lot with a feature I wanted to use for a game, I also learned a lot more about different concepts in C#. Your explanations were really helpful and the pace on the video is fast but with pausing, rewatching and a little trial and error good for a total beginner like me. I have something in mind for future videos and hope that you read it even under this old video. I try to make a hotseat autobattler game, with two phases. First each player positions their units on the grid, then secondly the placed Units spawn on opposite sites and battle each other automatically. I think I can work out pathfinding, a combat System and a shop. But I would appreciate help with the placement, spawning and probably storing Information in between scenes (?) for the unit placement phases. Thanks a lot in advance! Sorry for my english, I am from germany.

  • @Slashx24
    @Slashx24 Жыл бұрын

    The amount of shortcuts I've picked up from you in terms of coding logic in just three videos is insane.

  • @Tarodev

    @Tarodev

    Жыл бұрын

    Use this power for good

  • @Slashx24

    @Slashx24

    Жыл бұрын

    @@Tarodev I'm sure I'm missing something completely obvious here, but how do I go about resizing the grid? I went and changed the pixels per unit on both my base, grass and mountain tiles and they look smaller, but they're still spaced out as though they were centred to the original size, and on mouse over the highlight is the original size.

  • @Tarodev

    @Tarodev

    Жыл бұрын

    @@Slashx24 I would strongly suggest keeping your tiles as 1x1 unity units, for your future sanity. If you want your grid to be larger you can increase the width and height

  • @Tarodev

    @Tarodev

    Жыл бұрын

    @@Slashx24 alternatively, reduce the size of your units, but keep your grid squares 1x1

  • @Slashx24

    @Slashx24

    Жыл бұрын

    @@Tarodev I'm trying to implement pixel art at 32px x 32px and was under the assumption that modifying the pixels per unit to 32 would keep that uniform which is why I tried that. Am I misunderstanding that part of unity?

  • @lakshminarayanantv1304
    @lakshminarayanantv1304 Жыл бұрын

    Hi, you are very fast for me, but yes i can able to follow you. Thank you for this amazing art work. I have learned so many things by this video series. and yes subscribed ...

  • @showmehowyouplayit5949
    @showmehowyouplayit5949 Жыл бұрын

    Nice video! Would be lovely if one could see a move range of said unit and if different units could have different move areas/regions available.

  • @NeurostarXYZ
    @NeurostarXYZ Жыл бұрын

    I need a playlist of this series

  • @a.panfilov.s
    @a.panfilov.s Жыл бұрын

    Thank you

  • @shreddedvegetable
    @shreddedvegetable2 жыл бұрын

    Dude thank you!!!!

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Absolutely 😘

  • @DarkstalkerFly
    @DarkstalkerFly2 жыл бұрын

    great ty!

  • @turkeyjerkey
    @turkeyjerkey2 жыл бұрын

    Thanks a lot for the two Grid-based tutorials! Well done! A few ideas for follow-up videos: (1) adding additional Tile types (e.g, Desert, Forest, Water) with different movement costs, (2) adding code to highlight Tiles within the Movement Range of the Hero, when selected, and limiting the Hero's movement within that range (this would presumably also take into account the movement cost of Tiles per suggesting #1), (3) same thing but for the Attack Range of the Hero (and adding such a range to the Units ;-)), perhaps also adding Line-of-Sight (e.g., can't see over mountains or through forests), (4) Implementing Hero and Enemy health and attack damage, (5) implementing an Enemy Turn that includes AI for movement and attack. I have more ideas but don't want to go on and on. ;-) Again, Great job!

  • @stormshadowoffire

    @stormshadowoffire

    Жыл бұрын

    Have you figured out some ways to incorporate those features within the way the tiles and stuff are setup in this tutorial?

  • @soundteqs
    @soundteqs2 жыл бұрын

    I liked this video a lot, if you ever do a follow up I'd really like to see some techniques for implementing rulesets related to movement and AI movement. Implementing rules dictating movement options for pieces so far has felt very cumbersome to me and I feel like there has to be lighter ways to do it

  • @JakeMoss
    @JakeMoss Жыл бұрын

    you are awesome!

  • @bradleyvanewijk1850
    @bradleyvanewijk18502 жыл бұрын

    You make some awesome Developer tutorials!! Amazing work. I got one small question tho. How would I go about moving the enemies? I have been trying that for a while after following both grid tutorials. But I just can not seem to do it correctly.

  • @Protonkpax
    @Protonkpax2 жыл бұрын

    That was a very interesting video Tarodev I have always wanted to recreate a game called Fallen Haven a turn based, grid based top down rpg strategy game, probably the best game I ever played when the pc first came out. To make a modern day version of that would be amazing

  • @linezokode9766
    @linezokode97662 жыл бұрын

    that was the best how many of you are not subscribed ive ever seen. Take my subscription, here, just take it

  • @UlrikxD
    @UlrikxD Жыл бұрын

    GIANT!

  • @MrEastgalaxy
    @MrEastgalaxy2 жыл бұрын

    Super good tutorial, think Scriptable Objects would be ok to implement in this system

  • @SeGGo1010
    @SeGGo10102 жыл бұрын

    Great video, I actually liked the tempo you had on this one. A guaranteed subscription for me. I would recommend a separate Singleton script you can inherit from😄. I have a question though. How would you implement a move pattern and highlight the possible tiles to occupy? My approaches where not that beautiful. Thanks

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    This can depend on how complex you'd like to go. 2 steps: #1. Gathering the tiles. This can be done via pathfinding like A*, or if it's just octagonal movement by simply counting on every direction according to move distance and returning the tiles. #2. Highlighting. Use the same technique I did for the mouse over highlight, but use a separate sprite to toggle as to not conflict.

  • @meddjihed9108
    @meddjihed9108 Жыл бұрын

    Hello Taro, I love your videos, you ve helped me a lot, I only wish you could zoom the scripting more, it would be more helpful and much appreciated

  • @sanin8621
    @sanin86212 жыл бұрын

    7:17 this is the best one I've seen so far

  • @Kneesoks
    @Kneesoks2 жыл бұрын

    This kind of video is exactly what I've been hunting for, just being able to digest someone else's thought process as they solve the problems their flow has in real time with very minimal fluff. Please do more of these kinds of videos in the future. My only criticism is that you do some things that are objectively correct for scalabity, like using scriptable objects for your units, but don't describe why it's the correct move when for exactly what you do with it its not really necessary. But other than that this was amazing.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Awesome feedback and totally agree. I played with scriptable a lot and didn't explain why. Just in case you or somebody else was wondering, the reason I use them here is: If you put all of your data directly on a prefab, it makes it very difficult to show that info in a menu for example. You may have an entirely different prefab to show the unit in the menu (on a canvas for example) and it would be bad design to put the data in two places. Plus, it's just nice and easy to view and edit a SO. Glad you enjoyed the video 😊

  • @Kneesoks

    @Kneesoks

    2 жыл бұрын

    @@Tarodev I do have one question that might answer itself but I really just want to solidify that this is how it should work. I watched a panel by Ryan Hipple at Unite 2017 about using scriptable objects for all data in their projects which makes a lot of sense especially at the scale that his team works, and wanted to understand better how exactly it flows. In the context of this video you have 2 data files, Enemy 1 and Hero 1. Say I were to make other data files or add to those data files some values of say current health and current stats based on buffs/debuffs, I would need to use that data file for only that specific unit, correct? And if that is the case, how do I scale that into making multiple units of the same type, do I need a new data object for every unit of that type in the object pool? Basically, say I have a data object called SnorlaxHP that has the snorlax's current HP. I'm assuming I can't use that single data object to manipulate the HP value of multiple snorlax's on the scene, is that correct? If so, how should I manipulate multiple snorlax's on a single scene using scriptable objects?

  • @Kneesoks

    @Kneesoks

    2 жыл бұрын

    I believe I've answered my own problem. The solution I came up with is to have the scriptable objects set base values and have current values stored on the object itself.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@Kneesoks I also watched that talk and of course this will come down to personal preference, but I hated that strategy. Using scriptable for dynamic data is a horrible idea. Imagine if you will a pokemon game where you have n number of pokemon with also the ability to have n number of save files... That's a lot of scriptables. You're much better off creating a standard save system which saves your object to disc. As I said, it's personal preference so just do what you think works best for your game 😊

  • @Kneesoks

    @Kneesoks

    2 жыл бұрын

    @@Tarodev I'm trying it out for a game jam and I can definitely see some flaws with it, especially when creating something on the small scale I am trying to use it for. It also made the first day of the jam feel like a slog because I didn't create any content, just systems. However, with the systems all in place, it feels like I can scale all of the systems very easily, adding new enemies, new levels, new weapon types, etc. It also helps me keep things organized since I can easily create new scenes and implement only the pieces I need and not being concerned with DontDestroyOnLoad singletons. Other than the insane amount of files in the editor, does this approach have some kind of downside in regards to file size or memory in the final build?

  • @Ricochetaglet
    @Ricochetaglet Жыл бұрын

    That was such an engaging and clever way to tell me to subscribe that I HAD to. Like, legally I had to. I'm not going to jail for not subscribing to this goodness!

  • @Tarodev

    @Tarodev

    Жыл бұрын

    Welcome ;)

  • @DanKaschel
    @DanKaschel2 жыл бұрын

    As an experienced developer, I'm hoping the next video shows to integrate animations and pathfinding.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Pathfinding video coming soon!

  • @Aryazaky

    @Aryazaky

    2 жыл бұрын

    @@Tarodev Animations please!

  • @sunginjung3854

    @sunginjung3854

    2 жыл бұрын

    @@Tarodev any update? really looking forward to the video

  • @zkassai.audio.2
    @zkassai.audio.210 ай бұрын

    Thanks for the tutorial, Taro! I have a question: if I want to hand-craft my levels instead of randomly generating them, what do I do? I'm a noob programmer, what I know comes from Notion formulas and a couple convos with GPT. I figured it'd be possible to make a system that renders out levels based on .txt files or something, right? Something that'd enable me to use simple software (such as notepad) as a level editor. Or in that case should I just use Unity's inbuilt tilemap stuff?

  • @jacksonmiller1704
    @jacksonmiller17042 жыл бұрын

    Great video! just curious about how I could make a unit spawn on a specific Tile instead of a random one. I saw the the section at the end of part 1 about referencing tiles but It went over my head.

  • @KeyboardKrieger
    @KeyboardKrieger Жыл бұрын

    Is there a reason you chose inheritance over composition for your tiles? I do it the other way and am quite curious if you have a reason for it I haven't thought of.

  • @jiaming5818
    @jiaming5818 Жыл бұрын

    thank you a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @brsdncr
    @brsdncr2 жыл бұрын

    Very informative video! You got my like at the moment when you turned the private variable into a protected one :) I'm not sure why we are utilizing scriptable objects though. Wouldn't it be the same if we had a [SerializeField] to hold faction information in the prefab and use prefabs directly instead? Is there a reason you specifically created units using scriptable objects?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    The simplest scenario is this: Each hero has an in game prefab, as well as some information such as a UI sprite, description, maybe price for the pre-game menu. It wouldn't make sense to store this information on an in-game prefab as you'd have to instantiate it in the menu just to get that info. Having a scriptable object is a way to keep all data in one place. Plus you can take advantage of the resources technique I mention.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    To be fair, this video doesn't actually show the power of having the scriptable. That's unfortunate.

  • @brsdncr

    @brsdncr

    2 жыл бұрын

    ​@@Tarodev That is unfortunate! Maybe you can make a video on advantages of using scriptable objects in future. :)

  • @stormshadowoffire
    @stormshadowoffire Жыл бұрын

    How would you recommend highlighting the tiles within a unit's maximum movement capability when selected?

  • @CodyNewhouse
    @CodyNewhouse2 жыл бұрын

    Great stuff. Perhaps Game Grid pt3 where you add A*Star Pathfinding?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Could do! I was thinking of doing another part where I add a bunch of utility. A* could be included.

  • @CodyNewhouse

    @CodyNewhouse

    2 жыл бұрын

    @@Tarodev :-)

  • @DavidSummers44
    @DavidSummers442 жыл бұрын

    "Your {Channel} is Acceptable". Subscribed. :-)

  • @DeznekCZ
    @DeznekCZ Жыл бұрын

    Not only ((x+y)%2==1) but you can do also ((x+y) & 0x1 == 0x1) which is much faster than division.

  • @modiddymo
    @modiddymo2 жыл бұрын

    Have you considered making a turn based game with data oriented and functional programming, perhaps using a reactive library like UniRX or unidux?

  • @DanielS-yf4me
    @DanielS-yf4me Жыл бұрын

    Coming in pretty late. I'd be interested in seeing how you would go about setting up a game with certain tiles and units in specific positions. This way multiple levels could be made that progress in difficulty rather than being random every time. Is this something you would do in code, or would you make different scenes and set them up manually in the editor?

  • @rockinpatty346

    @rockinpatty346

    Жыл бұрын

    This is also what I’m looking for!!!

  • @ezio7141
    @ezio71412 жыл бұрын

    Hey! Nice video! One question How can I implement that you cant place go everywhere on the map, only for example 3 tile far.

  • @christostsonis344
    @christostsonis344 Жыл бұрын

    Great video, I was wondering though if it's good design that Tile has a ref to the occupping Unit and at the same time Unit has a ref to the occupied Tile.

  • @JianqiuChen
    @JianqiuChen2 жыл бұрын

    Really cool stuff! I wonder if there is a way to avoid making every manager a singleton or is it just the most suitable approach for this type of structure?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    They're actually not even singletons, just static instances as they'd be overridden when a new one arises. Don't let people scare you into thinking they're bad... If they reduce reference lookup code and streamline your application, it's not such a bad thing.

  • @JianqiuChen

    @JianqiuChen

    2 жыл бұрын

    @@Tarodev yeah, still a controversial topic I guess. The company I worked for a while simply ban singletons. (they don't even bother to scare us lol). I try to avoid them as much as I can, but sometimes do find having to do some extra work to stay clean. Really enjoyed your video and pleased to see the lambda syntax. Hope to see more follow up videos on this topic, a tiny-mini version of heroes of might and magic type of game would be great.

  • @lhorbrum1818
    @lhorbrum18182 жыл бұрын

    I'd love a final fantasy battle system. Thoughts? :P Great video btw, and subbed!

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    That's a great idea!

  • @sunginjung3854
    @sunginjung38542 жыл бұрын

    Could you do pathfinding for player and highlight the range, and pathfinding AI for the enemy?

  • @user-bg7ik8zb6o
    @user-bg7ik8zb6o Жыл бұрын

    What should the dimensions/resolution of the sprite image files be? I'm trying to use my own but I'm not sure how to resize them in Unity. Thanks a bunch for the video!

  • @JW-uu9je

    @JW-uu9je

    9 ай бұрын

    100x100

  • @raymondmcveety9375
    @raymondmcveety9375 Жыл бұрын

    I know this is old and it's not really important, I was just wondering if there was a reason you change state inside of GridManager.GenerateGrid() instead of right after that method is called in GridManager (~9:30 into the video) PS thanks for this amazing tutorial. This and your game manager stuff is some of the only content pushing actual proper thoughtful code design in the context of games. I can't say how many 'projects' I have spaghettid together without the concept of what state my game is in. This is very helpful

  • @simblend
    @simblend5 ай бұрын

    About having a hot key for Singletons you can use this snippet on visual studio User Snippets { "Singleton Patern": { "prefix": "singleton", "body": [ "public static ${1:SingletonClassName} Instance { get; private set; }", "", "", "private void Awake()", "{", " if(Instance != null) Destroy(this.gameObject);", " else Instance = this;", "}", ], "description": "Create Singleton" } } and when you write "singleton" on a class and press TAB it creates it automatically.

  • @TheFern2
    @TheFern22 жыл бұрын

    Loving your channel! a small nitpick if you can please zoom in on post or use bigger font.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    This is my weakness >< I keep forgetting to do it

  • @TomDonahue
    @TomDonahue2 жыл бұрын

    I’ll caveat this by saying I’m very much a noob at gamedev and coding in general. Someone turned me onto the SOLID principles recently, and I’m trying to evaluate my coding practices in light of that. I’ve actually been working on a tactics game for the last couple of months and learned a lot of good tips from this video, so thank you! Question… on the OnMouseDown methods, would it be better to have that fire off an event for other scripts to then make the action? Rather than making the tile responsible for moving the character, for instance?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Yes it would. It's always better to keep things decoupled if you can. I tried to keep the subject matter 'how to build a grid game' and not system architecture, as that would hav been half the video and might have confused people. Once people know how to accomplish certain tasks, they can abstract and decouple to their hearts content 😊

  • @TomDonahue

    @TomDonahue

    2 жыл бұрын

    @@Tarodev oh makes perfect sense and no knock on the tutorial! Just curious if I was thinking in the right direction. Thanks!

  • @iazy47
    @iazy47 Жыл бұрын

    Hi want ask, its can combine with rpg creation kit? I'm very new in game development.

  • @kevinguiboche2359
    @kevinguiboche23592 жыл бұрын

    you guilted me to sub :D

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Muhaha

  • @PiFsc2
    @PiFsc210 ай бұрын

    How about spawning a larger Object? Something that takes 2 tiles? or even 2x2 (4) tiles. Like a big boss. I'm really struggling with doing this... any tips would be appreciated!

  • @frgmnt7313
    @frgmnt73132 жыл бұрын

    What is recommended for creating multiple enemy/hero prefabs? When making the prefabs for each different units, am I supposed to be making a separate Enemy1/2/3/4/... scripts for each prefab, and then a corresponding scriptable Enemy1/2/3/4/... unit under resources?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Yes, you should always give each unit their own script, which inherits from the base class. You may not need any special logic for that unit right now, but you surely will later on and you'll thank yourself for the script.

  • @geniuspancake8274
    @geniuspancake82742 жыл бұрын

    Instead of enums I create ScriptableObject that just has ID which represents the faction (Hero, Enemy, NPC, etc.) and I use that to control who spawns. Also hate singletons but I do use them, rarely. Since I really dislike creating enumerators for these things. Adding things to enum is very easy but removing is hard. It can completely mess your code.

  • @anubibibi
    @anubibibi Жыл бұрын

    Hello, first just wanted to say I loved this video. It opened my eyes to so many things about unity I didn't know how to use, or even that I didn't know existed. But, I do have a question, how would I go about grabbing the tiles around a specified tile? I want to make it to where I can only attack the enemy while on a tile next to the one they are on and no matter what I try, I can't seem to get anything to work

  • @Tarodev

    @Tarodev

    Жыл бұрын

    Hey mate, it has been a while since I made this so I don't remember exactly how I set it up, but each tile could generate a list of their neighbours (do this after the map finishes generating). You could do this by fetching tiles which are +1 x, +1 y, etc. Now you can just do selectedTile.Neighbours.

  • @anubibibi

    @anubibibi

    Жыл бұрын

    @@Tarodev Thank you for your response. I didn't even realize the video was as old as it was until you mentioned it. After reading your response I tried going at it and getting the detection to work, as I understand what you said, but couldn't implement it into the code at all. It's probably just my limited knowledge on programming as of this moment. I did just think of adding box colliders to the characters that the player could control, and depending on stats and such, the collider would be larger. And tiles in the collider would allow the player to attack the enemy on such tile (if one existed). Would this be an acceptable way of doing this? Or could it cause some major issues in the future that I can't think of at the moment? There was already one with the newly added box colliders. My mouse was getting blocked by them and couldn't reach the tiles' colliders and so I couldn't even select my hero to move them. This was fixed by just making it to where those colliders ignored raycasting.

  • @Quo4
    @Quo42 жыл бұрын

    I'm not sure if I missed something but the hero unit is able to be placed onto the mountain tiles. What would the logic look like to prevent the player from putting the hero unit on a mountain tile?

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    When you are grabbing the free tiles, make sure you're checking the tiles walkable boolean is set to true. Also, make sure you set your mountain prefab to non walkable.

  • @williamcezarbill
    @williamcezarbill Жыл бұрын

    do this have a sequel? i saw at the thumb, heroes and enemies having hp bar

  • @kwannoko
    @kwannoko2 жыл бұрын

    Your tutorial is really helpful. Is it possible to store information in each tile independently and generate a canvas replacing the default grass tile with different visual features according to those info? e.g. I want to make an intractable tile that can be attacked and has it's own status shown as UI image/text. Sorry for having a specific question and really appreciate your efforts. Thank you!!!

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Yup! That's the beauty of having the individual tile scripts. You can create a 'building' tile, just like I created a mountain tile. This building tile has a health variables which lowers when attacked. When it takes damage you can add a more damaged visual until it eventually crumbles!

  • @kwannoko

    @kwannoko

    2 жыл бұрын

    @@Tarodev Thanks for your help and I did it! One more thing to ask. I am now working on saving the grid map and I found your video about saving unity Tilemaps. I am wondering if the script (or the logic) in that tutorial applies to the grid system you introduced here. Thx!

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    @@kwannoko not 1 for 1. But the same idea can be applied for sure. Save them to a scriptable object.

  • @LoadedFlair
    @LoadedFlair2 жыл бұрын

    How would i go about allocating my pieces to specific tiles

  • @mkojot1314
    @mkojot1314 Жыл бұрын

    Hi, I have a Question, is posible to do something familiar with hexagon?

  • @nonx5527
    @nonx55272 жыл бұрын

    Could you do a tutorial on how to visualize a pathfinding? plsss

  • @Jamess5555
    @Jamess55552 жыл бұрын

    Hey, I love this tutorial it's been super helpful for getting the project I wanna make started, but I don't want to spawn units randomly. I have a "deployment" phase, and during this phase I want the player to be able to drag and drop their units from a UI element onto the map. How would I go about implementing this? I'm not very familiar with Unity's UI system

  • @sneeky_09

    @sneeky_09

    Жыл бұрын

    Probably have a state in your game manager called development phase and then in the unit manager script have logic for placing units during that state

  • @KoryTrosclair
    @KoryTrosclair2 жыл бұрын

    Any idea why I'm getting double spawns of each type (end of spawning units section)? Great video so far.

  • @Tarodev

    @Tarodev

    2 жыл бұрын

    Is your grid also spawning twice? Could be duplicate grid managers. Or maybe your game manager state is being called twice for some reason. Let me know if you fix it 😊

  • @mukining0150
    @mukining0150 Жыл бұрын

    Having issues where Heroes, Enemies, and tiles are spawning twice. Tracked down a comment here which brings up the same problem and you recommended that it might be a double of the Gridmanger or the Gamemanger might have been called twice, any ideas on how I might be able to fix this?

  • @earth2772
    @earth2772Ай бұрын

    I really enjoyed your tutorial videos, and I spent an entire day learning from your content. I have almost completed the content, but I encountered a problem at the end. After the Hero selects and moves, it retains the original OccupiedUnit, and clicking on the previous grid still allows the Hero to be selected.

  • @earth2772

    @earth2772

    Ай бұрын

    😮‍💨Oh no, it's a video from two years ago, so I probably won't get a response anymore.

  • @chipfankhauser6950
    @chipfankhauser6950 Жыл бұрын

    Hi! In the player turn, I'm able to move my character onto the mountain tiles (it's not listed as walkable). Is this something that I missed, or something to be included in the movement logic? Sorry if this is poorly phrased, I'm new to Unity :)

  • @Tarodev

    @Tarodev

    Жыл бұрын

    Are you including only walkable tiles in the linq query?