I just wanted to update everybody, I've been working hard on a procedural generator for blockman, it will not only give tons of options for generating your landscape, but I am also working on a dynamic scripting language to allow all kinds of different filters and effects for building landscapes, blending colors, building objects, and building tunnels. With the ability to set filter precedense and stack them how you like to run, the options and effects will be endless!!!
Here's a preview of what I've been working on!
- Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<SCRIPTS>
<SCRIPT type="mapfilter" name="Blinds" description="An Advanced Pattern Based Map Building Filter" author="Unknown" version="1.0" released="8-27-2012" url="http://blockman2d.herokuapp.com">
<SUB name="primary">
<LOOP type="2d">
<IF expression="0" equals="0">
<RUNSUB>alt</RUNSUB>
</IF>
</LOOP>
</SUB>
<SUB name="alt">
<MAIN>
<RUN>
SETVAR("HEIGHT",(round(sin(sqrt(x*x+y*y)*10))*63));
SETVAR("C.R",((round(4*x-y*2) % 2) - x)*255);
SETVAR("C.G",((abs(x+2*y) % 0.75)*10+y/5)*255);
SETVAR("C.B",(round(sin(sqrt(x*x+y*y))*3/5)+x/3)*255);
SETCOLOR(GETVAR("C.R"),GETVAR("C.G"),GETVAR("C.B"));
CREATESPAN(0,GETVAR("HEIGHT"));
</RUN>
</MAIN>
</SUB>
</SCRIPT>
<SCRIPT type="mapfilter" name="Island Generator" description="Generate Random Island Masses" author="FaultCheck" version="1.0" released="8-27-2012" url="http://blockman2d.herokuapp.com">
<SUB name="primary">
<LOOP type="1d" var="x" x="0" max="7">
<LOOP type="1d" var="y" y="0" max="7">
<IF expression="RAND(1,5)" equals="2">
<RUN>
drawRectangle(0,(X*64),(Y*64),(X*64)+RAND(32,64),(Y*64)+RAND(32,64),10,true,8);
</RUN>
</IF>
<IF expression="RAND(1,4)" equals="2">
<RUN>
drawRectangle(0,(X*64)-48,(Y*64)-48,(X*64)+16,(Y*64)+16,10,true,8);
</RUN>
</IF>
<IF expression="RAND(1,5)" equals="2">
<RUN>
drawRectangle(0,(X*64),(Y*64),(X*64)+64,(Y*64)+64,10,true,8);
</RUN>
</IF>
</LOOP>
</LOOP>
<LOOP type="1d" var="x" x="0" max="7">
<LOOP type="1d" var="y" y="0" max="7">
<IF expression="RAND(1,5)" equals="2">
<RUN>
drawCircle(0,(X*64),(Y*64),RAND(32,64),10,true,8);
</RUN>
</IF>
<IF expression="RAND(1,4)" equals="2">
<RUN>
drawCircle(0,(X*64),(Y*64),RAND(32,64),10,true,8);
</RUN>
</IF>
<IF expression="RAND(1,5)" equals="2">
<RUN>
drawCircle(0,(X*64),(Y*64),RAND(32,64),10,true,8);
</RUN>
</IF>
</LOOP>
</LOOP>
</SUB>
</SCRIPT>
</SCRIPTS>
This is a basic XML structured scripting language, any experience with HTML, XML and this should read pretty naturally. The container will allow multiple sets of scripts to be contained in a single file.
The actual expression based code is using FLEE - Fast Lightweight Expression Evaluator, which is simply a tokenizer that turns text into a structured expression. Using the FLEE engine, and a script construct and compiling method of my design, I have been able to successfully get the first tests ran through the system, with fast processing time.
This is the begining of land mass algorithim I built, you can see the script above to see how simple it is, and this is what it produces.
This is an example of some more complex math that you can use with the script language. Check out the first script on the code above. The preview window is showing only a height map, using a red color scale, on the base blue water, so all previews come out shades of red so you can test and see how the filter works. Ultimatly, the land mass colors would be filled in with the biome settings, and color blending filters would be ran to blend it all together.
A Biome Manager to manage, edit, or remove biomes. You can also export and import biome scripts in a similar XML format. This will allow hand editing of biome data if you prefer.
This is the biome editor window, showing you the different options for each biome. The biome will randomly select different zones on the map, and affect them based on the biome settings.
I would love to hear feedback, let me know what you guys think, I hope it will be helpful, I know not everyone will be scripting their own filters, but the initial release with these options will have some existing filters to use, and of course the ability to expand.