GM:S 1.4 Very Large World Map

Discussion in 'Programming' started by atxgamedesigner, Jun 26, 2016.

  1. Hello,

    I'm starting to piece together some of the mechanics behind a game Idea that I have, and am trying to figure out how to go about building the game world.

    The game world is fairly large - far too large for GM to handle in one seamless room.
    So I was thinking about breaking up the world into smaller "chunks", and transition into them - kind of like the old Legend of Zelda games.

    I'm just not sure how to go about this.
    Specifically, how to know which chunk of the map I'm in, and which chunk to load based on where my player is.
    Also, how I would load/destroy instances of objects when the new chunks are loaded, and the old ones are no longer currently in use.
    There is going to be a lot going on, so I really want to be as performance conscious as I can.

    If anyone can lend some advice, it would be much appreciated.

    Below is a quick sketch to help you understand what I mean by breaking the map up into smaller pieces.

  2. jo-thijs

    jo-thijs Member

    Jun 20, 2016
    You can keep track of which chunck you're currently in by keeping 2 global variables, e.g. global.roomX, global.roomY
    to keep track of the column and row of the current chunck.

    How to load and destroy instances when changing chuncks depends on how you want to design your chuncks
    and how you want to transition between chuncks.

    Do you want it to be exactly like in The Legend Of Zelda?
  3. It doesn't have to be exactly like The Legend of Zelda - I just want some kind of transition between each chunk.
    I'm really just trying to mask the fact that the world is made of smaller pieces.
    I hate playing games where there is obvious loading that takes place between regions - I don't like that interruption in gameplay - so I'm trying to avoid that with my game.

    And maybe the whole chunk loading idea isn't the best way to go about this...
  4. tserek

    tserek Member

    Jun 22, 2016
    Your question is complicate and there is no one clear answer to how achieve the transition. If you have lots of stuff to load you may see a lag/gap before the stuff is loaded. For example you can make a custom room fade to black/fade to white between the load process.

    Traditional Zelda style room transition when player hits the room edge:
    - Deactivate player, destroy enemies, walls, bullets and other things.
    - Create a temp player with walk animation which walks opposite direction (backwards) to the next room about to enter.
    - Load next room background, move the current and the next room background to opposite direction. These makes the illusion the player is moving from room to another.
    - When both is done, the backgrounds and the temp player movement:
    - Destroy temp player, activate the real player on it's position.
    - Load room instances.
    Last edited: Jun 26, 2016
  5. jo-thijs

    jo-thijs Member

    Jun 20, 2016
    Well, if you don't care too much about the transitions,
    you can just simply make every chunck a seperate room.

    You would initialize a global 2 dimensional array (grid) at the start of your game with what rooms come at which location on the map.
    You would then keep track of 3 (or more) global variables:
    a variable roomX to keep track of the current column on the map / in the grid;
    a variable roomY to keep track of the current row;
    a variable playerX to keep track of the x coordinate of the player inside a chunck and
    a variable playerY to keep track of the y coordinate of the player inside a chunck.

    Every time the player crosses the border of the room, you check in which direction the player is moving and you update the 4 global variables.
    You then go to the next room on the grid and in the create event of the player object,
    you set its x and y coordinates to the values of global.playerX and global.playerY.

    You might also want to keep track of what enemies have been killed already.
    There are many different ways to manage this though.
    You could remember the status of every room,
    you can remember the status of every N last visited rooms,
    you can remember the status of the N closest rooms,
    you can split up the map in zones and remember the status of every room in the current zone,

    Anyway, you'll want to represent a status of a room as an array containing the id of every destroyed instance.
    You'd then loop through this array when entering the room again and destroy every instance in this array.
    F_Clowder and atxgamedesigner like this.
  6. Than you jo-thijs, that was incredibly helpful!
  7. NightFrost

    NightFrost Member

    Jun 24, 2016
  8. Yal

    Yal GMC Memer GMC Elder

    Jun 20, 2016
    You could have the world split up by single-screen, empty "indoors" areas (not just actual indoors areas, but also small forest clearings covered in trees, narrow canyons, and whatever matches the theme) that gives you a reason to fade out the screen and change rooms temporarily. These antechambers would give the player a sense of anticipation for the next area, give them a brief rest between areas... and let you change from one big room to another without the loading feeling like the ONLY reason for it.
  9. Thanks Yal - I appreciate the input.
  10. lolslayer

    lolslayer Member

    Jun 23, 2016
    You can create a seamles room for the whole map with the help of a chunck system though...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice