Forum begins after the advertisement:
[Guide] Notable Map Generation Errors
Home › Forums › Video Game Tutorial Series › Creating a Rogue-like Shoot-em Up in Unity › [Guide] Notable Map Generation Errors
- This topic has 15 replies, 9 voices, and was last updated 1 week, 4 days ago by
Lukas Kazda.
-
AuthorPosts
-
July 11, 2023 at 3:32 am #11528::
Introduction
Following the release of Part 2 in which we first touched upon Map Generation, a lot of you have pointed out several notable issues with the system. So, I’ve put together this running list to help us keep track of them. I’ll mark each problem as
[SOLVED]
or[UNSOLVED]
, and keep this updated. Feel free to comment or make a new topic if you have any new errors!Chunks do not spawn when player is pushed
[SOLVED]
Some of may you have noticed that when the player gets pushed by the enemies, the chunks fail to spawn.
This issue has been solved in Part 11.
Chunks spawn inconsistently when player moves diagonally
[SOLVED]
A number of you reported that when the player moves diagonally, the chunks adjacent to the diagonal one fail to generate, interrupting the map’s consistent generation.
This issue has been solved in Part 11.
has upvoted this post. March 26, 2024 at 4:51 pm #13635::Just to add on to the information from Xavier above, below are some topics related to Part 2 that may be helpful to you as well:
May 26, 2024 at 9:17 pm #14781::Here’s a map generation error that one of our viewers ran into (which was solved): https://blog.terresquall.com/community/topic/part-11-map-generation-error/
June 8, 2024 at 7:30 am #15046::one problem that i am running into is that the chunk gets turned into a collider and boost my character out of the chunk.
nvm figured it out.
June 8, 2024 at 2:16 pm #15047::one problem that i am running into is that the chunk gets turned into a collider and boost my character out of the chunk.
For anyone else reading this, he probably forgot to check the Is Trigger property on his chunk collider.
June 24, 2024 at 8:05 pm #15139::Just nothing something that @krzysztofpuchalski4224 pointed out about the Part 2 video.
At 25:12 you should assign Terrain Chunk in Chank Trigger script for each copied Trigger. This isn’t shown in the video
October 22, 2024 at 3:58 pm #16137::Chunks still not loading properly after Part 11?
After Part 11, if your chunks still don’t load sometimes when moving diagonally like this:
View post on imgur.com
Please check out this topic: https://blog.terresquall.com/community/topic/part-11-chunk-not-loading-correctly-and-enemies-are-multiplied-when-spawning/
February 6, 2025 at 5:33 pm #17186February 6, 2025 at 5:43 pm #17187February 7, 2025 at 12:16 am #17188February 9, 2025 at 6:32 am #17224::I have an issue where my map controller never gets updated and the current chunk stays set to the starting chunk
here is my chunk trigger code
void Start() { mc = FindObjectOfType<MapController>(); if (mc == null ) { Debug.Log("map controller not found!"); } } private void OnTriggerStay2D(Collider2D col) // Use OnTriggerEnter2D { if (col.CompareTag("Player")) { Debug.Log("player entered trigger for:"+ targetMap.name); mc.currentChunk = targetMap; // Set currentChunk } } private void OnTriggerExit2D(Collider2D col) { if (col.CompareTag("Player")) { if( mc.currentChunk == targetMap ) { mc.currentChunk = null; } } }
}
here is my map controller code
void Start() { pm = FindObjectOfType<Player>(); } // Update is called once per frame void Update() { ChunkChecker(); if(!currentChunk) { return; } } public void ChunkChecker() { if (!currentChunk) { return; } if (pm.MoveInput.x > 0 && pm.MoveInput.y == 0) //right { //player.transform.position + new Vector3(24, 0, 0) //currentChunk.transform.Find("Right").position if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Right").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Right").position; SpawnChunk(); } } else if (pm.MoveInput.x < 0 && pm.MoveInput.y == 0) //left { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Left").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Left").position; SpawnChunk(); } } else if (pm.MoveInput.x == 0 && pm.MoveInput.y > 0) //up { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Up").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Up").position; SpawnChunk(); } } else if (pm.MoveInput.x == 0 && pm.MoveInput.y < 0) //down { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Down").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Down").position; SpawnChunk(); } } else if (pm.MoveInput.x > 0 && pm.MoveInput.y > 0) //right up { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Right Up").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Right Up").position; SpawnChunk(); } } else if (pm.MoveInput.x > 0 && pm.MoveInput.y < 0) //right down { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Right Down").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Right Down").position; SpawnChunk(); } } else if (pm.MoveInput.x < 0 && pm.MoveInput.y > 0) //left up { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Left Up").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Left Up").position; SpawnChunk(); } } else if (pm.MoveInput.x < 0 && pm.MoveInput.y < 0) //left down { if (!Physics2D.OverlapCircle(currentChunk.transform.Find("Left Down").position, checkerRadius, terrainMask)) { noTerrainPosition = currentChunk.transform.Find("Left Down").position; SpawnChunk(); } } } void SpawnChunk() { int rand = Random.Range(0, terrainChunks.Count); Instantiate(terrainChunks[rand], noTerrainPosition, Quaternion.identity); }
}
I have triple check all the fields are set correctly in unity so idk what’s wrong
February 9, 2025 at 9:02 am #17225February 9, 2025 at 9:03 am #17226February 9, 2025 at 12:07 pm #17233::So I checked to see if I could check that the ontriggerStay2d was even communicating with my map controller at all and it does not seem to be triggering at all when I enter the the collider it won’t even trigger a debug.log it looks like istrigger is set to ture for all instances of my trigger and player etc etc so ii don’t have a clue whats going on maybe I just need to restart the whole process and see if the problem goes away in a fresh project
February 9, 2025 at 12:13 pm #17234::OMG I fixed it lol I didnt have rigigbody 2d facepalm lol thanks for your help the tip about the boxcollider 2d sent me on the right track to notice that I was missing a rigidbody2d
-
AuthorPosts
- You must be logged in to reply to this topic.