It takes more than a MOSFET, Diode, and Capacitor to make an SMPS
But generally, controller IC's require them as external components, some can integrate either the switch (MOSFET), diode, or both.
4-24V input is very wide range. With 12-14V output being a rather narrow range. The options for this sort of setup would be Buck-boost, Sepic, Zeta, or some hybrid type converter, which either acts as a buck or a boost and tries to 'seamlessly' switch between them (often called a "non-inverting buck-boost converter"). Cascaded setups - as in boost then buck, or buck then boost tend to be rather inefficient, and also cost more since you effectively have two converters.
Sepic and zeta generally (but not necessarily) require coupled inductors, that is an inductor with two identical windings. These are available off the shelf, although not as common as stock single winding ones. A flyback converter can also have an output that is either higher or lower than the output, but this would require a customer inductor.
With 4V in, and 14V (min in, max out) out thats 14/4 = 3.5 boost factor. With 24V in and 12V out (max in, min out) thats 0.5.
https://www.ti.com/seclit/ml/slup346/slup346.pdf http://www.ti.com/ww/en/simple_switcher/design-tools.html - originally national semiconductor, but since TI took over, you have to sign up to use this sadly. Doesn't seem to work properly for me.
http://www.linear.com/product/LT1513 - lead acid battery charger SEPIC
http://www.ti.com/lit/ds/symlink/lm5118.pdf - buck boost
I believe there are application notes for MCU controlled battery chargers that use the microcontroller itself as the power supply controller.
http://www.st.com/resource/en/application_note/cd00116930.pdfI couldn't find the Atmel one, although I vaguely remember seeing one about years ago.
That should be enough to get you started. Given its a battery charger, you shouldn't have to worry too much about output noise/ripple, or extreme efficiency (as in 95%+) which makes life easier - you can even do it "from scratch" as you mentioned, although this is very difficult, and would be much easier/safer to get a working power supply first, then integrating that into your charge controller rather than have the MCU do everything.