I have another good way to describe the differences. Sorry for wall of text, but I promise it's educational.
Classes
Classes, as
@Chiispiitas explains, is for things of which you want to have their own data, memory, and instance but MOST importantly, initiate. If we look at
Scene_Menu (which is NOT saved in the save file), you can do:
You can't do that with a module, so you'd do classes for things you want to initiate. Scene_Battle is the best example because it's the biggest class across all versions, and it's something you just cannot do in modules.
Modules
A good example of a module is one that I use in my game. One really good use for them is to hold large swabs of data that you don't want accessed all the time, even in a particular instance. For example, one of my modules is "UnitType Module." So let's say you have it in your game where all undead have 50% weakness to fire, and let's say you made 100 undead enemies. Now, if you were to decide "nah, imma make it 25%", do you want to go back to all 100 and change it? Nope! So I made this module to change/overwrite data for that instance of the enemy (so it doesn't change the data of enemies of that ID, just that specific instance of that enemy with that ID) in each instance an action is done upon them.
So, during Game_Battler, Game_Enemy, Game_Actor, and Interpreter, I call upon this module's methods in the correct locations (when calculating elemental damage) to access the Unit types of the object (enemy or actor), when I'd have to copy the code in each of those classes which goes into what
@kyonides said in that, because it is a method that can be copied to each, a module allows me to essentially have them all share a method without dealing with inheritance. Now, if you're savvy, you might think "Why not insert the code in Game_Battler and call it in both Game_Enemy and Game_Actor" and the answer is I'd still have to copy the code in Interpreter, and I'd have to change Game_Battler further since Enemies and Actors have different formulas for their elemental weakesses/resistances. The method is also very long, so having it in a single spot and only 1 copy of it means, should I change the formula, I don't have to remember to change it everywhere of which it is present.
A much more simple use for them (last example, I promise) is to share variables between unrelated classes that are often very difficult to do. Modules are a clean way to transfer variables since you can call them from anywhere in any class. For example, if you are using a skill and you want to retrieve the ID of the enemy you hit because, after the battle, you want to run a script where you gain gold equal to their HP at that time (example). You can do this:
Ruby:
module gold_mod
@hp_gold = 0
@enemy_id = 0
def self.enemy_hp_gold(x,id)
@hp_gold = x
@enemy_id = id
end
def self.get_hp_gold
return [@hp_gold,@enemy_id]
end
end
class Game_Battler
def [whatever your damage method is]
[enter damage calculation here]
gold_mod.enemy_hp_gold(self.hp,self.id) if self.is_a?(Game_Enemy)
end
end
Then, in the event, you can do a conditional branch of:
Ruby:
gold_mod.get_hp_gold[1] == 12 #(checks if the enemy was ID of 12)
Then do a script call of:
Ruby:
[gold syntax here] += gold_mod.get_hp_gold[0] #(gives you the HP they had after damage)
No cross-class-referencing needed as module does all that for you. GRANTED, you can also do this by using the in-engine variables in Game_Battler ($game_variables) then recalling it in interpreter easily through eventing but this is an easy example to show the use of the modules to share variables of unrelated classes. In this case, Interpreter (which is in charge of on-map events) and Battler. You also cannot do self.is_a?(Game_Enemy) if Game_Enemy was a module because a module cannot be an object since it cannot be initialized.
I know I said a lot, but I hope you at least got quite a bit of newfound info from that.