Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Trying to create a game based in an infinate ikea (SCP-3008)

Discussion in 'Scripting' started by unity_NK9MXpw0mbtWQQ, May 12, 2021.

  1. unity_NK9MXpw0mbtWQQ

    unity_NK9MXpw0mbtWQQ

    Joined:
    Oct 13, 2020
    Posts:
    4
    I'm trying to make a game based off the scp-3008 or the Infinite Ikea, but am unsure how to achieve an infinite terrain that generates the furniture in a random but consistent way, and I am aware that this might be a difficult task but I'm ready to tackle this
     
  2. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,590
    I'm not familiar with the Infinite Ikea one (tho SCP is a term), so it depends a bit on how exactly the terrain should look. Like, maybe there are walls and only one direction is infinite, or it is infinite in all directions. It doesnt really matter too much tho, as the topics you should look into are the same either way.

    Definitely look into chunking. You need to be able to generate one chunk of your infinite ikea at a time. This is commonly done in procedural generation and should be mentioned in a lot of tutorials about the topic. In your case it should be even easier, since you dont actually need to generate terrain, but instead just need to place furniture on a groundplane - except the ikea has multiple floors or smth.
    The general idea is to generate the chunks in a certain distance around the player. When the player moves, new chunks are getting generated and old ones get deactivated (and potentially eventually deleted). Depending on the complexity of the procedural generation, it may be required to implement it multi-threaded, but i dont think this will be a requirement for your type of generator, since the actual calculations required would likely be very light weight.

    You need to decide for yourself what kind of patterns are allowed for the furniture. Since you are not necessarily able to access information about neighboring chunks (which may not have been generated yet), you may have to rely on some 2D (or 3D) gradient noise function like Perlin, and use its properties to help you decide where to place furnitude, in a way that seems coherent over chunk borders. You will likely run into this topic in general, when looking into procedural generation.
    You may find something more closely to what you are trying to do, but i think this would be helpful background knowledge:
     
  3. unity_NK9MXpw0mbtWQQ

    unity_NK9MXpw0mbtWQQ

    Joined:
    Oct 13, 2020
    Posts:
    4
    Thank you for the reply, The Infinite IKEA is indeed infinite in all sides and is only one floored, the hardest part I would imagine is the food courts and telling the game what part is hallway, and what part furniture is allowed on, also would you know if shelves would be an issue? I'm not sure how the unloading and reloading of chunks would affect furniture on a shelf. Last note: Would I have to build a part of the map to give an idea, or can I have it all set up in script? Either way doesn't matter, but I'm new to infinite generation. Thanks again for your help!
     
  4. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,590
    You usually define the full behavior in scripts.
    In your case it makes sense to have prefabs for the items, shelves, ground plane, .. of course.

    If you have items on shelves that can be taken, youll need to memorize that. While the chunk is still in memory, memorizing it in memory is fine. Once the chunk gets destroyed you would want to write that to a save file. When loading a chunk for some coordinate (x,y) simply see if you have data about that chunk, and if so, apply the changes.

    As long as you make sure to rely on the same seed for random calculations (per save game), and / or the noise function to dictate your design, every time you generate a chunk at the same location, it should look the same, with the same placements of shelves, furniture, items and whatnot. Even after restarting the game.

    Depending on how many items there are on your shelves, you may need to look into optimizations later on. Object pooling, or even combining all the items to a single mesh per chunk would be good approaches, IF you notice performance problems. However, especially as a beginner, dont stress performance optimizations too much. As a rule of thumb only start optimizing once you actually run into problems and used the profiler to identify what hurts the framerate.
     
  5. unity_NK9MXpw0mbtWQQ

    unity_NK9MXpw0mbtWQQ

    Joined:
    Oct 13, 2020
    Posts:
    4
    seems like a good plan, thank you again for the help. I'm sure this wont be super easy to code (especially without almost any experience) but I will try to find something out. Thanks again for the help!
     
  6. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,724
    By the way if you're planning on publishing/releasing this game, be careful about trademark/copyright laws.
     
    Yoreki likes this.
  7. unity_NK9MXpw0mbtWQQ

    unity_NK9MXpw0mbtWQQ

    Joined:
    Oct 13, 2020
    Posts:
    4
    \
    Don't worry, this is more for me and a small group of friends to goof off in, I have no intent to make money or release this.