Question about procedural generation and Blender

Hello,

How good is Blender when it comes down to procedural generation when compared with other programs? Like those offered by Unity.
Does anyone know of any sources, classes & tutorials on procedural generation which could be used to create environments? Or create the code for a plugin that could be used on blender to create procedural generated environments.

When I think of procedural generated environments, I think of Space Engine and No Man’s land.

Thanks.

1 Like

As with all procedural generation - it’s up to the developers imagination and skill.

There is only one limitation of BGE: it cannot* create geometry on the fly - only modify existing geometry. But still, the possibility for procedural generation is enormous. My three ‘best’ recent games all used procedural generation for making maps (Inferno, Cave Fly, Crystal Miner). From other people there are also games like Every Mans Sky.
All of those games can be downloaded as blend files and their source code analysed.

*But you can load in new objects dynamically, also, a recent branch does support geometry creation, but not via python.

Which recent branch supports geometry creation?

There aren’t really any good tutorials for procedural generation because there is no one set way that will work for everything. You may however want to check out a project I did not too long ago in upbge: https://blenderartists.org/forum/showthread.php?418864-Procedural-sculptable-terrain

Here’s the blend. Its really buggy and unoptimized so be careful.
https://drive.google.com/file/d/0B90GtsCRWnt8UmlYbzdGWDA0Vmc/view?usp=drivesdk

I get this error.

File "C:\Users\barbara\Desktop
oise.blend\Text.py", line 138, in addIn
TypeError: reinstancePhysicsMesh() takes at most 2 arguments (3 given)
Python script error - object 'Master', controller 'Python.003':
Traceback (most recent call last):
  File "C:\Users\barbara\Desktop
oise.blend\Text.py", line 138, in  
Blender Game Engine Finished

That is because you are not using upbge.

This the error for the upbge.Do i have the code at the bottom right?Because your blend does not do anything.

Read prefs: C:\Users\barbara\AppData\Roaming\Blender Foundation\Blender\2.78\config\userpref.blend
found bundled python: C:\Users\barbara\Desktop\Release\2.78\python
addon not found: 'import_runtime_mhx2'
archimesh: Imported multifiles
{'metarigs': [<module 'rigify.metarigs.human' from 'C:\\Users\\barbara\\Desktop\\Release\\2.78\\scripts\\addons\\rigify\\metarigs\\human.py'>]}
metarigs
[(<class 'bpy_types.Add_human_Metarig'>, 'human')]
Read blend: C:\Users\barbara\Desktop
oise.blend


Blender Game Engine Started
Warning: player.py(18), method keyboard.events is deprecated, please use keyboard.inputs instead.
Blender Game Engine Finished

wKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.WKEY]
    sKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.SKEY]
    aKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.AKEY]
    dKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.DKEY]
    lShiftKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.LEFTSHIFTKEY]
    rShiftKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.RIGHTSHIFTKEY]
    spaceKey = logic.KX_INPUT_ACTIVE == keyboard.inputs[events.SPACEKEY]

And another error.

AttributeError: module 'Text' has no attribute 'sculpt'
Error: Python(Tile2), python controller found the module but could not access the function
AttributeError: module 'Text' has no attribute 'sculpt'
Error: Python(Tile2), python controller found the module but could not access the function

<off topic>
@lostscience:

Unfortunately this is the only case in the fork where you can dynamically create geometry, so it’s not particularly useful for procedural generation. Yes, it has to be a soft body.
But it’s cool eh?

</off topic>

I would like to try that.it looks interesting.

Hello,
To make a long story short: We started out in Panda3D but it was too low level for our experience level. So we moved to Unity, which is where the project lives now. I personally tried Blender along the way, and was really impressed with just how easy it is to make a fun, playable game, without having to be a mathematician.

With that, however, I’m afraid the outlook is not good for BGE and procedural generation at this time, depending on how advanced you need to get. If you want to create an entire model from scratch using Python at run-time, you’re out of luck without getting quite a lot closer to the paint, using BGL (see stackexchange answer linked below for a bit more).

If you can figure out how to get away with only being able to modify vertex positions of existing meshes, you’re in like flint, as near as I can tell (there are some good examples of this floating around in the form of infinite procedural terrain and such). You can also use the bpy module to generate content during development, but not on the fly.

Here is an answer I posted on stackexchange: https://blender.stackexchange.com/questions/34473/generate-mesh-at-run-time

There are several similar questions, but I’ve done a poor job of keeping track. Still, my answer to the above covers everything I know so far.

I hope this helps, and with the growing number of questions on the topic, I hope the Blender devs can/will implement lower-level mesh creation in the near future!

Cheers

1 Like