PGui / procgen

Procedural Generation Experiments

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Procedural Generation Experiments

Philosophy

Main Roadmap

  1. Optimize L-System and Turtle execution time and memory consumption With the current algorithm, execution time and memory consumption are exponential. Memory consumption is the biggest factor, as several GB can be allocated easily (from 16 iterations).
  2. Make an integrated and interactive GUI with = dear imgui, =
  3. Save and load L-system models
  4. Vizualize the turtle moving

Implemented

  • (Simple) L-systems
  • (Simple) Turtle interpretation
  • Static GUI to display parameters
  • Dynamic GUIs to interact with the parameters

Optimization

Ideas:

  • Cache L-System (excellent for multiple execution time but awful for memory consumption)
  • Cache multi-iteration production rules (very good for execution time but bad for memory consumption)

Memory allocation with Valgrind (2017-09-17 Epholys)

valgrind --tool\=massif --time-unit\=B --peak-inaccuracy=0.1

Memory usage is directly linked to the size of the L-Systems calculated. These sizes grow exponentialy, so does the memory. As an example, with a simple L-System and 16 iterations, the resulting string is composed of tens of million of symbols. Saving these symbols and the 20-bytes-long vertices associated takes at least hundreds of MB in memory. Moreover, during the execution of logo::computes_vertices, we use a std::vector as data structure. Its allocation strategy (in g++ and MSVC) is to multiply the capacity by a number. As a consequence, this vector is at most “factor” times too large. In our case of hundreds of MB, it can be a serious toll. Fortunately, this vector is truncated when returned by the function.

I don’t see an obvious way to reduce memory consumption. Symbols and vertices are already very small. We could reduce the size of the aforementioned vector by reserving just enough bytes for the vertices. But that means we would have to approximate a small upper-bound of the result of the L-System and also how much of its symbols will produce a new vertex. A whole mathematical problem.

For now, I’ll do nothing: I see no reasonable case to computes and display so much iterations of a L-System. I’ll concentrate on optimizing execution time (with memory consumption in mind).

Development framework

Completing the framework?

  • Static analysis (Coverity?)
  • Formal documentation (Doxygen?)
  • Automatic cross-compiling?
  • Automatic on-screen serialization?

Thoughts dump

  • Huge literature on the subject and extremely developed existing software. What does this project bring?

(Res)sources

Procedural content generation: L-Systems (by Rabidgremlin)

The Algorithmic Beauty of Plants

/r/lsystem

Job Talle – Lindermayer systems

About

Procedural Generation Experiments

License:GNU General Public License v3.0


Languages

Language:C++ 81.3%Language:C 18.4%Language:Makefile 0.3%