So, here's the thing. I've got a person, who would be willing to make music for my game and work together with me, and he only requires credit for it in the game. But how can we make this legal, so that if I release my game on Steam, for example, that he can't do anything to sue me and stuff like that. What kind of contracts or licenses are needed?
If you're going the commercial way (selling on steam) then the "yeah whatever" agreement is strongly not recommended. I would also advise against the creative commons agreement because it can have legal holes (both for you and the artist). So you have to do a licensing contract like you would do with a graphic artist even if he works for free so you're both covered legally and there wouldn't be any misunderstandings.
There are some templates on the net but here are some guidelines:
-Full name and adress of both parties
-Name of the items (tracks/songs/soundFX) involved in the contract
-Declaration of original work: where the author declares his/her work is original and that he owns all the legal rights.
-Exclusive or non-exclusive agreement?
-Use of the item: only one-end product? Which type of product? Commercial use or not?
-Derivative products: usable in a video trailer but not resellable or giftable as a soundtrack bonus for example.
-Restrictions on number of uses: after 1.000 units sold, the artist could get royalties for example.
-Lifetime of the license: 5 years? 10 years? Unlimited(till the death of contractor)?
-Territory: specify which country or worldwide.
-Terms&conditions: payment or free of charge or royalties. Also put a clause for eventual further disagreements.
-Date and signatures of both parties.
It may seem as an hassle and unwanted paperwork but it's good for you and the artist to cover your respective asses.
PS: as it seems he hasn't yet written tracks for your game, don't make him sign such a contract until all is done unless you really want to secure everything (flakes are a possibility if there is no money and legal ties involved).