Friendship is summarized in this
Bulbapedia article.
what affects pokemon relationships? what is the formula and factors?
who has done the testing?
# TIME? do they like you more depending on how long they have been with you or away (inside box1?) ?
Not time, but the number of steps you walk while the Pokemon is in your party. After a certain number of steps (the exact number varies from generation to generation but in the current generation, it's 128), your friendship with all the Pokemon in your party increases.
# of VICTORIES? is it from winning battles? or just participating but not necessarily winning battles?
Nope. Winning battles doesn't affect friendship.
# of FAINTS/LOSSES? is it tied to fainting?
Fainting results in a decrease in friendship.
# of LVLs GAINED?
Each time a Pokemon levels up, its friendship level increases.
does using selfdestruct or explosion change how they like you negatively?
Yes, there will be a decrease in friendship due to them having fainted.
if you are their original trainer, and you only have the badge that commands up to level 30, do they stop obeying at a certain point?
This one I'm actually not sure about. I feel like it's happened to me before, but I'm not 100% certain I'm remembering correctly...
if you are the original trainer and you trade your monsters away, and trade it back, does it still know you? is that monster's relationship still the same as before trading it?
Trading resets friendship, so even if you trade it back, its friendship has been reset.
i know traded ones stop obeying depending on your badges, but if your traded ones have maxed 'like' for you, do they still stop obeying past your badge level? like if i trade a chimchar at level 1 and have the badge for commanding level 50, and train infernape past 50, does all the 'like' it has for me just disappear and not matter?
Friendship isn't affected by obedience, at least to my knowledge, though maybe someone can correct me if I'm wrong :x
i would imagine with hacking tools these things can be determined right?
They have been ^^