-- ======================================================================-- original code by Ken Perlin: http://mrl.nyu.edu/~perlin/noise/-- ======================================================================local function BitAND(a,b)--Bitwise and local p,c=1,0 while a>0 and b>0 do local ra,rb=a%2,b%2 if ra+rb>1 then c=c+p end a,b,p=(a-ra)/2,(b-rb)/2,p*2 end return cend

function doPerlin() for i=1,200 do for j=1,200 do local x = i-1 local z = j-1 local y = perlin:noise(i/10, j/10, 0.3) if ( y > 0.05 ) then entity.spawn("node_cube",x,10,z,1,1,1) end end endend

Since I'm unable to modify the vertices from a mesh, all I can get is a minecraft style terrain...

But there are some values I can use in my own functions, like the density of the noise...

... and certain heights:

That allowed me to populate an entire island with vegetation randomly, following some interesting patterns.

First I've created the palms, using a Perlin noise at a certain level, then I throw a ray down and spawn only those palms which are 2 meters over the sea level. That avoid the palms getting too close to the shore.

Each palm will hold a cluster of grass meshes around, at a random distance.

Then I spawn the bushes with the same Perlin noise but a lower level, to avoid colliding with the palms.

Finally, the rocks don't have a perlin noise, just spawned around randomly, but they are clusters as well.

This is one of the random levels. Every time I click play, these values change:

total_palm: 253total_grass: 7590total_bush: 8199total_rock: 200

I even can make a dynamic map... Darker dots are the palms and the lighter ones are the bushes.

There are still some work to do regarding to object placement in order to avoid overlapping, but already got a decent procedural environment. It's a pitty that I can not generate a terrain in the same way, with different biomes and much bigger. I only can use a custom terrain mesh, which is a huge limitation.

Anyway, here's a short video of a character walking around the island. Hope you like it!

As for the vertice editing, its on the todo list so users can create custom meshes or at least modify terrain vertices..But what you have done seems to be working really well... looking forward to seeing how this progresses

Conceive, Quantify & Do!Skyline Game Engine - Lead Developer.Please provide as much information as possible when asking for help.

Awesome! You rock! I am blown away, this concept has a lot of mileage. As with your other project I am am excited to see this develop.

We did look at noise generation of vegetation and other procedural placement of in game content such as spawn points, health, survival items. But we are still a long way from playing with it. I never imagined that through Lua alone you could get great results and you beat us to it lol! Awesome, like I said, you Rock man!

I think vertex will have to be passed to Lua now

You could develop this into an editor side tool with its own skyline ui and sell it in the new store?

Thanks guys, glad you like it... all this came because I needed some sort of scenario to try this:

StarFire wrote:I never imagined that through Lua alone you could get great results

Lua is cool but it's too slow for this purpose. Generation times are too long and it lags a lil bit. I feel like I'm pushing the limits with this little island. We would need something faster in order to create a vast open world. At least that's what I've read somewhere, I'm not really an expert in software engineering.

This is where c++ is faster, I think there could be a way of creating the noise or some sort of procedural function to run c++ side and only feed it some raw data from lua. This way the performance in generation would be fast but controlled from lua settings.

The run time lagging or popping could be smoothed out, thats if its due to the spawning of the items as the player moves?

I'm having problems to export this level as an exe. Tried to follow SolarPortal advice but getting errors and crashes when executing it. Actually I got the same problems no matters the project, is there any example level I can use to check if exporting is working? Because I could never export a game from Gen2...

lordalmighty1 wrote:nice vid and setup there m8 .just 1 thing i noticed the trees poppin in are not viewable from further out? seems rather close atm for them to player like.

Sorry m8, totally missed you... the camera settings are temporary, it will be much closer to the player so you wont see any tree popping in.

An important aspect is vegetation you create must be modifiable with terrain tools, otherwise you can't tweak manually to create unique places like any game has.

Some ideas you could expand it if textures selection was available for plugins : - Use external tiling texture instead of noise option- Add texture bitmap selection for masks (no spwaning in mask areas like lakes, rivers or city zone) or allow spawning only some selected objects in some area masks.- If you can modify terrain heights : texture heightmap stamps you move,zoom ,scale around terrain and stamp to create complex terrains in seconds

Great that someone has picked up the procedural side of things, looking great mate..

I like the hair movement and cloth simulation in that video (above), can not wait till that's available in Skyline oh and destructible meshes and terrain deformation like driving over soft mud lol do I ask to much? lol great features to be added though..

SpiderMack wrote:Are your trees and grass using LOD ? because we see lot of popup.

1 ) Can it handle a bitmap mask colors ? For example red color to mask where grass is allowed, green color for where trees are allowed and blue for where rocks are allowed ?

2) Using raycast does it avoid placing grass or trees on top of houses for example ?

Your plugin is great and could be integrated in Skyline as a base for procedural terrain generation why not.

I'm not using LODs atm but planning to do it. There are some functions to detect terrain textures, but they are still in development. You can define collision flags if necessary, but in a desert island there are no houses. But yeah, if you want specific features, you have to code them. That's why scripts were invented.

This is not a plugin, it's just a small script I've used to generate random positions in a bit more realistic way. Far to be perfect, it's just an experiment. We all know the capabilities of AAA engines, but the point is doing something with the tools we have.

@epsilonion: I have been reading a bit about procedural content generation, including some of the links that you've posted above (thanks btw) and that's something that requires a lot of knowledge that I don't have atm. But I found some simple lua scripts to generate mazes and dungeons that maybe I could implement in Skyline. I have some characters ready to be used, but feel lazy to model a level, maybe that helps.

planetX wrote:This is not a plugin, it's just a small script I've used to generate random positions in a bit more realistic way. Far to be perfect, it's just an experiment. We all know the capabilities of AAA engines, but the point is doing something with the tools we have.

Procedural is the way to go for games focused on big outdoors and exploration.If we got access to terrain vertex position and be able to modify them with Lua, your script could also become a terrain generator. Procedural is a huge time saver to quickly generate terrains before manually tweaking it.

About overlapping problem, this could be fixed using textures bitmaps or masks.A high res textures only used when working with procedural that can be deleted once terrain is generated.Each time you paint a palm, a rock or some grass, you paint on the bitmap mask at same position.When the procedural generator tries to add a new object it will look up as texture mask to check if there is free space or if there is already something.

This could be extended with custom pre made masks that could be used when running procedural script, for example you have some island and you don't want palms or rocks on some places that would be villages, rivers, lakes or something else.

So you need Lua functions to create, read and modify a texture

I think Skyline team needs to allow terrain access from Lua, like painting textures, grass, vegetation and sculpting terrain.If more users jump in making plugins this will be needed at some point otherwise no one will create terrain plugins.