Random Map Generating

Hi,

I was recently in discussion with Mmph! and another person (who’s name I can’t remember unfortunately) on the crystalspace irc channel about random map generation. Now this particular person had the idea of having say 100 perlin height maps generated with gimp and then have a script that would randomly select two of the 100 and join them by applying a shader. To add an even more seemingly random effect it was suggested to randomly rotate/mirror/flip the two images before applying the shader.

This was discussed with the crystalspace engine in mind but after I had set it all up and was getting stuck into tutorials and what not I have realized that perhaps blender could be used to do this with perhaps a bit extra python scripting and what not.

Now what I thought was some sort of process like this could work:

[Game Initialized]
/
[Loading Screen] -> Start Python Script with randomly selects and rotates/flips two heightmaps from a specific file
/
[Loading Screen]-> The two modified heightmaps which are stored in temporary directory(?) are then loaded into blender and a shader is applied to the two and then it is applyed to a mesh which it deforms.
/
[Loading Screen]-> What ever else needs loading is loaded.
/
[Game Starts]

I am not sure about it all but that is a quick scratch up of what I think could happen though can blender do the joining and applying of the shader? Or would I need that to be done with an external image manipulator that I can use with Python?

I hope this all doesn’t sound too vague,

Thanks

ZaneV

Hmm… not having too much experience with the shaders (:smiley: haven’t played around with it too much yet). I think it is possible, but it’ll just be for looks.

None of the applied shaders with have physics effects on it. So say you have a height maps defining geometry for hills, etc. Blender might be able to provide the effects to display it, but there’ll be no physics applied to those generated effects. Therefore, a height map applied to say a flat plan, you’d just still be walking on a flat plane. With the applied height map for shaders, it’ll look like you’re just walking though the generated height map for hills.

Not sure how crystal space handles the height map generation, but I don’t believe they do it with shaders… :spin:Please disregard all my blabber, lol, I’m not 100% sure what I’m talking about when it comes to shaders, heh.

Jason Lin

You can just disassemble the blender2CS script and see how he converts the mesh into a terrain system for CS. I think the script is GPL so you can just cut and paste too if you need :smiley:

there you can also see how he parents the foliage onto the terrain and how he is doing the texture.

WIth blenders new baking tools, and a little creative material creation you could make a nice system to make custom skins for your terrain, or a mixmap to mix seamless textures together. With a mix map you could assign foliage meshes to certain elevations…ie rocks at the lowest level, sand at the next, dead grass at the next, live grasss up higher.

In blender we have a displacement modifier that will make viewing the mesh a snap!

Just an idea, but you could also make so that there is a custom map function. Have your python script so it accesses the new sculpt tools so your user can draw out a nice terrain, and have the vertex color system available too so they can paint where they want foliage .You could even have so that they can place the buildings and other obsticals in blender too so that they are static thing meshes or static genmeshes :smiley:

If you get this going good, please PM me, I could whip out a few tanks for you, perhaps even give you some trees and simple buildings I already have made in my archive.

I am very interested in doing destroyable structures in CS, I think with ODE or Bullet I could do some pretty cool houses, and trees that explode on impact.

just an idea, but why not toss in some NPC’s to your game as soldiers with simple AI… each team gets a few of them that go after the other team… you can shoot the opposing ones for extra points, and the ones with mortars and rockets would add an extra challenge :smiley:

see you later, i will log into the irc later tonight.

Well I was actually thinking more of actually not using CrystalSpace at all and continue working on it all completely in blender as I don’t yet have much experience in CrystalSpace.

Anyway thanks for all the ideas and Mmph! thanks for the offer and if it all does start to get good you might just get a pm from me ;).

Thanks,

ZVWolf