Opened 8 years ago

Last modified 5 years ago

#4034 new enhancement

Give some engine parameters to JavaScript shared functions — at Initial Version

Reported by: FeXoR Owned by:
Priority: Should Have Milestone: Backlog
Component: Maps Keywords:
Cc: Patch:

Description

As for example random maps need to take into account some engine parameters it would be nice if some would be added to globalscripts e.g. in a file EngineParameters.js in an dictionary like object g_EngineParameters.

The following parameters are needed by random maps (Most of them allready found at the beginning of library.js):

  • CELL_SIZE = 4 (The width of a terrain texture tile in horizontal engine space units)
  • HEIGHT_UNITS_PER_METRE = 92 (The number of vertical engine space units matching a horizontal engine space unit)
  • MAX_HEIGHT_RANGE = 0xFFFF / HEIGHT_UNITS_PER_METRE (The maximum value for vertical engine space in horizontal engine space units)
  • MAP_BORDER_WIDTH = 3 (The width in )

NOTE: Any space unit will do if the scaling is given as well.

Some other parameters would be nice to also have access to but I'm not sure if they are engine parameters or set in the mods:

  • MIN_MAP_SIZE = 128 (The map width of the smallest map as chosable in mapsetup/Atlas in terrain tiles)
  • MAX_MAP_SIZE = 512 (Same just the largest chosable map size)
  • BUILDING_ORIENTATION = - PI / 4 (The placement angle buildings should be placed by default. For random maps it's rotated and the direction changed, see map.js getMapData)

Other components like simulation/UnitAI/PlayerAI, Atlas might also need some parameters so further comments welcome!

This is basically for reducing hardcoding the same things at multiple places. However, it's also quite vital for mods if build from scratch.

Change History (0)

Note: See TracTickets for help on using tickets.