Any computer will do for your homework, you can get an old P3 for it.

For playing games, that is another thing.
Getting a custom built one is not a bad idea, as you will have to decide about the best fit components within the money you can spend on it.
Important for games are the video card, enough RAM and a good processor. You can go economy on sound, harddisk space (not quality) and DVD drive.
I would advise a new mainboard, from a processor line that will be supported for some years. That way you can upgrade the components over time and make it last longer.