none
Game Mapping Help RRS feed

  • Question

  • So I made a game (XNB002) and have question regarding how to map it per say . 

    So if you run the game (you need LD extension installed) you will find it to generate a map like so 

    My question is there a way to easily determine if how many paths to one square there are in the game? IE so there is only one path to the a section of the map (I want to have at least two if possible ) 


    Friday, December 11, 2015 1:22 AM

Answers

  • Here is a pathmapping program that can determine if the game is solvable:

    XNB002-1

      Press any key to make it generate a pathmap, then click anywhere on the pathmap to find the way back to start.

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11


    • Edited by Zock77Editor Friday, December 11, 2015 10:05 PM
    • Marked as answer by a65001 Friday, December 11, 2015 10:54 PM
    Friday, December 11, 2015 10:03 PM
    Answerer
  • There isn't a simple way I think.

    What I did when creating a maze for a game was several steps - I had borders for each cell i.e. the connection between cells.

    1] start with all cells blocked off

    2] randomly connect some cells (open some borders in my case)

    3] randomly open up some cells by removing a border on some cells that have 3 or 4 borders

    4] Find regions that remain completely unconnected and open a border to connect them

    This is my sample code, MBP170 - uncomment all lines labelled 'Debgging to see the last step and the opened borders (red) and shows the unconnected regions - image below.

    And a game version using this maze method, KPF653.
    • Edited by litdevModerator Friday, December 11, 2015 9:16 PM
    • Marked as answer by a65001 Friday, December 11, 2015 10:54 PM
    Friday, December 11, 2015 8:42 PM
    Moderator

All replies

  • So you want the computer to figure out how to get from one point to another? Or do you want it to generate a map with at least two options?

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11

    Friday, December 11, 2015 5:52 PM
    Answerer
  • There isn't a simple way I think.

    What I did when creating a maze for a game was several steps - I had borders for each cell i.e. the connection between cells.

    1] start with all cells blocked off

    2] randomly connect some cells (open some borders in my case)

    3] randomly open up some cells by removing a border on some cells that have 3 or 4 borders

    4] Find regions that remain completely unconnected and open a border to connect them

    This is my sample code, MBP170 - uncomment all lines labelled 'Debgging to see the last step and the opened borders (red) and shows the unconnected regions - image below.

    And a game version using this maze method, KPF653.
    • Edited by litdevModerator Friday, December 11, 2015 9:16 PM
    • Marked as answer by a65001 Friday, December 11, 2015 10:54 PM
    Friday, December 11, 2015 8:42 PM
    Moderator
  • Zock77 , 

    I want the computer to figure out if the game is solvable . Like the map above would not be solvable since square (19,11) has only one entrance (and in this game if you been to a square you cannot revisit it. 

    LitDev,
    I did not know we could do Arrays 3 levels deep. Thanks for that knowledge . Do you think my idea is at all doable or is your method the best / most efficient way ? 
    • Edited by a65001 Friday, December 11, 2015 9:57 PM
    Friday, December 11, 2015 9:47 PM
  • Here is a pathmapping program that can determine if the game is solvable:

    XNB002-1

      Press any key to make it generate a pathmap, then click anywhere on the pathmap to find the way back to start.

    It is written: "'As surely as I live,' says the Lord, 'every knee will bow before me; every tongue will acknowledge God.'" Romans 14:11


    • Edited by Zock77Editor Friday, December 11, 2015 10:05 PM
    • Marked as answer by a65001 Friday, December 11, 2015 10:54 PM
    Friday, December 11, 2015 10:03 PM
    Answerer
  • Your game code so far is great and certainly doable - my way was just another approach to give some ideas.

    Like Zock I'm  not totally sure exactly what you want the maze properties to be.  To make sure it is solveable a varient of the method (4) I used could be a solution.  i.e. identify separate regions after some initial random linking and link (open them up) to ensure all parts are reachable.



    Friday, December 11, 2015 10:09 PM
    Moderator
  • Both Zock and Litdev thank you for your help. I will spend some time analyzing both of your suggestions and trying to implement one that fits my maze game. Thanks for your awesome work and time. 
    Friday, December 11, 2015 10:54 PM
  • Perhaps if a route that dosen't cross itself it required, then:

    first choose a route randomly that is vaild, then add yellow targets (on the route) along the way, then randomly add some black blockers (not on the route) - there may be several solutions, but you are sure there is a least one - the original random route.


    Friday, December 11, 2015 11:04 PM
    Moderator