BETA randomised maps
Moderators: Slitherine Core, BA Moderators
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
-
- Site Admin
- Posts: 13558
- Joined: Fri Apr 01, 2005 10:19 am
-
- Captain - Heavy Cruiser
- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
I want to complexify the road' system. May be the river's generation also. Because they are very simple. They are the first functions I wrote. At first I had trouble with the lack of data structures. But I found how to have a 2-dimensional array with GetTileData and SetTileData using index = 1
I also have to learn to grow the hills, if possible
For now, the generation is quite simple, according to an established plan: a river in middle, a road which crosses the entire map, one village on each side, the remainder is composed of forests, fields, small villages and some rough tiles.
I also work to make it more diverse. The goal is to have a generator as complete.
I also have to learn to grow the hills, if possible
For now, the generation is quite simple, according to an established plan: a river in middle, a road which crosses the entire map, one village on each side, the remainder is composed of forests, fields, small villages and some rough tiles.
I also work to make it more diverse. The goal is to have a generator as complete.
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
I think Merr was working on something similar - so you might be able to exchange ideas!
I'm not sure you can set the height on a tile, so hills might be difficult, but I can always add it to the wishlist for the next update.
I want to add more robust data structures to the scripting, but that's part of the load of improvements I want to make...
Let me know if you have any problems.
Cheers
Pip
I'm not sure you can set the height on a tile, so hills might be difficult, but I can always add it to the wishlist for the next update.
I want to add more robust data structures to the scripting, but that's part of the load of improvements I want to make...
Let me know if you have any problems.
Cheers
Pip
-
- Captain - Heavy Cruiser
- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
Well I have advanced I worked on the variability of maps.
You can notice some more roads. Roads junctions is hell
I also work to a campaign completely random with carryover system. Each mission is to capture VPs on map. I've already placed some Germans. But all this requires more work before testing
There are still problems with the roads I should also add some diversity to the villages. Put some fortifications (there has been in the villages.)
The script is close to 2,000 lines There are many things to rewrite ...
You can notice some more roads. Roads junctions is hell
I also work to a campaign completely random with carryover system. Each mission is to capture VPs on map. I've already placed some Germans. But all this requires more work before testing
There are still problems with the roads I should also add some diversity to the villages. Put some fortifications (there has been in the villages.)
The script is close to 2,000 lines There are many things to rewrite ...
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
-
- Captain - Heavy Cruiser
- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
I found a solution for roads and junctions
First I generate my random roads in a 2-dimensional array. I have a function BuildRoad(x1, y1, x2, y2) that builds a road between points x1, y1 and x2, y2 in my array.
Then when all roads were built, I call another function, DrawRoad(), that will read the array and place the tiles according to their neighbor As there is just eleven different cases it's not too complex.
An example (without fields, forest, ...):
First I generate my random roads in a 2-dimensional array. I have a function BuildRoad(x1, y1, x2, y2) that builds a road between points x1, y1 and x2, y2 in my array.
Then when all roads were built, I call another function, DrawRoad(), that will read the array and place the tiles according to their neighbor As there is just eleven different cases it's not too complex.
An example (without fields, forest, ...):
Code: Select all
FUNCTION BuildRoad(x1, y1, x2, y2)
{
int i ;
int j ;
int k ;
int x ;
int y ;
int yfinal ;
int flag ;
flag = 0 ;
x = Min(x1, x2) ;
if (x == x1)
{
y = y1 ;
yfinal = y2 ;
}
else
{
y = y2 ;
yfinal = y1 ;
}
SetTileData(x, y, 2, 1) ;
for (k = 0 ; flag == 0 ; k++)
{
if ((x == Max(x1, x2)) && (y == yfinal))
{
flag = 1 ;
}
if ((x == Max(x1, x2)) && (y != yfinal))
{
if (y < yfinal)
{
y++;
}
else
{
y--;
}
}
if (( x != Max(x1, x2)) && (y == yfinal))
{
x++;
}
if ((x != Max(x1, x2)) && ( y != yfinal))
{
k = Rand(1,100);
if (k < 50 )
{
x++;
}
else
{
if (y < yfinal)
{
y++;
}
else
{
y--;
}
}
}
SetTileData(x, y, 2, 1) ;
}
}
FUNCTION DrawRoads()
{
int i ;
int j ;
int id ;
for (i = GetGlobal("xmin") ; i < GetGlobal("xmax") ; i++)
{
for (j = GetGlobal("ymin") ; j < GetGlobal("ymax") ; j++)
{
if (GetTileData(i, j, 2) == 1)
{
//Draw road tiles
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 1))
{
//crossroads
id = GetTileOnTile(2, 10, 12) ;
PlaceTile(i, j, id, 2);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 0) && (GetTileData(i, j-1, 2) == 0))
{
//line x
id = GetTileOnTile(2, 10, 10) ;
PlaceTile(i, j, id, 0);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 0) && (GetTileData(i-1, j, 2) == 0) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 1))
{
//line y
id = GetTileOnTile(2, 10, 10) ;
PlaceTile(i, j, id, 1);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 0))
{
//T roads UP
id = GetTileOnTile(2, 10, 13) ;
PlaceTile(i, j, id, 2);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 0) && (GetTileData(i, j-1, 2) == 1))
{
//T roads DOWN
id = GetTileOnTile(2, 10, 13) ;
PlaceTile(i, j, id, 0);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 0) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 1))
{
//T roads LEFT
id = GetTileOnTile(2, 10, 13) ;
PlaceTile(i, j, id, 1);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 0) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 1))
{
//T roads RIGHT
id = GetTileOnTile(2, 10, 13) ;
PlaceTile(i, j, id, 3);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 0) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 0) && (GetTileData(i, j-1, 2) == 1))
{
//Turn Down-right
id = GetTileOnTile(2, 10, 11) ;
PlaceTile(i, j, id, 0);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 0) && (GetTileData(i, j+1, 2) == 0) && (GetTileData(i, j-1, 2) == 1))
{
//Turn Down-left
id = GetTileOnTile(2, 10, 11) ;
PlaceTile(i, j, id, 1);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 1) && (GetTileData(i-1, j, 2) == 0) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 0))
{
//Turn Up-left
id = GetTileOnTile(2, 10, 11) ;
PlaceTile(i, j, id, 2);
SetTileData(i, j, 1, 1);
}
if ((GetTileData(i+1, j, 2) == 0) && (GetTileData(i-1, j, 2) == 1) && (GetTileData(i, j+1, 2) == 1) && (GetTileData(i, j-1, 2) == 0))
{
//Turn Up-right
id = GetTileOnTile(2, 10, 11) ;
PlaceTile(i, j, id, 3);
SetTileData(i, j, 1, 1);
}
}
}
}
}
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
Very cool indeed! I've been wondering how to do this ... mind if I borrow?Amaris wrote:I found a solution for roads and junctions
Also, you should apply this to building streams .... I built a stream script that "wiggles" but I like your script better!
After I built the stream I used Pip's SLITH_EDGING_WATER function to clean the edges.
I think your script can be adapted to build streams too !
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
Well, your work is much appreciated because it saved me time!pipfromslitherine wrote:Yeah - the edging of streams is a pain - as there isn't always a valid way to edge any combination of tiles. But it looks like you guys are well on the way - I'm incredibly impressed!
Cheers
Pip
I borrowed it and made variations that edged the water to fit my script ... Merr_Edging_Water .... Merr_Edging_Marsh.
The cool part continues because I'm building "gullies" which are nothing more than my "mud_tiles" replacing the water ... By adding the hedge row object's it makes sneaky little channels that infantry can manuever in where armor cannot !
With Amaris' great script It just get's better every day!
-
- Site Admin
- Posts: 9702
- Joined: Wed Mar 23, 2005 10:35 pm
-
- Captain - Heavy Cruiser
- Posts: 929
- Joined: Fri Jul 23, 2010 11:08 am
- Location: France
- Contact:
This is the first playable version
Warning: may remain some bugs That said the maps should be playable. There may still be some minor problems with the roads but it works pretty well.
This is a three scenarios campaign with carry over system. Each scenario is randomly generated: map, goals, enemy forces and enemy reinforcements.
Download: : https://sites.google.com/site/bbcbaamar ... m-normandy
I mostly need to feedbacks on the difficulty setting and the balance of this campaign with carryover. I am also interested if it generate unplayable maps (screenshoot will be greats.)
Once the generator is validated, it will be easy to change sides, change tileset (desert will require a little more work I think.) A longer campaign also.
Warning: may remain some bugs That said the maps should be playable. There may still be some minor problems with the roads but it works pretty well.
This is a three scenarios campaign with carry over system. Each scenario is randomly generated: map, goals, enemy forces and enemy reinforcements.
Download: : https://sites.google.com/site/bbcbaamar ... m-normandy
I mostly need to feedbacks on the difficulty setting and the balance of this campaign with carryover. I am also interested if it generate unplayable maps (screenshoot will be greats.)
Once the generator is validated, it will be easy to change sides, change tileset (desert will require a little more work I think.) A longer campaign also.