Search Unity

Grids Pro: A library for hex, tri, polar and rect grids [New Dcoumentation for Grids 2]

Discussion in 'Assets and Asset Store' started by Herman-Tulleken, Jul 10, 2013.

  1. delinx32

    delinx32

    Joined:
    Apr 20, 2012
    Posts:
    417
    I wasn't going to distribute grids, I know that's against the license and even if it wasn't I wouldn't want to be responsible for keeping a separate version up to date. I was just going to require it as a download. It's no big deal, I already rewrote the code that used it.

    It's my fault, I didn't understand that grids lite was only free for a short period of time.
     
  2. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    86
    Maybe that the path with the mesh was incorrect from the beginning. I was going to have a uniy built-in terrain and some objects on top of it, that logically affect grid cells, like height or belonging to different levels. See the truck here http://www.gameguyz.ru/sites/default/files/pictures_images/08.11.2012/1352357363_2.jpg and crates there might have a cell over them as well. Can I achieve this with the mesh? Whould this be a better solution?
    If the answer is no, then I'd really appreciate your help with sprites. Thanks!
     
  3. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    68
    Hello Herman!

    Our game is shaping up very nicely and Grids has been absolutely essential to the project.

    I have a quick question - is there anything in the library or perhaps do you have some kind of a tip on how to handle units/objects, which would occupy more than one cell in the grid? Two biggest issues with this I can think of are:
    • Drawing one big cell instead of 4+ cells
    • A* pathfinding with big units
    PS. We are using diamond grid, isometric grid in our project.

    Thanks!
     
  4. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    86
    It was a week ago...
     
  5. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    86
    2+ weeks ago
     
  6. RDeluxe

    RDeluxe

    Joined:
    Sep 29, 2013
    Posts:
    90
    Hi guys !

    I'm working on a side project, and I wanted to know how hard it would be to use Grids.

    I'm basically trying to implement a variant of this : http://experilous.com/1/blog/post/procedural-planet-generation in Unity, minus the part when he perturbs the hexagons.
    That means putting a hexagonal + pentagonal (12 pentagons) grid onto a sphere. Doable with Grids without a hugh headache?

    Thanks :)
     
  7. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    I am so sorry for the long wait! I did not get notifications, and I did not check back here.

    To answer your question; yes, you can do what you need in meshes. If you run into size issues, though, you will have to break your rendered grid into chunks that can fit. For a grid this big, sprites may be slow too because of the number of objects you need.

    To address this, there is an example here to explain how to use two grids to achieve what you need: one for the logic, and a another for display. You will probably be better off defining grids in code rather then using the editor.

    Here is the example using sprites:

    http://gamelogic.co.za/grids/featur...-only-a-section-of-a-very-big-scrolling-grid/

    This example uses the same idea, but with an actual mesh (don't worry about the fact that it looks like a sphere - it is just the map that does that - with an ordinary "flat" map it will work the same as the sprite example:

    http://gamelogic.co.za/grids/features/examples-that-ship-with-grids/tiling-a-sphere-with-hexes/

    You will see the map is used to do vertex calculations. Usually, the map is flat, and hence the y is simply 0. In this case, you can use whatever is in your scene to calculate the correct y to get raised cells. It should work nicely with the examples, since the cells are still parallel to the XZ plane, and hence the vertices of each cell have the same y coordinate. Let me know if you need more info,
     
  8. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    We actually have an example of this here:

    http://forum.unity3d.com/threads/ga...-and-square-grids.189866/page-14#post-2065422

    That implements the basic ideas (for rect, but it should be almost exactly the same for Diamond). It still uses a normal grid, which should work fine with path finding. The main change is occupancy, and how cells are drawn (in this case, using sprites that are the right size, independent if the grid). There is more explanation in the discussion around that post.
     
  9. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    I always wanted to have a look into how to make Grids work with this. The main problem is that of assigning coordinates to the cells. Our system always assumes some kind of vector space, which is not (at least not trivially) possible with that system because of the pents. The way I would do it with our system is to use a nested coordinate system - one for the underlying regular polyhedron, and one for a subdivision of its faces. Combined with a spherical map, that should do the trick. However... not having done this, it feels like it may be quite tricky. I would be happy to assist if you go this route, but I have to warn you it may get hairy.

    Also, I just want to make sure you know of some of our fake sphere examples:

    http://gamelogic.co.za/grids/features/examples-that-ship-with-grids/tiling-a-sphere-with-hexes/

    http://gamelogic.co.za/pointy-hex-grid-on-a-sphere-and-elipsoid/

    http://gamelogic.co.za/2013/11/28/day-28-game-28-30-games-in-30-days-using-grids/

    The first two are both topological cylinders, but the former simulates a shape that cannot be realized in actual 3D space, but looks right wherever you are; the latter can be realized, but cells are smaller towards the poles. The last of the three examples is actually a cylinder using a rect grid with cells offset (more like a brick grid, actually), but the way they cut makes it look like hexagons. (This scheme will not work on the outside...except with some very tricky math).
     
  10. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    86
    Alright, thanks for answering.
    The example with sprites addresses the issue with big size of a grid. I'll try to adopt it once I get it drawn. But another part was about distributing sprites over uneven terrain. Is there an example for it? Some examples suggest using CustomMap3DBuilder while others mention CustomMapBuilder.

    Which map builder should I use and why? Despite the similar name they are not interchangeable siblings, they provide totally differnt interface. So I assume they are not meant to be interchangeably used grid builders. This unexplaind inconsistency really drives me crazy.

    No offence, it is a great plugin, overall feeling about implementation and abstractions used is definitely positive. This could have happened after some partial refactoring or missed somehow. I just hope for better support and fixes.
    Thanks.

    Upd
    I think I'm getting somewhere with sprites if I ignore Builders and just generate them in the code. Even though inconsistensies above are no longer an issue for me, I suggest you revise the code and examples.
    http://screenpresso.com/=CPlmb
     
    Last edited: Oct 11, 2015
  11. ToanHo

    ToanHo

    Joined:
    Sep 25, 2013
    Posts:
    2
    Hi guy,
    How does you use path finding with Nested Grids?
     
  12. Culzean

    Culzean

    Joined:
    Jan 25, 2014
    Posts:
    47
  13. Braza

    Braza

    Joined:
    Oct 11, 2013
    Posts:
    86
    Hi,
    I'm confused again. As you have seen, I was able to generate a grid and a smaller sprite grid window in the code. Then I read your tutorials and the next thing you promote to put logic into is GridBehavior. But it seems to work well only with grid builders that are still an issue for me.
    Should I forget about using your GridBehavior? Or should I really try to setup some CustomGridBuilder? What else functionality is tied to this class? These tradeoffs are not obvious a ta glance...

    Upd.
    I'm making progress with Builder approach using some examples. I do not fully understand how those WindowedMaps work. But I really believe that both IMap and IMap3D must be compatible with regard to the ability to be converted to Windowed. With the current code I cant feed IMap3D to the GridBuilder, because IMap3D doesn't have this CreateWindowedMap<TPoint>(). I do not see any good reason for this. Any comments please?
     
    Last edited: Oct 24, 2015
  14. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    There is an example that you can check out; it has path finding too. It is the NestedGrid scene. You can use left click to set the goal and start, and right click for obstacles.

    (It essentially performs path finding on a high-res presentation of the grid. The nested grid allows you to access the small and big cells with two sets if coordinates.)
     
  15. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    I could not really determine from the images what was going on (I pasted a partial answer there). If you can do a test with the UV test image it would be helpful to see what is going on.

    grid01.jpg
     
  16. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    Windowed grids are meant to be used with 2D grids - the 3D grids are more generic, and windows does not always make sense. With grid builders, there is less need for it, since you can simply move the grid root to position the grid. In code, the WindowedGrid is meant to handle the positioning calculations for you. How are you trying to position the grid? Maybe there is an easy way to do it.

    (We have been flooded with work, and finally may get another programmer or two to join us soon so we can complete the long awaited update. There are a few inconsistencies with the grid builders, which we want to resolve. So Any information about what you want to do would be helpful.)
     
    Braza likes this.
  17. Vorren

    Vorren

    Joined:
    Oct 24, 2014
    Posts:
    18
    Hey,

    I want to make a game similar to combat in heroes 3 (hex grid with units walking on it). Can you possibly point me to a tutorial or an article that covers something similar in Grids Pro?

    Cheers!
     
  18. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    We do not have a specific example for that type of game. The grid aspect of it should be pretty simple, all you have to do is a build a grid in the editor (set it in the XZ plane), and build the remainder of your world on top.

    Here are a few things to get you started:
    It is probably a good idea to read all the tutorial documents first. You can also look at what other examples we have here, and if you get stuck or have questions related to a specific issue, you can ask here.
     
  19. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
    Hi Everyone,

    We recently brought out a few new plugins that we built on top of Grids. One of them, Abstract Strategy, is currently 65% off (available for 17.50 USD) on Unity’s Cyber Weekend Sale.

    Abstract Strategy makes it easier to implement abstract strategy games, such as Checkers, Reversi, Dots and many more.

    It ships with an example of Tic Tac Toe, with complete AI set up as a behavior tree. We just submitted an update which also includes examples of Reversi (rules and AI) and Checkers/Draughts (rules only). There are also some basic tutorials on our website and we will be adding to these.

    You can find out more on the Abstract Strategy forum thread or the Asset Store page. https://www.assetstore.unity3d.com/en/#!/content/39377

    Let us know if you have any questions, either by email, our Knowledge Base and of course the forums.

    AI_banner_940x470.png
     
    c-Row likes this.
  20. comicm

    comicm

    Joined:
    Sep 5, 2014
    Posts:
    3
    Hey

    I am trying the "Field of View Example".
    But in the example the lookAt function could not shown in runtime.
    Is there anything wrong in the Example?

    Thank you
     
  21. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @ Jonathan Bailey,

    Does this asset support Playmaker?
     
  22. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
    That is example is indeed slightly out of date, however we are in the process of updating it and we will have uploaded early next week!

    Unfortunately it does not support Playmaker, but this is something we are looing into for the future.
     
  23. kregenrek

    kregenrek

    Joined:
    Dec 21, 2014
    Posts:
    10
    Hi

    is this plugin suitable for Tile Grid Based Games ?

    Things I would need:

    1) enemy/agent 4 direction rotation (facing to target player)
    2) seek target player
    3) custom levels with obstacle & grounds
    4) video above is 2d but I need it in kinda ortogonal view.
    5) all moving objects (agents, player) are moving 1 tile at a spec time and just in 4 directions, non diagonal
    6) is tile occupied by a moving agent _ collision detection

    The Grid looks like here in this Game:
    (But just in 3D).



    Is this possible to achieve with the asset?

    Which Version of Grids I would need to buy, to setup a game like this (Lite, Basic, Pro)?

    Regards Kevin
     
    Last edited: Jan 5, 2016
  24. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    Grids is specifically built with tile-based games in mind, so yes, it is suitable. Specifically:

    1) This is not part of the library, but is easy to implement using our basic structure. You would maintain a look at direction and grid position in your character. The look at direction is easily determined with `charcater1.gridPosition - character2.gridPosition` (which you can easily check against to cardinal directions if you want to limit their facing directions).

    2) We have an A Star* algorithm that calculates the short path. You would have to write the code for characters to follow this path and animate them.

    3) Here it is useful to know that a grid is simply a data structure - what you put in is up to you. Obstacles and custom shapes / sizes is easy to achieve.

    4) Grids work with any rendering type. You can use sprites and position the camera however you with, or you could use 3D objects. As I mentioned before, grids are essentially data structures - you have full freedom of how to visualize them. (But we have examples using Sprites, 3D objects, meshes, and uGUI images, so you don't have to start from scratch. And all these work with grid builders in the editor.)

    5) You can set up grid neighbors to orthogonal, diagonal, both, or anything else. So your scheme will work fine. For smooth movement from cell to cell, you will need to handle the interpolation and animation.

    6) Queries against the grid is easy to make. If you maintain units in a grid, you simply check the grid at the point you are interested in. If you want to find the grid point of a world position, there is an object (we call it a map) that does the calculation for you. Usually, you don't need collision detection (assuming one character per cell at a time) - you simply check if their grid points are the same.

    For your purposes, Grids Lite will all you need.
     
  25. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
  26. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    377
    Thanks Jonathan,

    Any update on when Grids 2 will be out? Might be worth a mention ...

    cheers

    Nalin
     
    Jonathan-Bailey likes this.
  27. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
    What is coming in Grids 2.0

    Hey everyone,

    As some of you may have seen on our website, we are bringing out a major upgrade to Grids!

    The new version has many design changes. Our main goal is to make Grids more flexible, more robust, and less unwieldly. The way it is designed at the moment makes it a chore to write generic algorithms – something that we realized when we started to build other tools on top of it. It is also difficult to extend – writing more editor tools require us to write almost duplicate code for every grid type. The upgrade solves these problems, and has many additional benefits: it has less code, is more powerful, is more generic with fewer type parameters everywhere You can find out more about what is coming in Grids 2.0 here.

    We are planning for Grids 2.0 to be available by the end of this month (January 2016).

    The good news is that all Grids Pro users will be able to upgrade to Grids 2.0 for free. We will also provide paid upgrades for current Basic and Lite users.

    If you have any questions feel free to ask us on the forums or send us an email at support@gamelogic.co.za

    grids2-680x340.png
     
  28. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    377
    @Jonathan Bailey this is fantastic news - seen some of the things that are coming, just as well I have no code to migrate yet ;)
     
    Jonathan-Bailey likes this.
  29. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    799
    Any news on 2.0 yet?
     
  30. AkuStudio

    AkuStudio

    Joined:
    May 19, 2014
    Posts:
    1
    Hi c-Row,
    Loving the way you deal with swipe animation.
    Currently working on a grid-based game I'd like to achieve the same kind of animation.
    Any chance to have some guidance or some source code to help me start with?
    Regards
     
  31. Fsilva

    Fsilva

    Joined:
    Mar 31, 2015
    Posts:
    34
    How can I update for free? it is appearing $1 to update, I know that $1 is not that much but you said " The good news is that all Grids Pro users will be able to upgrade to Grids 2.0 for free. "
     
  32. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I paid a buck and I don't mind. Hell, it's a 100-dollar asset. Normally an upgrade like that for any other software would be at least 20 or 30 bucks.
     
  33. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
    Hi @Fsilva Unfortunately Unity does not allow us to provide a major product upgrade for free :( If we had it our way it would be free, but the lowest we could set it was at 1 USD. Appologies for the mis-information. We will be posting some updates about the upgrades in the couple of days.
     
  34. Jonathan-Bailey

    Jonathan-Bailey

    Joined:
    Aug 12, 2013
    Posts:
    79
    Grids 2 is out

    Hi Everyone,

    After many months of waiting, Grids 2 has finally been released!

    You can currently buy it for 40 USD from the Asset Store: https://www.assetstore.unity3d.com/en/#!/content/66291

    All Grids Pro users can upgrade to Grids 2 for 1 USD. We planned for the upgrade to be free, but unfortunately Unity doesn't allow us to make a major version upgrade free :( In which case we made it the minimum of 1 USD. We applogize for the change. In the next couple of days we will also release more info of how Lite and Basic Users can upgrade to Grids 2.

    In this post we go over the most important list of changes from Grids 1. http://gamelogic.co.za/2016/07/12/grids-2-is-out-what-changed/

    One thing we have not completely taken into account is how much work it would be to convert the more than 70 examples we have for Grids 1 to Grids 2. Rather than delay the release even further, we decided to ship with a minimal set of examples, and add new ones gradually. The same goes for the tutorials; over the next few weeks we will add some tutorials, starting with the most common tasks. In the meantime, please ask us any questions on the Knowledge Base.

    We hope you enjoy and that it was worth the wait!

    Grids2 (1).png
     
    Braza, Tinjaw and movra like this.
  35. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,317
    Great Update... appreciate all of the hard work. Looking forward to giving this version a spin.
    Btw, does this package work on all unity platform. I remembered that AOT platforms were problematic in the older version. So specifically, is there still a work around with AOT platforms in this new version ?

    Thanks again for this fantastic version 2.
     
    Last edited: Jul 24, 2016
  36. Aishiteru

    Aishiteru

    Joined:
    May 3, 2014
    Posts:
    31
    @Herman-Tulleken

    I realised the onClick method only works when using an orthographic camera with (0,0,0) rotation. In that case, how do I get the correct tile when clicking if I have a scene where my grid is on the x-z plane and the camera is isometric style ?
     
  37. klund

    klund

    Joined:
    Mar 21, 2011
    Posts:
    33
    Last edited: Aug 24, 2016
  38. StevenWendel

    StevenWendel

    Joined:
    Jun 18, 2013
    Posts:
    105
    I'm trying to upgrade from Grids Lite 1.13.1 but it is currently showing up at $40 in cart instead of the $5 upgrade path. Any guidance here would be appreciated.

    Edit: I looked through some other depreciated assets in my account and tried the upgrade path on those that state the cost and they all show up at full price. Emailing Asset Store.
     
    Last edited: Aug 24, 2016
    Jonathan-Bailey likes this.
  39. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,148
    I'm using a RectGrid, and I'd like to disable those aqua-colored tile coordinate tags in the Editor UI that appear. Does anyone know how to do that?
     
  40. NeilAJones

    NeilAJones

    Joined:
    Oct 7, 2016
    Posts:
    2
    Im unfortunatly having quite a bit of trouble as Im new to C#, unity, and your extension. I managed to create a grid with the gridbuilder but Im wondering how I could randomly paint the grid with an array of 4 sprites.
     
  41. sommersbenw

    sommersbenw

    Joined:
    Jun 26, 2015
    Posts:
    3
    If I have an old project that I'd like to open up for others to tinker with that used 1.X Grids Lite, is that older version of Grids depreciated enough that I could open that project up for others to view? Especially since they couldn't purchase a license for Grids Lite anymore.
     
  42. twda

    twda

    Joined:
    Oct 25, 2012
    Posts:
    111
    @Herman-Tulleken Could you please advise me how to use a background texture for a grid from code? Thank you very much!
    I don't mean like in the sample "ImageMapTest", but rather a texture in the background that can be covered by the cells.
     
  43. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    Hi @twda - I sent you a PM (basically, I just want to clarify what you mean, and why just putting a sprite behind the grid won't work).
     
    twda likes this.
  44. twda

    twda

    Joined:
    Oct 25, 2012
    Posts:
    111
    Thank you! Keep up the great work! Grids Pro is amazing!
     
    Herman-Tulleken likes this.
  45. Herman-Tulleken

    Herman-Tulleken

    Joined:
    Nov 20, 2009
    Posts:
    358
    We got a lot of feedback that our documentation was lacking. Over the last two weeks we started to fix it. It's a work in progress, but we already added a lot of content, made many improvements to the API documentation, and added more examples that ship with the package. So if you are a Grids 2 user, please check it out, and let us know if we are on the right track!

    http://gamelogic.co.za/documentation/grids2/

    s1.PNG s4.PNG s6.PNG s7.PNG s8.PNG
     
    red2blue likes this.
  46. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,788
    Great job. I used your asset and made well my game. Somewhat complicated source and usage, but by that function, I can make my game's function.
     
    Gamelogic likes this.
  47. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
  48. Gamelogic

    Gamelogic

    Joined:
    Jul 8, 2013
    Posts:
    1
    Hi I also answered your question on our Knowledge base (I only see it here now).

    There is no formal integration, and I am not sure how Behaviour Designer talks to the rest of the game. If you can somehow feed it a list of points (centers of grid points), then you can use BD to do actual movement on the grid. Beyond that, I am not sure how you could use BD with grids. Perhaps you have some other ideas?
     
  49. red2blue

    red2blue

    Joined:
    Feb 26, 2013
    Posts:
    200
    Hi there,

    i wanted to try Grids Pro in a new 2017.1.0.f3 Project, but I get teh following errors.

    Assets/Gamelogic/Extensions/Plugins/Scripts/Patterns/Singleton.cs(14,3): error CS0104: `HelpURLAttribute' is an ambiguous reference between `Gamelogic.Extensions.Internal.HelpURLAttribute' and `UnityEngine.HelpURLAttribute'

    Assets/Gamelogic/Extensions/Plugins/Scripts/UnityExtensions/GLMonoBehaviour.cs(18,3): error CS0104: `HelpURLAttribute' is an ambiguous reference between `Gamelogic.Extensions.Internal.HelpURLAttribute' and `UnityEngine.HelpURLAttribute'


    Any idea about this? Is there a quick way to fix this?

    Thanks a lot!!
     
  50. TokyoDan

    TokyoDan

    Joined:
    Jun 16, 2012
    Posts:
    1,080
    I had the exact same problem. Click on each error in the console to open up each file and comment out the line with the error. It is just a tooltip so it won't hurt anything.

    For details see the URL below. The dev explain the error ands says he'll fix it in the next update:

    https://gamelogic.quandora.com/Grid...2c99/How-can-I-fix-these-errors-in-Unity-2017

    P.S. I tried deleting the class file like he advised but that caused dependency errors. So just commenting out those line is the best way until the next update IMHO.
     
    Gamelogic and red2blue like this.