Jump to content

RMGEN libs general direction and cleanup


Recommended Posts

Recent changes in misc.js (starting entity placement including civ bonus start walls for Iberians) made me notice that functions are not that perfectly named, organized and written in general (e.g. the order of arguments and the arguments taken at all).

I added placeCivDefaultEntities(fx, fz, playerid, angle, kwargs) to make starting entity placement suffice Mythos_Ruler's request here (It includes further infos and possibilities for Iberian wall placement as well). That function now (in most maps) replace createStartingPlayerEntities(fx, fz, playerid, civEntities, BUILDING_ANGlE). He added my files to the repository after some discussion but I'd like to exchange some thoughts about that and the rmgen libs in general :gossip:

I added keyword arguments to the function so edge case usage doesn't require all possible arguments (don't know if that is a usual practice in javascript though) and avoid the need of changing all random maps when a new feature is added (only the libs has to be changed and the maps using the new feature). As you might already have noticed the new function doesn't take the civEntities as an argument (they are got inside the function itself by playerid). That makes the starting entity placement a 'one liner'. In some cases (like used in random map fortress) the civEntities might need to be adjusted though (the number of units or even the unit types). This could now be added as an other keyword argument (but actually isn't). Well, it was somehow unexpectedly added :D (for me it was rather a demo version than something to commit)

The naming should IMO always start with 'place' if something is actually placed, that's why the different name (and to stay compatible to custom maps maybe out there at least until some ppl agree with the concept I left the old function as was). But in the end there should be only one function for starting entity placement IMO. The placement angle should be a kwarg, too, and default should be the (strangely named) BUILDING_ANGlE IMO.

So please let me know what you want have changed in the near future so no log-spamming and in the end maybe even unwanted code winds up in Alpha 10...

Until then I'll further check the default Iberian wall placement function's especially a 'while' loop that caused an out of memory error (infinite looping) in an earlier version when random seeds where much lower/higher then average. I think it's fixed in the actual version but I better check again... :sweatdrop:

Edited by FeXoR
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...