All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
A young man should hasten to marriage whenever he can because Allah, The Almighty, Says (what means): {So, race to [all that is] good.} [Quran 2:148] Verily, marriage is one of the greatest good deeds by means of which one complies with his Lord’s command; follows the guidance of his Prophet, sallallaahu ‘alayhi wa sallam; guards his chastity; is blessed with children; and attains many other great virtues.
Whoever is unable to get married and cannot fast, let him preoccupy his free time with beneficial activities such as seeking useful (Islamic) knowledge, performing good deeds, keeping the company of righteous people, exercising and practicing sports, and reading useful books on worldly or religious matters.
There is nothing wrong with playing electronic games as long as one abides by the Sharee‘ah regulations in this regard, meaning that the content of such games should not include Sharee‘ah violations such as music, exposure of people’s ‘Awrah (parts of the body that must be covered), and the like. Games should only be played occasionally for recreational purposes. It is unacceptable to spend most of one’s time playing games! Verily, life is too short, and a Muslim will regret having wasted any moment of it in vain activities. Al-Bukhaari reported on the authority of Ibn ‘Abbaas, may Allaah be pleased with him, that the Prophet said: “There are two blessings concerning which many people are losers: health and free time.” [Al-Bukhaari]
If the options we mentioned to you do not distract you from those sexual thoughts, then there is nothing wrong with playing these electronic games, even if you spend most of your time playing them, as long as it does not entail neglecting your religious duties such as the prayer and the like, and you should hasten to marriage whenever you have the needed means to do so.
Allah Knows best.