• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By ThunderTwonk
      Hello everyone, I am working on a game idea and since I am still in the process of learning C# and the features available in unity I was hoping some of you might be able to offer me a little insight on things in general for getting started.
      I guess the basic components of what I'm wanting to create would be a Multi-levels management/city builder/rpg.
      The goal is to provide a framework for players to interact with, build in and affect the world both from a 3rd person action RPG as well as a zoomed out 4x style view (This would be something unlocked through gameplay)
      As for my questions go I was wondering if anyone had resources that could help me learn.  I've been on youtube as well as enrolled in an online course for basic unity and C# and will continue those but if anyone has any words of advice, a place that has good information and tutorials etc.
      Thanks for your time.
    • By Cahit Karahan

      Hi, I'm new in this forum. It is honorable to see such communities exist. I would like to share my new game. I did for android with unity. I know the game is a little awkward , but you have to know that this game is from the time when Unity's name is Unity3D  I have made my first game when I was 12. Now I am 22.  I have taken a lot of experience in this process and I can make better games nowadays. I have published this game nowadays but actually this game is very old but also it is very special for me :))
      I have just wanted to retouch and share this game, because it has a very important place for me.

      It's a special free 3D horror adventure action game for the halloween. Fun with scary sound effects and musics, 3D realistic graphics, you will feel the horror in the deep of your heart. Use your reflex. Totally free adventure. Totally scary horror game. 

      Tamarra, she is a beast from our world. She needs to consume souls from innocent people to stay alive. Story begins, the old Elaris tribe had lost their everything because of this beast who lived in the well. Araknas was the most powerful warrior of the tribe. One day, Araknas's mother was killed by the servant beasts of Tamarra. That's how Araknas's journey to the well begins. Tamara's well is guarded by horrible beasts. Araknas has to pass all servant beasts until he reaches Tamarra.

      Even death at the end is worth the revenge. 
      Are you brave enough to jump into Tamarra's well?

      Survive from witch attacks, clown attacks and many scary creature.

      - Realistic 3D graphics.
      - Scary sounds.
      - Scary musics.
      - Best experience with headphones.
      - A demon cage where you can imprison all the demons one by one
      - The witches do not like help, but they love blood stone. Witch store where you can develop your abilities and get new abilities.
      - Countless beasts.
      - At the end of the well there is a hidden surprise for you.

      *We do not recommend this game to people with clown phobia, spider phobia, or panic attacks.*

      **!!!**Note : This game is an early-access game, we are upgrading new features every day, new beasts, new improvements, as an example online 1vs1 fall on the list, so stay on connect and follow Halloween : Horror Well on Google Play.**!!!**

    • By INFRA
      SCAN. DRILL. SURVIVE.   ISOLATED Release in May 1st 2018   https://store.steampowered.com/app/805950/Isolated/   A game by Jérémie Bertrand Music & Sound Design by Pierrick Querolle *** Our solar system has been invaded by strangers. For the purpose of a possible negotiation, a team of astronauts is sent to the moon. Alas, they are shot before even arriving on the scene. Only one astronaut survives the crash and his only goal will be to go home...   GAMEPLAY   Shoot enemy ships to avoid being invaded. Be precise in your movements, because it's better to lose a bit of life at the top than to lose it all at the bottom. Take out your drill to destroy the stones in your path. Validate your identity to cross the different laboratories. Reach the flag before losing your three lives.   And all that... at the same time! Will you be able to go home? If the answer is yes, how long will it take?
    • By BigJiggly
      Hello! So, I've been the leader of BJP for a while now. I'm a bit bored of taking the role I always take, leader. I was hoping someone out there is looking to forge a team maybe and needs a programmer. 
      I have experience mainly in the Unity engine(C# intermediate) and I have a very small amount of knowledge on Shaders, as well as experience on developing games(usually end up stuck in dev hell) and leading experience from my last team which at one point reached 11 people. I personally love the Unity engine and prefer to use it as it's the development environment I'm comfortable with. 
      I have used Unity for over a year and a few months, I'd consider myself an intermediate at the Engine, but to this day Unity still surprises me. 
      I live in the United Kingdom, I find it a bit strange to work with other programmers as the ones I've worked with tend to leave their code heavily unoptimised and I'm a on the go optimise kind of guy, I also like to get things done quickly.
      If you're a new team and need a programmer that has high levels of ambition and strives to maintain the motivation throughout the team, then I'm your guy. I don't care if you're just beginning because I'm all for helping people learn!
      To finish this off: I like to get things done and I like to get them done right the first time, if I fail I will do it again and again, etc, until I loose all motivation. So if you're a modeller or an artist, please don't leave me to do all the modelling/art as well as the programming and sound. I do have experience in all those areas but my main power is in programming and I'd prefer to keep it that way.
      [If this was posted in the wrong forum, sorry, I don't really know the layout of this website yet]
    • By Alexia
      Hi all,
      A small team are currently undertaking a fairly large game project involving multi-playing, taming and other complex game mechanisms.
      We are looking for someone who is experienced in programming a wide range of mechanisms, more information is on our discord server. It is also a learning experience and we wouldn't expect you to know how to do everything we wanted, but just ask that you would be willing to learn how to.
      If you are interested in joining the (rather long term project) just message me and i'll add you on discord.
      Thanks for your time,
  • Advertisement
  • Advertisement
Sign in to follow this  

Unity Grid-Based Map Generator

This topic is 783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm finishing up a game at the moment, but I've already got my next project in mind. I'm planning mentally at the moment, but wanted to share my ideas and get some feedback so I don't start on the wrong track when I actually begin developing this project.


I'm very interested in procedural generation, but have done little research. I kind of wanted to take my own stab at it first.


To provide a general overview:


I want to make a Grid-Based Map Generator as an add-on/tool in Unity. To clarify, this generator will be able to create both 2D tile-based maps, and 3D grid based maps. Essentially, I want to allow the user to provide any number of prefabs to the generator, along with parameters for each (isPassable, totalCountOfObjectInLevel, etc.). The only caveat is that each environmental prefab (walls, floor segments, doors, etc) must be a standard size (they can be any size, so long as they're all the same) that will sit inside one grid cell, and that any other items are equal to or smaller than the grid cell size. 


The generator will either be run through API calls at runtime to provide random generation (on a per-level type basis) while the user plays, or in the editor, allowing the developer to randomize levels which he can easily modify as he sees fit (the latter is my primary goal).


As a first step for developing the generator, I'll simply create a 2D array of ones and zeroes, 1 representing passable, and 0 representing non-passable. This array will be initialized with passable values, and then a start and end point will be set randomly. Next (and this is one area I'd like your opinions on), I'll implement the A* pathfinding algorithm to generate a path between the points (using 4-directional, not 8-directional cell movement), filling any cell that's not in the path with non-passable values. This seems like the biggest initial hurdle. 


Next, because the most efficient path between 2 points won't make for a very exciting level, I'll add a path complexity parameter to the generator, which will be an integer. This parameter will determine the number of points in the path (i.e. if complexity = 4, there will be a start and end point, plus 2 additional points). Then I'll use my A* implementation to find the path between point 1 and 2, 2 and 3, 3 and 4, and those paths combined will become the new entire path. I'll also create another parameter pathsCanIntersect, which, when false, will treat the passable values in the already solved paths as non-passable values, ensuring that no part of any one path can intersect with another (creating a single route between the start and end points, instead of a path with potentially multiple routes).  


The next thing I'll have to do at this point is create rooms along the path (another set of parameters minNumRooms, maxNumRooms, minRoomArea, and maxRoomArea), ensuring that each room does not create an additional route along the path (i.e. that a room does not connect two unconnected points on the path). There will have to be some considerations taken here that the area of the map can accommodate the number of rooms of a given size, but I'm not overly concerned with that at the moment.


After all of the above has been implemented, I won't be able to do much else with the 2D value array, and will have to switch over to arrays or lists of GameObjects which will hold prefabs. Here is another area where I'm not sure of the best approach. 


I'll then create an array or list that the user can drag and drop prefabs into, from which the map will be generated.


The simplest way to do this would be simply to have GameObjects in each cell, but that would require any developer using the tool to ensure that the GameObject in question had a script with 'isPassable' boolean in it which my generator could read. This would be cumbersome to any users of the tool, so an alternate solution would be to create a class similar to the following:

public class CellPrefab {

public GameObject prefab;
public bool isPassable;
public int maxCountInMap;
//etc, etc...


Then, my generator would easily be able to read isPassable and instantiate from this list. Using this solution, the 2D array would also be filled with CellPrefabs instead of GameObjects at the time of generation.


I know I'll have to take other things into consideration, like ensuring that any prefabs of a similar type (item, enemy, treasureChest, etc) are distributed in a way that seems realistic throughout the map (noise generation may be a potential solution?), that any items placed don't block the already generated path, whether a given prefab is a wall, floor, door or other type, and that certain items (particularly doors) have the correct rotation.


What are your thoughts on this? Have you spotted any major issues with my thinking, and how would you tackle this project?

Share this post

Link to post
Share on other sites

sounds complicated.


if you're trying to generate dungeons, it seems to be best to do it on a room by room basis. it can still be tile based, but is generated one room at a time.


for caverns and caves, algos that carve out open space from a level that is initially all impassable seem to work well.


you'll need a 2d map for the dungeon level (doors, open space, walls, etc).


you'll need a list of items on the level.


and a list of actors (might be lumped with items as generic game objects list - depends on engine used).


A*  tests or simple inspection can guarantee a path from random entrance to random exit.


since your primary goal is to generate maps for further human editing, i'd just let the humans erase walls as needed to ensure a path from entrance to exit and forget about A*. humans are still much better than A* at that kind of stuff. especially about which walls to erase to fix things.

Share this post

Link to post
Share on other sites

Thinking about what you've said, it seems like creating the rooms first would be quite a great deal simpler. It would save a lot of checks that rooms don't 'corrupt' the path. 


Granted, humans are better than A*, but I'd like to still have the paths be generated, if for nothing more than completeness--especially if I wind up trying to sell the generator. The developer can always modify the paths some time after generation. Maybe I'll simply add generatePaths flag that toggles the whole A* thing. 


However, what you've said has made me realize that instead of using pathComplexity to make the paths more random, using each room as a point in the path would accomplish the same goal, but save some fiddling. 


You mentioned cave/cavern algorithms... Are there any algorithms that come directly to mind?


Thanks for the input!

Share this post

Link to post
Share on other sites

-Render a simplex texture at several different scales

-Render a path texture from a to b

-Do a flood fill based on both the simplex and path

In other words the path just helps the flood get to point b in-case it didn't otherwise lie in the flood zone

All of this work can be done on the gpu many times faster than as a cpu algorithm. If this is something you might be interested in I can give more detail 

Share this post

Link to post
Share on other sites

-Render a simplex texture at several different scales

-Render a path texture from a to b

-Do a flood fill based on both the simplex and path

In other words the path just helps the flood get to point b in-case it didn't otherwise lie in the flood zone

All of this work can be done on the gpu many times faster than as a cpu algorithm. If this is something you might be interested in I can give more detail 

I have to be honest: most of what you just said is completely foreign to me. However, it does sound interesting. Could you elaborate?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement