Giter Club home page Giter Club logo

procgen's Introduction

Procedural Generation Experiments

Philosophy

Implemented

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

Main Roadmap

  1. Add a relatively precise hitbox to select LSystem for modification
  2. Save and load L-system models
  3. Add a more complex GUI (classic with a main menu bar and right-click) and polish it
  4. Add genetic algorithm or constraint-based algorithm for new LSystem generation

Other ideas

Next Bugs

  • LSystemView copies does not all update themselves
  • Copy operations on LSystemView (and others) breaks because of Observable (id counter)

Optimization & non-urgent bugs

  • Optimization 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).
    • Cache multi-iteration production rules (very good for execution time but bad for memory consumption)
    • Use raw OpenGL to reduce the size of vertices (no texcoord for example)
    • Use `sqrt` instead of `cos` and `sin` for angles
  • Bugs
    • Correct floating point errors when using big number of iterations
    • Correct zoom level and drag behaviour when resizing window

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?

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).

(Res)sources

Procedural content generation: L-Systems (by Rabidgremlin)

The Algorithmic Beauty of Plants

/r/lsystem

Job Talle – Lindermayer systems

procgen's People

Contributors

epholys avatar

Stargazers

VonVictor V. Rosenchild avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.