Opened 2 years ago

Closed 2 years ago

#5042 closed enhancement (fixed)

Complete rmgen object-oriented programming paradigm

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Alpha 23
Component: Maps Keywords:
Cc: Patch:

Description

The most powerful feature of random map generation is the createArea method which consumes a Placer, Painter and Constraint instances.

The methods to determine a geometric shape, constraining that area arbitrarily and doing something arbitrary to that area are well split by logic into prototypes. This way one can combine them like lego.

Since we now have a significant amount of JS prototypes implementing these interfaces, the files should be split per protoype, gaining the advantages of https://en.wikipedia.org/wiki/Information_hiding.

The remaining code would come out nicer too if it would be split into protoypes.

This is a continuation of #4804.

Change History (5)

comment:1 by elexis, 2 years ago

In 21287:

Split the random map generation Placer prototypes into one file per prototype, refs #5042, #4804.
The flags should preserve revision history.

comment:2 by elexis, 2 years ago

In 21288:

Split random map generation Painter prototypes into one file per prototype, refs #5042, #4804.

comment:3 by elexis, 2 years ago

In r21289:

Separate object-oriented random map generation core library "rmgen" from miscellaneous helper procedures which are moved to a new library "rmgen-common", refs #4804, #5042.
This way mods can use the placement and painting prototypes while excluding any common 0ad code.

comment:4 by elexis, 2 years ago

In 21290:

Use CamelCase for random map files containing the prototype of the same name, refs #5042, #4804.

comment:5 by elexis, 2 years ago

Milestone: BacklogAlpha 23
Priority: Should HaveNice to Have
Resolution: fixed
Status: newclosed

I'm a bit reluctant to split the 11 constraint prototypes having 160 lines into 11 files with 14 lines each. Same for Terrain and Group. player.js and the wall builder should likely become a protoype eventually, but aren't part of rmgen anymore.

Note: See TracTickets for help on using tickets.