Share My Creation Random Maze Generator

Discussion in 'B4J Share Your Creations' started by ilan, May 2, 2016.

  1. ilan

    ilan Expert Licensed User

    hi

    i am just playing around with b4j and i created a maze generator lib that creates randomly a full maze (with animation)

    the maze is stored with custom types to a list so you can easily move a character in it since you have all walls stored.

    you can change the cell size either if you want. this maze lib (class) can be used in b4i,b4a,b4j

    it is not finished now but i will upload the jar so you can see how it works.
    after the maze is finished it will start again and create a new random maze.

    you can create with this class very simple a maze game
    (code size < 150 lines!!)

    i am using this algorithm https://en.wikipedia.org/wiki/Maze_generation_algorithm#Recursive_backtracker

    what do you think?

    EDIT (02/01/2018): source code added, have fun! :)

    maze.png
     

    Attached Files:

    Last edited: Jan 2, 2018
    miker2069, BeneBarros, paulgr and 6 others like this.
  2. aeric

    aeric Active Member Licensed User

    if the blue square at top left corner is the start point, where is the end point? :)
     
  3. ilan

    ilan Expert Licensed User

    you can put a flag wherever you want (randomly) and character needs to get to this flag
    or use 1 of the other 3 edges as the finish point.

    i was thinking more of collecting keys and unlock gates and like this get to the finish point. including adding enemies that hunts you and make nice lights effect
    maybe you going with a torch...

    this is just the generator but the game concept can be unlimited ;)
     
  4. wonder

    wonder Expert Licensed User

    I love it!! :D
     
  5. Eme Fibonacci

    Eme Fibonacci Active Member Licensed User

    Hello, could you publish the source code?
    I would like to try to implement some things.

    If Yes Thank you.
    If No Thank you anyway.
     
  6. derez

    derez Expert Licensed User

    A game I made few years ago:
    1.png 2.png 3.png 4.png 5.png
    You can also go inside the maze (pic 5)...
     
    ilan likes this.
  7. ilan

    ilan Expert Licensed User

  8. derez

    derez Expert Licensed User

    Yes, you can go from top view to 3d and see the path you did, also you see in the 3d view your path marked by "x" (if you look back).
    My experience - it is very hard to reach the end in 3d view only...
     

    Attached Files:

    • 6.png
      6.png
      File size:
      56.2 KB
      Views:
      13
    • 7.png
      7.png
      File size:
      276.3 KB
      Views:
      16
  9. ilan

    ilan Expert Licensed User

    looks very interesting derez. very nice! :)
     
  10. derez

    derez Expert Licensed User

  11. ilan

    ilan Expert Licensed User

    source available in post #1. this is my first free "B4X Share" in 2018! :)
     
    DonManfred likes this.
  12. Eme Fibonacci

    Eme Fibonacci Active Member Licensed User

    Thank you, I made one too, I will compare the results.
     
Loading...