Maze Generator -
ThePhenix - 24.11.2017
Maze Generator
Description:
This is a script I had done a long time ago and I didn't find any use for it. Hopefully, someone could use it to make some games or anything. It uses DFS, Prim's, backtrack algorithms.
Functions:
PHP код:
native CreateInGameMaze(Float:origin_x, Float:origin_y, Float:origin_z, length, width, walls_color = 0x000000FF, spaces_color = 0xFFFFFFFF, start_color = 0xFF0000FF, bool:use_backtrack = true, bool:use_prim = false, bool: no_dead_end = false);
native CreateMazeBitmap(const filename[], length, width, walls_color = 0x000000FF, spaces_color = 0xFFFFFFFF, start_color = 0xFF0000FF, bool:use_backtrack = true, bool:use_prim = false, bool: no_dead_end = false);
native CreateColorfulMaze(Float:origin_x, Float:origin_y, Float:origin_z, length, width, spaces_color = 0xFFFFFFFF, start_color = 0xFFFFFFFF, bool:use_backtrack = true, bool:use_prim = false, bool: no_dead_end = false);
Images:
share photo free
Bitmap:
Source code:
https://github.com/ThreeKingz/mazege...aster/maze.inc
Credits:- ThreeKingz
- Crayder
- Purpy Pupple for the original implementation in c++
- ****** for y_bitmap
- Incognito for streamer
Re: Maze Generator -
Gammix - 24.11.2017
Nice!
Re: Maze Generator -
Kaperstone - 24.11.2017
What is that `use_backtrack` and `use_prim`?
Re: Maze Generator -
ThePhenix - 24.11.2017
Quote:
Originally Posted by Kaperstone
What is that `use_backtrack` and `use_prim`?
|
If you enable them, you'll be using those algorithms to generate the mazes. You can't enable backtrack and prim at the same time though.
Re: Maze Generator -
ExTaZZ69 - 24.11.2017
Might be useful for mini games. Nice conversion from c++
Re: Maze Generator -
Eoussama - 24.11.2017
Amazing, I can already imagine how I'd use this creatively.
+REP!
Re: Maze Generator -
ShapeGaz - 24.11.2017
Nice
Re: Maze Generator -
Paulthaz - 25.11.2017
I like it, but is there any way to delete the labyrinth?
Re: Maze Generator -
OneDay - 27.11.2017
Where is start and end?
Quote:
Originally Posted by ThePhenix
If you enable them, you'll be using those algorithms to generate the mazes. You can't enable backtrack and prim at the same time though.
|
Better:
PHP код:
enum e_maze_algorithm {
maze_algorithm_prim,
maze_algorithm_backtrack
}
CreateInGameMaze(Float:origin_x, Float:origin_y, Float:origin_z, m_height, m_width, walls_color = 0x000000FF, spaces_color = 0xFFFFFFFF, start_color = 0xFF0000FF, e_maze_algorithm:algorithm = maze_algorithm_backtrack, bool: no_dead_end = false);
Can add more and just only use one.
Re: Maze Generator -
ThePhenix - 27.11.2017
Quote:
Originally Posted by OneDay
Where is start and end?
Better:
PHP код:
enum e_maze_algorithm {
maze_algorithm_prim,
maze_algorithm_backtrack
}
CreateInGameMaze(Float:origin_x, Float:origin_y, Float:origin_z, m_height, m_width, walls_color = 0x000000FF, spaces_color = 0xFFFFFFFF, start_color = 0xFF0000FF, e_maze_algorithm:algorithm = maze_algorithm_backtrack, bool: no_dead_end = false);
Can add more and just only use one.
|
Not really, because you can use multiple algorithms at the same time.
Код:
CreateMazeBitmap("maze_test.bmp", 45, 45, 0x000000FF, 0xFFFFFFFF, 0xFF0000FF, true, false, true);
In this particular case, I'm using backtrack and no_dead_end at the same time.
Now using an enum to place all the available algorithms is not a bad idea.
The red colored object or cell is supposed to be the start, the end could be anywhere really.
Re: Maze Generator -
N0FeaR - 23.02.2018
Good job i like this!
Re: Maze Generator -
RogueDrifter - 23.02.2018
whoa this actually rocks
Re: Maze Generator -
Pottus - 23.02.2018
We really need to implement this into Texture Studio. I have looked at the code and yeah we would need to do some customizing. I am thinking the best way to do it would be like how the objectmetry system works by keeping a stack of objects then just applying them to Texture Studio when the results are desired.
Re: Maze Generator -
Crayder - 24.02.2018
Quote:
Originally Posted by Pottus
We really need to implement this into Texture Studio. I have looked at the code and yeah we would need to do some customizing. I am thinking the best way to do it would be like how the objectmetry system works by keeping a stack of objects then just applying them to Texture Studio when the results are desired.
|
Question, do you use the latest versions of TS?
Re: Maze Generator -
Zeth - 24.02.2018
Amazing!
Re: Maze Generator -
Pottus - 25.02.2018
Quote:
Originally Posted by Crayder
Question, do you use the latest versions of TS?
|
I need to download it. I have been looking through this include and have a pretty good idea what to do. We need to move this and make it accessible as a global variable. The name should be changed to OBJStack as well.
Код:
static OBMStack[MAX_PLAYERS][MAX_OBM][OBMINFO];
The next part is rewriting the maze generator to work with Texture Studio. Right now it just does what it does fine but it needs to be able to interact with the object stack (easy stuff there). The pain in the ass stuff is creating the editing interface.
It has been such a long time since I have done anything to TS I am actually pretty excited to get this off the ground. Now I see that the objectmetry module has a feature that should be it's own support system.
Re: Maze Generator -
Crayder - 25.02.2018
Yeah, and we also need to prevent infinite loops when putting models in before radius and stuff xD
Re: Maze Generator -
ThePhenix - 25.02.2018
Quote:
Originally Posted by Pottus
We really need to implement this into Texture Studio. I have looked at the code and yeah we would need to do some customizing. I am thinking the best way to do it would be like how the objectmetry system works by keeping a stack of objects then just applying them to Texture Studio when the results are desired.
|
I updated the code with an improved version. The code I originally published wasted a lot of memory and took a long time to compile. I optimized the code by storing all the required information into a single PAWN cell (4 bytes) including boolean information like up, in, left through bitwise operations. If you're going to use this include for Texture Studio, you should definitely check out the new code as it will drastically reduce compiling time and amx file size.
For example, for a 2000x2000 maze it originally used 94MB of amx file size, it uses 4MB now.
Re: Maze Generator -
Crayder - 25.02.2018
Quote:
Originally Posted by ThePhenix
I updated the code with an improved version. The code I originally published wasted a lot of memory and took a long time to compile. I optimized the code by storing all the required information into a single PAWN cell (4 bytes) including boolean information like up, in, left through bitwise operations. If you're going to use this include for Texture Studio, you should definitely check out the new code as it will drastically reduce compiling time and amx file size.
For example, for a 2000x2000 maze it originally used 94MB of amx file size, it uses 4MB now.
|
Well, if you recall correctly, that's how I did it when we were making this originally years ago.
Re: Maze Generator -
Pottus - 26.02.2018
Quote:
Originally Posted by ThePhenix
I updated the code with an improved version. The code I originally published wasted a lot of memory and took a long time to compile. I optimized the code by storing all the required information into a single PAWN cell (4 bytes) including boolean information like up, in, left through bitwise operations. If you're going to use this include for Texture Studio, you should definitely check out the new code as it will drastically reduce compiling time and amx file size.
For example, for a 2000x2000 maze it originally used 94MB of amx file size, it uses 4MB now.
|
Thanks a lot! The thing is once I update this include to work with TS it will make things a pain in the ass to update if you make any changes. Currently there isn't enough support for TS to use it out of the box so as I mentioned we need to break down the objectmetry modules player object stack system to handle the maze generator. Then the maze generator needs some updates to use the object stack system.