Good examples of such a great code is Luna Engine,
LOL - Really?> I found more than half of the scripts in luna to have little to zero documentation at all. Literally, there are scripts without a single line of comment. Perhaps they have updated it since then
😛
Personally, I used to document my actual code as much as possible - now I feel its easy enough to just read over the code and understand it. I try to use method names and variables names that are recognizable and perhaps even universal amongst my scripts (such as creating a variable named '@caller' or '@__caller' to hold info on which object created this particular instance.
Nowadays, I mostly only document my code that isnt ruby. (ruby is generally very easy to read and understand) - the only time I leave a comment (when scripting ruby) is when i am passing numerous args to a method AND the script is intended to be used to create/enhance other scripts (as seen below - snippet taken from a recent Gauge creation script of mine)
#===============================================================================class Gauge#=============================================================================== #----------------------------------------------------------------------------- # Gauge.new(*args) # args[0] = self. always, self. # args[1] = viewport # args[2] = battler # args[3] = method # args[4] = rate method # args[5] = x position # args[6] = y position # args[7] = width # args[8] = height # args[9] = z value # args[10] = background edge color # args[11] = background filler color # args[12] = main color (left) # args[13] = main color (middle) # args[14] = main color (right) # args[15] = empty color - as the gauge empties this coloris gradually applied # to the gauge sprite. # args[16] = OPTIONAL - Scroll, true/false # args[17] = OPTIONAL - allows images to be used for both layout and filler. # - if used this has to be an array in the format detailed below: # - [ ["Layout_Name",layoutHueValue] , ["Filler_Name",fillerHueValue,x,y] ] # - both HueValues should ether be an integer or nil. (nil = 0 hue change) # - x/y only affect filler image position in relation to the layout pos. # - both x && y are also optional, they will be 1 by default. # args[18] = OPTIONAL - gauge style (default is :aggro) # args[19] = OPTIONAL - gauge decay # args[20] = OPTIONAL - gauge delay # args[21] = OPTIONAL - gauge flash #----------------------------------------------------------------------------- def initialize(*args) init_args(*args) init_lanf update end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- def init_args(*args) # Main @caller = args.shift @viewport = args.shift || nil @battler = args.shift || nil @battler_changed = false @needrefr = true # Refresh Flag # Value @bmethod = args.shift || nil @bvalue = @battler.send(*@bmethod) @old_bvalue = @bvalue # Rate @rmethod = args.shift || nil @rvalue = @battler.send(*@rmethod) @old_rvalue = @rvalue # Sprite @x = args.shift || 0 @y = args.shift || 0 @width = args.shift || 64 @height = args.shift || 10 @z = args.shift || 100 @bkcolor = args.shift || Gauges:
😀efault_Settings[:background_m] @bkfiller = args.shift || Gauges:
😀efault_Settings[:background_f] @mncolor1 = args.shift || Gauges:
😀efault_Settings[:main_color_1] @mncolor2 = args.shift || Gauges:
😀efault_Settings[:main_color_2] @mncolor3 = args.shift || Gauges:
😀efault_Settings[:main_color_3] @empcolor = args.shift || Gauges:
😀efault_Settings[:empty__color] @empalpha = @empcolor.last @filler_s = args.shift || Gauges:
😀efault_Settings[:gauge_scroll] @use_bms = args.shift || false @_style_ = args.shift || Gauges:
😀efault_Settings[:gauge__style] @__decay = args.shift || Gauges:
😀efault_Settings[:gauge__decay] @decay_is_enough = @__decay[0] && (@__decay[1] > 0) @__delay = args.shift || Gauges:
😀efault_Settings[:gauge__delay] @delay_is_enough = @__delay[0] && (@__delay[1] > 0) @flashcol = args.shift || Gauges:
😀efault_Settings[:gauge__flash] @fixfldur = 60 #Graphics.frame_rate @drawtext = args.shift || false end #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- # ...Other than that, I dont really comment ruby anymore
🙂