soundmud / soundrts

A real-time strategy audio game
http://jlpo.free.fr/soundrts
Other
43 stars 31 forks source link

Sight and special range corrections #149

Open SavagingSky opened 1 year ago

SavagingSky commented 1 year ago

I think that sight_range 1 and special_range 1 should be replaced not with default square length 12 parameters, but rather by default map square length. So instead of if "sight_range" in d and d["sight_range"] == 1 PRECISION: d["sight_range"] = 12 PRECISION d["bonus_height"] = 1 info( "in %s: replacing sight_range 1 with sight_range 12 and bonus_height 1", name, ) if "special_range" in d: del d["special_range"] d["range"] = 12 PRECISION d["minimal_range"] = 4 PRECISION d["is_ballistic"] = 1 info( "in %s: replacing special_range 1 with range 12, minimal_range 4 and is_ballistic 1", name, ) there should be if "sight_range" in d and d["sight_range"] == 1 PRECISION: d["sight_range"] = SquareLength+1 PRECISION info( "in %s: replacing sight_range 1 with sight_range 12 and bonus_height 1", name, ) if "special_range" in d: del d["special_range"] d["range"] = SquareLength+1 PRECISION d["minimal_range"] = SquareLength//3 PRECISION info( "in %s: replacing special_range 1 with range 12, minimal_range 4 and is_ballistic 1", name, ) return d It would solve those defs working not as intended on non standard maps, where square length is less or more than 12.

soundmud commented 1 year ago

A problem is that the map is not known yet when the rules are loaded, so the game would need to remember that some values are to be replaced only when building the map.

Those corrections were trying to fix automatically some mods instead of fixing the mod manually. I'm not sure about what exactly the game is supposed to do anyway. Maybe try to turn the non standard map into a "folder map with custom rules" to check if the newly corrected rules would be better.

soundmud commented 1 year ago

The load order of the map and the rules could change though, if it doesn't break the game. I don't know.