Hey guys, I was looking for any “search-based” procedural content generation tutorials. I need to procedurally generate environments for 3D games. By search-based, I mean that I am looking a for a way to use evolutionary algorithms. I have found research papers etc. but I haven’t been able to find a tutorial to apply these methods in Unity. Where can I get some tutorials?
Catlike coding is a good place to start. If they don’t have a tutorial for the type of procedural generation you are after, it’s probably not on the internet.
Which leaves you with the Learn section and implementing the algorithm yourself.
Yeah I checked there but I didn’t find any search-based PCG tutorials there.
Please be more specific:
-
What do you want to create exactly?
-
What parameters will this algorithm control?
-
What are the hard limitations of your problem - things that the algorithm should not do under any circumstances?
-
What level design parameters must this algorithm defer to?
-
What have you looked at already? How much do you know about evolutionary algorithms? What makes you think that they have any relevance whatsoever to your situation?
-
Etc. etc.
At the moment, you’re basically asking “how do I invoke Mother Nature to create a game for me, where’s the tutorial?” - it’s a question that can’t possibly go anywhere.
Let me rephrase:
- By ‘environment’, I mean ‘terrain’.
- It is a research based project
- I know about evolutionary algorithms. The problem lies in using Unity framework (new to Unity).
- The genotypes would be in the form of sketches (2d maps). They would be evaluated on some fitness criteria before the 2D map is converted to 3D level (terrain).
- The environment does not include characters. It simply includes the terrain.
- The problem at hand can be best solved by traversing through a solution space. This is the simple reason that I need to do search-based PCG.
- I have read several papers etc. They have used frameworks other than Unity but I want to use Unity because of the complexity of the problem I am dealing with.
Please ask any question if there still is any ambiguity.
Different types of environments/terrain (but for simplicity just forests or deserts for starters).
Have you considered just starting off with generating noise, iteratively applying erosion functions, and that sort of thing?
This question is too broad to answer because I am also considering adaptivity as a factor.
You’re basically saying that you don’t want to hardcode what the fitness functions evaluate? That adds a whole nother dimension of complexity and scope.
I have read several papers etc. I know enough about evolutionary algorithms but the problem lies in using Unity framework to implement them.
The Unity framework has very little impact on anything, implementing an evolutionary algorithm is more of a mathematical and general programming question. Have you tried programming a very simple test case, such as using an evolutionary algorithm to generate a rectangle which matches the dimensions of a randomly generated rectangle?
As stated above, I have some fitness criteria and evaluation functions. The problem I have can be solved better by searching in a solution space.
Some examples of your fitness criteria and evaluation functions would be helpful. I’m not convinced that machine learning techniques at all are the best way to go about this, let alone search-based evolutionary algorithms in particular. Unless you’ve got a good reason to do something fancy, don’t do anything fancy.
Its still pretty fuzzy what you are after. Some further clarifications will help.
Where are you at at the moment? Can you build your algorithm in C# (or at least build a C# wrapper for a C++ version).
Have you built anything in Unity yet?
What are you expecting Unity to do for you? Do you want a simple visualisation system? Do you want to run the simulation in Unity to evaluate the fitness function? Are you intending on Unity’s physics system? Do you need to build a stand alone simulation for others to use? How do you want to get data out?
If you have everything else in place, then using Unity is as simple as opening up the learn section and reading up on the API.
No I haven’t thought of that.
No no no. I am saying that since it is a research project, so there are not any fixed criteria currently.
No but I will try it now. It might help me in understanding what I am looking for.
I don’t really understand what is the problem here.
If you have fitness function inputs and outputs, just apply the function and start running it through evolutionary algorithms
PRocedural generation of geometry in unity is fairly simple. One example is in Mesh documentation page.
I just wanted a single tutorial on search-based terrain generation.
Thanks! Do you also have a similar tutorial but related to 3D terrains?
Unfortunately no, but if the problem is figuring out how to create an evolutionary algorithm inside the Unity framework, that should be a good reference point. There’s nothing different about 3D terrains except determining the fitness functions, which you said you already have. If you’re looking for how to create a mesh at runtime that’s a different story, and there’s plenty of info on that.
I would recommend not to be looking for a tutorial on this sort of thing - there’s no such thing. Tutorials are made for common things, such as opening the Unity Editor, creating a terrain and dropping the first person controller prefab onto it. Nobody is going to make a tutorial on something that hardly anybody is going to be able to use or is even interested in.
Besides, you say it’s a research project? If there was a tutorial floating around on the internet it would hardly be suitable as a research project. You have to be prepared to smell out opportunities to refactor semi-suitable and partially related methods to your needs.
Yes, this is an excellent reference point. Thanks!