It's one thing to get the graphics aligned perfectly, it's another to do this for every single resolution and not take too much time and/or make the code unreadable due to size. Games like Battlefield 3 and Minecraft seem to manage this. But what do they do to keep things from stretching or going off the screen? I don't know any algorithms to do this. I'd like some help on this topic. I've always programmed games that only handle a single resolution, so help would be appreciate.
The standard 3D pipeline is completely agnostic to screen resolution. For most projection matrix algorithms, including the "standard" ones in GL/D3D, an aspect ratio is part of the matrix allowing the projection to properly cope with different "shapes" of resolution. Just be sure to pass in the current resolution to the viewport setting routines calls and the current aspect ratio to the projection matrix routines and 3D is more or less automatically resolution-independent. The 3D projection/math all works in a normalized coordinate system where the upper-left corner of your screen is
For the 2D elements, these are specified independently of the screen. E.g. a compass in the upper right is located with its upper-right corner at
With very very little effort a game can Just Work(tm) at any resolution.