After some experimentations mostly done tolearn how the JME scenograph works, I can tell it works well, and very easily. In no time, I'm ready to focus on my algorithm and it is a good thing : the procedural generation algorithm are not that simple.
The first step is the road network generation, wich is done with a simple non-oriented graph of road segments and road nodes (crossings). The generation of the graph is computed by a L-System that call two agent to manage production rules :
- The goals manager is a creative agent : it create one to three road segment from a source segment, depending on its sociostatistical situation (near or far a city center, respecting a general road pattern, lost in campaign...)
- The constraints manager is a restricive agent : it checks the generated segments and correct them if, for exemple, they fall in obstacles or water. It is also self-sensitve and connect roads when they get to much close.
This last class fits in 30 lines, but has been the most difficult to stabilize, since there are tons of different and hard to predicate cases.
You can see major road in white, minor roads in green, and two general paterns in action (raster "rectilinear" on the right, and free "organic" on the left). At this point, we've got more bugs than things working, but it is just the beginning !
Aucun commentaire:
Enregistrer un commentaire