Sign in to follow this  
Followers 0
FeXoR

deep_forest_v0.1 Random Map Generator

42 posts in this topic

Here's my (poorly implemented) early version of a deep dark forest map.

Well at least at size medium and higher.

Well, I learned much about what I did wrong when I made it x)

Here it is:

EDIT: Dont download this! Plz look though this topic for later versions.

deep_forest_v0.1.rar

deep_forest_v0.1.zip

Siege engines might have trouble getting through

Edited by FeXoR

Share this post


Link to post
Share on other sites

Nice, however, I think this will tax alot of graphics cards (including mine :()

Here is a screenshot.

post-12985-0-80220000-1330555711_thumb.p

Share this post


Link to post
Share on other sites

It looks fantastic zoomed out. However, it is nigh unplayable due to graphical lag. There are simply too many trees, I'm afraid. I would mix it up with patches of Oaks, Carobs, and European Beech trees, even some pines. Also, there is a problem with the water plane being too high. Lower the water plane so it doesn't stick above ground. This is a good start though. Keep at it, FeXoR. :)

Share this post


Link to post
Share on other sites

Awesome map.

Not-so awesome frame rate when playing it. Yikes! We need a way for the game to dynamically scale shadow quality based on the amount of entities.

Share this post


Link to post
Share on other sites

Awesome map.

Not-so awesome frame rate when playing it. Yikes! We need a way for the game to dynamically scale shadow quality based on the amount of entities.

Not so sure it's the shadow map causing the lag. Likely it is all of the alpha-channeled trees.

Share this post


Link to post
Share on other sites

Plus there are loads of "out of memory" errors even on a Normal-sized map with 2 players, because there are simply too many entities. Larger maps won't even generate. I'd love a forest map though, someday :( Performance is another problem entirely. There are lots of ways of making this work from a technical perspective.

Share this post


Link to post
Share on other sites

There is a "trick" that can increase the performance. Add some cliffs in the forest heavy areas and fill the borders with trees. Increase the distance between trees and don't add them to the top of the hills. Players won't be able to see the top of the cliffs and thus do not notice that there isn't any forest.

Share this post


Link to post
Share on other sites

THX for the replies!

I would mix it up with patches of Oaks, Carobs, and European Beech trees, even some pines.

I'm on it

Also, there is a problem with the water plane being too high. Lower the water plane so it doesn't stick above ground.

Yes, I noticed, can't build there...

How do I do it?

There is a "trick" that can increase the performance. Add some cliffs in the forest heavy areas(...)

Yep, sounds good to me.

(...)and fill the borders with trees.

If you mean the borders of the cliff I agree if at a reachable position.

If you mean the map border I disagree. They are unreachable and will make gatherers pile up on the map border. That's a real issue IMO. unreachable resources should be marked with a flag like "interactable = false" or so so that no AI player intends to gather those resources.

If the pathfinding routine would have a reply like "yep, I sen you near there, but this destination is unreachable" it would be even better.

Increase the distance between trees(...)

Yes, there's a varable "density" that can be reduced. But I don't know how many tiles distance between trees a unit needs to pass through. And if units can at least walk int the forest a bit, pathfindingroutine will go mad (I'm quite sure about that)

(...)and don't add them to the top of the hills. Players won't be able to see the top of the cliffs and thus do not notice that there isn't any forest.

Yep.

I can't do much today, but tomorrow I will go for it!

Share this post


Link to post
Share on other sites

My .json file:

{
"settings" : {
"Name" : "Deep forest v0.3",
"Script" : "deep_forest_v0.3.js",
"Description" : "The early snapshot of a deep forest map. Siege weapons may have problems to pass...",
"BaseTerrain" : ["grass b soft dirt 50", "grass1", "grass1_spring", "grass_field", "grass_moss"],
"BaseHeight" : 0,
"seaLevel" : -5,
"CircularMap" : true,
"XXXXXX" : "Optionally define other things here, like we would for a scenario"
}
}

But the roads are still under water...

EDIT5: Using the alpha 8.

EDIT: In library.js I see this:

const SEA_LEVEL = 20.0; 

EDIT2: I added:

setWaterHeight(-5);
g_Environment.Water.WaterBody.Height = -5.0;

to the .sj file but still the same.

EDIT3:

log("g_Environment.Water.WaterBody.Height = " + g_Environment.Water.WaterBody.Height);

returns "g_Environment.Water.WaterBody.Height = -5".

EDIT4: But in the function "ExportMap" (used at the end of my script like usual) in "mapgen.js" I read:

	g_Environment.Water.WaterBody.Height = SEA_LEVEL - 0.1; 

and

log("SEA_LEVEL = " + SEA_LEVEL); 

returns "SEA_LEVEL = 20"...

Edited by FeXoR

Share this post


Link to post
Share on other sites

After a rough night I got further...

The story about that night can be found here.

The outcome is this:

deep_forest_v0.3.zip

Bugs:

- Resources are not really implemented at all (The resources at start position are more artefacts of the previous version then inclusions of this map)

- Didn't find a way to lower the water level, so I raised all tiles - one by one - by one (Sounds strange but it's correct, I guess).

EDIT: Now I know, THX howlingflute!

Issues:

- Still lags on big maps due to the number of entities.

- Takes a bit long to generate due to some self-written functions (they are not necessarily bad but can be made faster)

- Map code has to be tidied up!

NOTE: I got no 'out of memory' problems but I only made 'normal' sized maps (All maps lag on my labtop when bigger then 'medium')

Poor design/things to add or comment:

- There are too many trees in somehow unused map areas near the map border that only causes laag. Cliffs or Lakes should be added there. (Spahbod's suggestion)

- Map border is not designed at all, cliffs/lakes/terrain should be added (I wanted to ensure no chopable tree or other interactive thing is unreachable for units because it causes lags caused by AI, unit AI and/or pathfinding, gatherers pile up there) [cause, cause, cause x)]

- To many/broad roads. With many players they will nearly fill the area between start positions. Should be somehow scaled with number of players.

- Outer roads should be dragged to the border to enlarge the playable map area. 1 of the 2 roads between 2 given players should follow a 'circumventing' not a 'straight' path.

- Roads are to straight IMO. They are generated with a type of 'directed random walk'. If I raise the possible angle the next step directs too much, they might never reach there destination. On bigger maps they might stop somewhere on the map because steps are caped at 1000. (Further tests needed)

- A general hight map should be added. I would like nice, smooth hills. Raising the terrain in the map center and lowering it at the map border would suggest lakes at the border rather then hills/cliffs, but we will see...

- The forest's floor is to dense.

- The forest floor is to uniform. Some sand/dirt should be added.

- A 'forest border' should be added with bushes and longer grass surrounding the forests.

- The forest hight should be raised in a wider radius. Will be implemented with the 'forest border'.

- Terrain textures has to be chosen more wisely. I like the 'mud_slide_2' texture for road borders and bases (looks like dung ^^) but it occurs to often. Single textures of the same type tend to look squared. Have to finetune textures and perhaps rather place them on small areas then single tiles. Available textures are awesome though, great work!

- Player's start positions should be randomized more, especially the angle. Increase the angle offset will do IMO but an added absolute radius offset scaled with the squared map radius could help too (tuned for 'giant' maps which I can't test though...)

And some screenshots:

post-14196-0-47863400-1330704923_thumb.j post-14196-0-63452600-1330704961_thumb.j post-14196-0-13352300-1330704986_thumb.j

post-14196-0-47939500-1330705013_thumb.j post-14196-0-95941300-1330848740_thumb.j

Edited by FeXoR

Share this post


Link to post
Share on other sites

Looks like progress. In the future to set the base height of the map it is in the .json file. Just change the "BaseHeight": to a positive value. A height of 0 is the location of where water is, so just making the base height greater than 0 will make the water level below the map.

Share this post


Link to post
Share on other sites

You are right!

I did try that but didn't restart atlas.

The .json file does not seam to be reloaded when re-generating the map.

THX!

Edited by FeXoR

Share this post


Link to post
Share on other sites

Great job (y)

Finally, I can enjoy this without the app crashing!

Share this post


Link to post
Share on other sites

So, here's the next version, quite playable now though many details still missing.

Feedback welcome.

deep_forest_v0.4.zip

post-14196-0-90204300-1330895484_thumb.j post-14196-0-84483000-1330895506_thumb.j post-14196-0-33259400-1330895526_thumb.j post-14196-0-68455000-1330895543_thumb.j

post-14196-0-04168600-1330895568_thumb.j post-14196-0-20385100-1330895587_thumb.j post-14196-0-22824000-1330895615_thumb.j

Whow, making screen shot of giant maps takes about 15 min... but I had to try x)

Share this post


Link to post
Share on other sites

Hmmm... it generates a map, but with no forests. Bug or feature? ;)

Share this post


Link to post
Share on other sites

Hmmm... it generates a map, but with no forests. Bug or feature? ;)

Huh??? :eek:

I'll test the download today, didn't check it...

EDIT: Yes, U'r right somehow, it's a feature :lol:

Adding some screenshots of what happened to you, I think:

On tiny maps:

post-14196-0-77066800-1330933606_thumb.j post-14196-0-32643000-1330933635_thumb.j post-14196-0-17473800-1330933670_thumb.j post-14196-0-94000000-1330933696_thumb.j

If you have more then 3 players on a tiny map, the map will be quite empty.

Similar with small maps and more then 5 players.

In addition to that 'expansion' metal (normally outside the start locations) is very near to each other when you have many players on small maps.

Should scale the path's more with map size and perhaps the base size.

EDIT: Scaled the maximum tree density with the map size for future versions...

Edited by FeXoR

Share this post


Link to post
Share on other sites

Actually, I am getting this:

This is strange!

I use alpha 8, perhaps that's it...

All functions I used are inside the map, perhaps some rmgen libs changed...

I have no clue, I generated the screenshots of my previous post with the downloaded version and didn't change any files...

EDIT: U'r screenshot shows No hight mapping(hills/lakes/paths), no texture (base, path, woods, lakes) and no entities but the start entities and start resources...

Checking the 2 functions that didn't seam to run at all...

Edited by FeXoR

Share this post


Link to post
Share on other sites

Could you please check your mainlog for warns/errors?

Would help a lot if there are some...

EDIT: Perhaps I use the same function names as used in the new rmgen libs (and so override them?) and other rmgen functions that are using the overwritten ones act strange.

Edited by FeXoR

Share this post


Link to post
Share on other sites

Your functions overlap with new rmgen functions. But the odd part is that there aren't any warnings/errors. Rename them to something like dfGetDistance and it will work. Only these three are the problem:

getDistance

getDirection

getAngle

I found notepad's replace function useful here.

Share this post


Link to post
Share on other sites

Your functions overlap with new rmgen functions. But the odd part is that there aren't any warnings/errors. Rename them to something like dfGetDistance and it will work. Only these three are the problem:

getDistance

getDirection

getAngle

I found notepad's replace function useful here.

Thx, I thought so, I'll rename them... 

BTW: I hope you mean @ least notepad++ :D

Edited by FeXoR

Share this post


Link to post
Share on other sites

Here we go.

Nothing changed but the function names and removed some unused stuff. EDIT: Well, indeed I put it here.

Edit2: Oh, it seams I raised the tree density... sry, well, at least it's a 'deep' forest then...

deep_forest_v0.5.zip

Edited by FeXoR

Share this post


Link to post
Share on other sites

It works. Looks great. Perhaps try using trees other than the Baobab. I made the Baobab tree to have more branches and be higher poly because it's supposed to be used in a Savanna setting where trees are sparse. Try a pine tree version and a temperate tree version and see how the lag goes. I also recommend using terrain textures from the same biome together. They are generally made to fit together as a coherent set of terrain textures. Mixing terrains between different biomes can work, but it's tricky.

Share this post


Link to post
Share on other sites

OK, I'll do all that.

May take some time though until the next version cause I'll do some rewrites.

Found some bad code design and since I got to know JS a bit better I want to change it.

Thy for the feedback though.

EDIT: I'll go temperate. I think it fit's best to a deep forest...

Edited by FeXoR

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0