- Aug 2, 2009
- 539
- 334
MBlock
So this is the first public version of my random map generator. The goal is that when finished it will generate a blocked out map. MBlock stands for Mappers block, the moment this program will be quite handy.
currently Mblock is still in early stages and so not quite usefull
Currently all it does is place some random blocks in the map, a floor a skybox and some light entities. Brushes will not overlap each other nor intersect. by default it generates several thousand brushes.
maps generated are always symmetrical. (like 2fort, not pipeline)
after running the program, you should have a file called "randommap.vmf" in the directory of the program, wich is te generated map.
known issues
-no info_player_start
your map should not have any issues, if so, just add one
-texture perpendicular to face on every non-horizontal face.
causes ugly red wall when compiled, to fix this, in hammer check for problems, then fix all of type.
-no spawn points
you will simply spawn in the center of the map, wich should be just fine.
-Everything is world geometry, not func_Detail
deal with it, convert manually or compile with fast vvis
coding geek info
I would quite like some help with this, source code is included, so have a look at it.
the process
1.writing first part of file.
simply copies everything from vmftop.dat
2.laying down the field.
a 2 dimensional boolean array call field is generated where each boolean represents a x,y location on the map. True means that you may place a brush there and False means you cannot. Here I set all places to true
3.calculating open space.
here I call the function do_magic, wich should tell where the open spaces should be. Currently is does nothing. This is what will probably determen the layout of the map the most.
4.fill the non-open space with cubes.
this is a simple proces of generating ranom locations and sizes of the cubes, then checking whether space is avaible (using the field array), then (using the field array) set the room to occupied and add the brushes.
5.write the last part of the file
adds vmfbot.dat to the final file. when you want to add predefined entities to the map, add them to this file.
some useful functions
add_brush(x,y,z,a,b,c)
will make a brush with corners on (x,y,z) and (a,b,c) (the are the corners farthest apart) with gray dev texture and a blu dev texture on the top face
add_brusht(x,y,z,a,b,c,str)
same as add_brush, but the texture of each face will be str.
write_entity
do not use, should not work.
is_place
will tell you wheter there is occupied space in between the given coordinates
reserve_place
will set the space in betwee the coordinates to occupied.
plans for future versions
-Have do_magic done
-Have user input for size of map, number of brushes etc
-Have a simple graphical overview of the map when done, so you dont have to open up hammer every time
So this is the first public version of my random map generator. The goal is that when finished it will generate a blocked out map. MBlock stands for Mappers block, the moment this program will be quite handy.
currently Mblock is still in early stages and so not quite usefull
Currently all it does is place some random blocks in the map, a floor a skybox and some light entities. Brushes will not overlap each other nor intersect. by default it generates several thousand brushes.
maps generated are always symmetrical. (like 2fort, not pipeline)
after running the program, you should have a file called "randommap.vmf" in the directory of the program, wich is te generated map.
known issues
-no info_player_start
your map should not have any issues, if so, just add one
-texture perpendicular to face on every non-horizontal face.
causes ugly red wall when compiled, to fix this, in hammer check for problems, then fix all of type.
-no spawn points
you will simply spawn in the center of the map, wich should be just fine.
-Everything is world geometry, not func_Detail
deal with it, convert manually or compile with fast vvis
coding geek info
I would quite like some help with this, source code is included, so have a look at it.
the process
1.writing first part of file.
simply copies everything from vmftop.dat
2.laying down the field.
a 2 dimensional boolean array call field is generated where each boolean represents a x,y location on the map. True means that you may place a brush there and False means you cannot. Here I set all places to true
3.calculating open space.
here I call the function do_magic, wich should tell where the open spaces should be. Currently is does nothing. This is what will probably determen the layout of the map the most.
4.fill the non-open space with cubes.
this is a simple proces of generating ranom locations and sizes of the cubes, then checking whether space is avaible (using the field array), then (using the field array) set the room to occupied and add the brushes.
5.write the last part of the file
adds vmfbot.dat to the final file. when you want to add predefined entities to the map, add them to this file.
some useful functions
add_brush(x,y,z,a,b,c)
will make a brush with corners on (x,y,z) and (a,b,c) (the are the corners farthest apart) with gray dev texture and a blu dev texture on the top face
add_brusht(x,y,z,a,b,c,str)
same as add_brush, but the texture of each face will be str.
write_entity
do not use, should not work.
is_place
will tell you wheter there is occupied space in between the given coordinates
reserve_place
will set the space in betwee the coordinates to occupied.
plans for future versions
-Have do_magic done
-Have user input for size of map, number of brushes etc
-Have a simple graphical overview of the map when done, so you dont have to open up hammer every time
Last edited: