• 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 Tile-based room spawning (Unity3d)

This topic is 960 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

The title mostly says it.


Hello, I'm attempting to make a tile-based room spawner for my mini game. The idea is to spawn the room in tiles, so right now I have a simple room spawner that actually spawns a room by randomly choosing a number for the length and the width of the room (and also height but ill save that for later). Currently it is spawning it like it should but my goal is to have randomly generating rooms with either columns and stuff, Maybe ill show a picture as a picture says a thousand words.



That picture explains my ideal goal, now how can I do dis?? Heres my current code.

#pragma strict

var floorBoundary : GameObject;
var wallBoundary : GameObject;

var tileOffest : float = 0.0f;
var wallOffest : float = 0.0f;
var maxRoomSize : int = 10;

function Start () {
	var width : GameObject = new GameObject("Width");
	width.tag = "width";
	Random.seed = Random.value * 500;
	var roomWSizer : int = Random.Range(1, maxRoomSize);
	var roomLSizer : int = Random.Range(0, maxRoomSize);
	for(var i : int = 0; i < roomWSizer; i++){ //width
		var posW = Vector3(tileOffest * i, 0.0f, 0.0f);
		var floorBoundW : GameObject = Instantiate(floorBoundary, posW, transform.rotation);
		var RoofBoundW : GameObject = Instantiate(floorBoundary, Vector3(posW.x, 9.4f, posW.z), transform.rotation);
		RoofBoundW.transform.localScale.y = -1;
	for(var j : int = 0; j < roomLSizer; j++){ //length
		var posL = Vector3(0.0f, 0.0f, tileOffest * j + tileOffest);
		var roomL : GameObject = Instantiate(width, posL, transform.rotation);
	var roomWidth : int = roomWSizer + roomWSizer;
	var roomLength : int = (roomLSizer + 1) * 2;
	//var wFindG : GameObject = GameObject.FindGameObjectWithTag("width");
	//var wFindA : GameObject = wFindG.transform.;
	for(var w1 : int = 0; w1 < roomWidth; w1++){ //wall width 1
		var wall1pos = Vector3(((tileOffest/2) * w1) - 6, wallOffest, -(tileOffest/2));
		var wall1rot = Quaternion.Euler(90,0,0);
		var wall1bound : GameObject = Instantiate(wallBoundary, wall1pos, wall1rot);
	for(var l1 : int = 0; l1 < roomLength; l1++){ //wall width 1
		var wall3pos = Vector3( -tileOffest/2, wallOffest, ((tileOffest/2) * l1) - 6);
		var wall3rot = Quaternion.Euler(90,90,0);
		var wall3bound : GameObject = Instantiate(wallBoundary, wall3pos, wall3rot);
	for(var l2 : int = 0; l2 < roomLength; l2++){ //wall width 1
		var wall4pos = Vector3( (tileOffest/2) * roomLength/2, wallOffest, ((tileOffest/2) * l2) - 6);
		var wall4rot = Quaternion.Euler(90,-90,0);
		var wall4bound : GameObject = Instantiate(wallBoundary, wall4pos, wall4rot);


Share this post

Link to post
Share on other sites

There's tons of information in the web about procedural generation, specially of dungeons and such.


Here's one lecture I attended that was very helpful (It's from Unity's Unite conference, but the concepts and algorithms are not unity-specific)


Share this post

Link to post
Share on other sites

One example of more "organic" rooms made by modifying rectangular rooms can be found in this GDC video about Shattered Planet. Look for "geometry decay" to remove tiles and, if you wish, "crumbly tiles" for adding some (also the crumbly tiles shown in the video are just decoration). In fact, the way chosen was to assign a probability to each tile where tiles in corners have a higher probability to decay then tiles on an edge, and tiles on an edge have a greater probability than tiles in the inside. Tiles that need to stay have 0 probability. Then iterate the tile grid and generate a PSN for each one and set the tile to nil if the PSN is below the tile's decay probability value.


In the end you have a 2D array where you store at which index you have a tile at all and, if so, which tile. Then iterate the array and determine whether the tile has a neighbor at some of its 4 edges. For a room grid of possibly n by m tiles, the tile at index [i,j] has no neighbor

    with 0 <= i <= n and 0 <= j <= m :

    * to the north if j == m-1 orElse tile[i,j+1] == nil

    * to the south if j == 0 orElse tile[i,j+1] == nil

    * to the west if i == 0 orElse tile[i-1,j] == nil

    * to the east if i == n-1 orElse tile[i+1,j] == nil

(notice that I've used the orElse operator here to denote that the tile[] must be checked only if the condition part on the left hand side is false).


For each tile and each of its edges place a suitable wall if there is no neighbor.

Share this post

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

  • Advertisement