subota, 19. siječnja 2013.

Map generation pipeline

New game form is almost complete, all that is left is map setup GUI. That would be trivial if it was simple "select size" drop down menu but I want to expand it a little, I want to add more options. By default map is square shaped and I want to add means for defining different shapes such round or spiral. Instead of hardcoding few shapes, I opted for plugin based system where each shape generator is a DLL file containing a class with certain interface. Actually a single DLL file can contain multiple map shapes but that's technical detail point is, map shapes are .Net code that is outside the main executable. That was the idea before I've started implementing new game GUI. Thing I realized yesterday is that code for positioning stars is short compared to the rest of the map generation code (assigning star types, populating stars with planets, ensuring balanced distribution of "good" and "bad" planets) and that I or modder would want to reuse that over multiple map shapes. That made think a little bit more, define the map generation pipeline and decide what would be moddable and how.

Looks simple and trivial and that is the power of documentation (that I can't stress more). In star positions phase, as mentioned positions for the stars are calculated but stars are not yet generated. In the next phase
star types and sizes are decided. There potentially could be more attributes such as space monster lairs or alien relics but at the moment they are not defined. In parallel to that phase can go the phase where "starlanes" (or wormholes) are distributed. Planet distribution phase and planet attributes phase may actually be single phase. Anyway those two phases fill star systems with planets and calculate attributes such as planet size or environmental conditions.

Potentially each phase on the flow chart can be made moddable but at the moment I don't see the need for that extreme. For now I'd group those five phases to two groups: star graph and planet generation.

Odd choice is putting star attribution to planet generation. The original idea was that star type directly influences distribution of planets (both positionwise and typewise) in the star system. Putting star positions and starlanes in the same bucket may reduce the code reuse a bit but it simplifies interfaces for plugin code. I don't know, may I could split them somehow without "void *" arguments and with the fewest presumptions.

Nema komentara:

Objavi komentar