Carnival wasn’t exacty invented in Venice after all, it was more of a transformation of the festivities which are known as the Greek Dyonisian - along with the Roman Saturnalia - which were kind of a “freedom celebration”: a time when certain limits could be overcome, and social duties and hierarchies too.
Masks were also used, in those ancient times, and these festivities were some sort of an “out-of-winter” feeling, a Spring celebration, hormones going wild, feeling good being outside.
The Italian word “Carnevale” comes from the Latin “carnem levare” (remove the meat), representing the last big meal before Lent.
Some other interpretations place its origins as the name of a common meat-based country feast (carnualia in Latin) or the festival of the Navigium Isidis ("ship of Isis"), where the image of Isis was carried to the seashore to bless the start of sailing season.
In Venice the beginning of Carnival in 1162 put together the joy for the victory against Ulrich II von Treven, with the desire of a big social celebration, and the Venetians went with their Carnival all the way, as much as went the other carnivals, in Italy and in Europe in general: the wilder the better.
Carnival was a big event in Venice, sure, but let’s remember that population in Venice in the XIII century was of about 80,000 inhabitants , and never went beyond the 200,000 units.