×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Minigame] Mouse Maze
[Minigame] Mouse Maze
Firestonnne
« Citoyen »
1431880920000
    • Firestonnne#0000
    • Profil
    • Derniers messages
    • Tribu
#1
  0
This is a minigame in which you have to navigate a maze that is randomly generated while in nightmode. The first mouse to get the cheese and bring it back to the whole wins the round and a new maze loads. Also there is no time limit and the maze will not switch until a mouse can bring back the cheese. Due to random numbers and such some mazes will be easier then others.

This is the link to the script on pastebin

If you do no want the maze to be in darkness (not as fun), then you can set NIGHTMODE to false in line 1.

Here is an example of a maze generated by the script:

http://s18.postimg.org/622p4ahvd/ex1.png

When the script loads, you will actually be above the maze until it finishes building. Once the maze is completely built, you will be teleported the hole where you will then have to search for the cheese.

The maze generation is based off this "recursive backtracker" algorithm I found on Wikipedia, so I did not come up with it but rather wrote it into Lua, and made it specifically work with Transformice.

If you want to the maze algorithm from this script, just copy the entire Maze object and follow this api:
First initialize the maze by calling Maze.init(). It can take up to four parameters:
seed : the seed for the random number generator -- Defaults to current time when nil
cell size : the width and height for each "box" of the maze -- Defaults to 50 when nil
width : the number of cells wide the maze is -- Defaults to the max amount of cells that can fit on a standard 800 x 400 map when nil
height : the number of cells high the maze is -- Defaults to the max amount of cells that can fit on a standard 800 x 400 map when nil

Calling Maze.generate() will create the maze and store it into memory. Maze.startCell (x / y object) and Maze.winCell (x / y object) are updated at this time. They are used to designate the start and end of the maze (note: the x and y are in the number of cells, not pixels. You can use Maze.util.toGlobal( <num> ) to get this value in pixels relative to the map).
You can then call Maze.build() to create the wooden platforms. However, this only creates the wooden platforms. It does not delete old ones or add the cheese or hole. These should be taken care of by calling a tfm.exec.newGame().


Also due to me being lazy and not sorting out all the bugs unknown complications, sometimes the map will fail to generate completely or get stuck leaving the mice stranded outside the maze. If that occurs restart the script or leave the room and come back.
Rectop
« Citoyen »
1431883800000
    • Rectop#0000
    • Profil
    • Derniers messages
    • Tribu
#2
  0
Seem fun and impossible !

Random generation is sometimes generous \o/
http://i.imgur.com/d1wgJxJ.png
Firestonnne
« Citoyen »
1431891780000
    • Firestonnne#0000
    • Profil
    • Derniers messages
    • Tribu
#3
  0
Yeah I just discovered that if the cheese and hole spawn super close and you get it back within 3 seconds, it won't let the tfm.exec.newGame() function be called, and so it will generate a new maze on top of the old one and won't cycle. Fixable, but I won't worry about it since the game breaks itself in other ways.
Randallgun
« Citoyen »
1431984180000
    • Randallgun#0000
    • Profil
    • Derniers messages
#4
  0
So can we play it like right now.
Error_404
« Consul »
1432172100000
    • Error_404#0000
    • Profil
    • Derniers messages
#5
  0
Isn't like Labryingt?
Csonewforyou
« Consul »
1432176300000
    • Csonewforyou#0000
    • Profil
    • Derniers messages
    • Tribu
#6
  0
Bugembo a dit :
Isn't like Labryingt?

Labyrinth*


I can play it now!
Error_404
« Consul »
1432217040000
    • Error_404#0000
    • Profil
    • Derniers messages
#7
  0
Csonewforyou a dit :
Bugembo a dit :
Isn't like Labryingt?

Labyrinth*


I can play it now!

The name is hard to remember u.u
Firestonnne
« Citoyen »
1432324620000
    • Firestonnne#0000
    • Profil
    • Derniers messages
    • Tribu
#8
  0
Bugembo a dit :
Isn't like Labryingt?

Wait is this already a thing in tfm?
Error_404
« Consul »
1432378920000
    • Error_404#0000
    • Profil
    • Derniers messages
#9
  0
Firestonnne a dit :
Bugembo a dit :
Isn't like Labryingt?

Wait is this already a thing in tfm?

Gusse so.
/module labyrinth
Firestonnne
« Citoyen »
1432392360000
    • Firestonnne#0000
    • Profil
    • Derniers messages
    • Tribu
#10
  0
FML
modos remove thread
Conester
« Citoyen »
1432830780000
    • Conester#0000
    • Profil
    • Derniers messages
#11
  0
noooooo your version of the game is so much more fun
Haku
« Sénateur »
1433338500000
    • Haku#0807
    • Profil
    • Derniers messages
#12
  0
Why feel bad about there being another maze game already? This one looks awesome and you even shared the script so it can also be useful for other people willing to learn or modify it.

Also #labyrinth uses a totally different concept with the maze changing every 15 seconds.

Since we're talking about mazes here, some nice places to learn more about maze algorithms, in case anyone is interested:
http://www.jamisbuck.org/presentations/rubyconf2011/index.html
http://www.jamisbuck.org/mazes/

From what I've read, recursive backtracker seems to be one of the best and more popular for maze generation.

I think the problem with your script lies in how the cheese and hole locations are generated. There should be a better way to do that.
Tat
« Censeur »
1435928520000
    • Tat#0095
    • Profil
    • Derniers messages
    • Tribu
#13
  0
yeah some times the cheese is blocked or there is no way to get our of hole lol
Sunflowers
« Censeur »
1460554800000
    • Sunflowers#3568
    • Profil
    • Derniers messages
#14
  0
Brâââââânză *-* (24.27s)
  • Forums
  • /
  • Transformice
  • /
  • Modules
  • /
  • [Minigame] Mouse Maze
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27