Generators usually have a built in inverter function so they produce alternating current, like wall outlet current
in a house, up to the maximum wattage that the generator is designed to produce. Usually the name suggests
the maximum output in watts. Yes, you put gas in them. Yes, they are expensive, and the more pricey ones even
have remote start capability, which is a nice feature. If it's outside (as almost all generators are, whether built
into the van somehow, or just attached (see more at easily stolen) to the van somehow, it's nice to not have to
exit the van, to get the power maker running. Most people prefer built in, but it's not always easily do-able without
modifying existing van features, like fuel tanks, and suspension parts, as most RV manufacturers add them below
the van usually towards the rear. If you're DIYing a class B RV, you might have options based on where it fits into
your master van plan layout. You might find a way to integrate it somewhere without having to move other stuff
out of the way.
As others have said, it's usually part of a 3 way electrical system which usually includes both 12V DC and 120V AC
power sources combined to work separately, but together to provide multiple power options. Not all stuff runs well
on DC (batteries) and not all other stuff runs well on 120V AC, so it gives more flexibility.
Normally, most class B RVs will have coach batteries, for straight 12V DC power, and a gas or propane generator
and a 30 amp shore power plug to provide straight AC power. Often the use of the generator and shore power
recharges the coach batteries, while providing AC power through a converter/charger system which redirects some
AC power to charge the DC batteries.
The engine alternator can also charge the DC batteries while running, via a thing called an isolator/separator which
connects the coach batteries to the same charging system as the engine battery, for as long as the engine is running,
and then keeps the coach batteries separate from the engine battery while you're camping, so you can always start the engine, if you inadvertently drain the coach batteries.
Confused yet?
Me too.
Here's another good site......
http://www.rvstuff.ca/phredex.html
It's got some links to stuff by a guy named Phred Tinseth (the phrannie.org domain and name has expired?)
who has written things called "poop sheets" (this is "the poop" on whatever) and some folks have preserved
them on the internet. You can get lots of great info from anything he's written, if you can find it. Google is
your friend.
Good luck.