You're misunderstanding Cain and Abel. Abel offered an acceptable sacrifice but Cain didn't. God WASN'T playing favorites.
(Genesis 4:2-7 NIV) Later she gave birth to his brother Abel. Now Abel kept flocks, and Cain worked the soil. {3} In the course of time Cain brought some of the fruits of the soil as an offering to the LORD. {4} But Abel brought fat portions from some of the firstborn of his flock. The LORD looked with favor on Abel and his offering, {5} but on Cain and his offering he did not look with favor. So Cain was very angry, and his face was downcast. {6} Then the LORD said to Cain, "Why are you angry? Why is your face downcast? {7} If you do what is right, will you not be accepted? But if you do not do what is right, sin is crouching at your door; it desires to have you, but you must master it."
God was clear that what Cain did wasn't right.
That why I said you need to have a good relationship with God. Abel relationship with God was better than that of Cain that why his offering was accepted. The point here is Abel was close to God than Cain that what made him favourite. Thanks for your comment once again.